@salsita-ai/sdk 0.50.0-develop.b5468d6828 → 0.50.0-develop.bb1eefaada
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/README.md +8 -4
- package/dist/admin/default-admin-elements.d.ts +9 -0
- package/dist/admin/default-admin-elements.js +1 -0
- package/dist/admin/default-elements/built-in-entity-element.d.ts +10 -0
- package/dist/admin/default-elements/built-in-entity-element.js +1 -0
- package/dist/admin/default-elements/built-in-layout-element.d.ts +10 -0
- package/dist/admin/default-elements/built-in-layout-element.js +1 -0
- package/dist/admin/default-elements/index.d.ts +2 -0
- package/dist/admin/default-elements/index.js +1 -0
- package/dist/admin/index.d.ts +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/application-spec/caching/content-diff.js +1 -1
- package/dist/application-spec/core/application-file.d.ts +0 -2
- package/dist/application-spec/core/application-file.js +1 -1
- package/dist/application-spec/errors/diagnostic-codes.d.ts +5 -0
- package/dist/application-spec/errors/diagnostic-codes.js +1 -1
- package/dist/application-spec/errors/diagnostic-messages.d.ts +5 -0
- package/dist/application-spec/errors/diagnostic-messages.js +1 -1
- package/dist/application-spec/generate-application/code/common/code-imports.js +1 -1
- package/dist/application-spec/generate-application/code/common/env-reader.js +2 -2
- package/dist/application-spec/generate-application/code/common/index.d.ts +1 -0
- package/dist/application-spec/generate-application/code/common/index.js +1 -1
- package/dist/application-spec/generate-application/code/common/single-quoted-string.d.ts +6 -0
- package/dist/application-spec/generate-application/code/common/single-quoted-string.js +1 -0
- package/dist/application-spec/generate-application/code/domain-runtime-files.js +1 -1
- package/dist/application-spec/generate-application/code/project-scaffolding.d.ts +10 -14
- package/dist/application-spec/generate-application/code/project-scaffolding.js +2 -2
- package/dist/application-spec/generate-application/code/templates/admin-config.js +3 -0
- package/dist/application-spec/generate-application/code/templates/common/format-property-key.d.ts +7 -0
- package/dist/application-spec/generate-application/code/templates/common/format-property-key.js +1 -0
- package/dist/application-spec/generate-application/code/templates/common/schema-to-type-string.js +3 -3
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-component-optics.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-component-optics.js +6 -6
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-presets.js +1 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-resources.js +13 -13
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-states.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-states.js +2 -2
- package/dist/application-spec/generate-application/code/templates/eslint-config.d.ts +5 -0
- package/dist/application-spec/generate-application/code/templates/eslint-config.js +4 -5
- package/dist/application-spec/generate-application/code/templates/gitignore.js +1 -3
- package/dist/application-spec/generate-application/code/templates/globals.js +7 -4
- package/dist/application-spec/generate-application/code/templates/index.d.ts +2 -2
- package/dist/application-spec/generate-application/code/templates/index.js +1 -1
- package/dist/application-spec/generate-application/code/templates/lingui-rc.d.ts +5 -0
- package/dist/application-spec/generate-application/code/templates/lingui-rc.js +4 -4
- package/dist/application-spec/generate-application/code/templates/prettier-config.d.ts +5 -0
- package/dist/application-spec/generate-application/code/templates/prettier-config.js +4 -5
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-cli-skill.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-create-configurator-skill.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-feedback-skill.js +5 -5
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-review-skill.js +3 -3
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-variants-skill.js +2 -2
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +13 -2
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +2 -2
- package/dist/application-spec/generate-application/code/templates/spec-code/collect-spec-code.d.ts +58 -0
- package/dist/application-spec/generate-application/code/templates/spec-code/collect-spec-code.js +1 -0
- package/dist/application-spec/generate-application/code/templates/spec-code/index.d.ts +2 -0
- package/dist/application-spec/generate-application/code/templates/spec-code/index.js +1 -0
- package/dist/application-spec/generate-application/code/templates/spec-code/spec-code.d.ts +18 -0
- package/dist/application-spec/generate-application/code/templates/spec-code/spec-code.js +41 -0
- package/dist/application-spec/generate-application/code/templates/spec-messages/index.d.ts +1 -0
- package/dist/application-spec/generate-application/code/templates/spec-messages/index.js +1 -0
- package/dist/application-spec/generate-application/code/templates/spec-messages/spec-messages.d.ts +20 -0
- package/dist/application-spec/generate-application/code/templates/spec-messages/spec-messages.js +6 -0
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-model-runtime.d.ts +6 -4
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-model-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.d.ts +3 -2
- package/dist/application-spec/generate-application/runtime/admin-runtime/admin-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/admin-runtime/states-runtime.d.ts +2 -2
- package/dist/application-spec/generate-application/runtime/application-runtime.d.ts +13 -6
- package/dist/application-spec/generate-application/runtime/application-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-model-runtime.d.ts +6 -4
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-model-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.d.ts +3 -2
- package/dist/application-spec/generate-application/runtime/configurator-runtime/configurator-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/configurator-runtime/states-runtime.d.ts +2 -2
- package/dist/application-spec/generate-application/runtime/migrations/migration-runtime.d.ts +2 -2
- package/dist/application-spec/generate-application/runtime/sections/assistant-runtime.d.ts +2 -2
- package/dist/application-spec/generate-application/runtime/sections/build-sdk-optic.d.ts +2 -1
- package/dist/application-spec/generate-application/runtime/sections/build-sdk-optic.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/build-user-bound-optic.d.ts +2 -1
- package/dist/application-spec/generate-application/runtime/sections/build-user-bound-optic.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/component-optic.d.ts +3 -0
- package/dist/application-spec/generate-application/runtime/sections/component-optic.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/data-runtime.d.ts +4 -4
- package/dist/application-spec/generate-application/runtime/sections/expression-runtime.d.ts +7 -4
- package/dist/application-spec/generate-application/runtime/sections/expression-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/generate-memo-eval-plan-runtime.d.ts +9 -5
- package/dist/application-spec/generate-application/runtime/sections/generate-memo-eval-plan-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/reflection-constants-runtime.d.ts +3 -1
- package/dist/application-spec/generate-application/runtime/sections/reflection-constants-runtime.js +1 -1
- package/dist/application-spec/generate-application/runtime/sections/theme-runtime.d.ts +2 -2
- package/dist/application-spec/generate-application/runtime/sections/transformers-runtime.d.ts +3 -3
- package/dist/application-spec/generate-application/runtime/spec-code/index.d.ts +2 -0
- package/dist/application-spec/generate-application/runtime/spec-code/index.js +1 -0
- package/dist/application-spec/generate-application/runtime/spec-code/resolve-spec-code.d.ts +18 -0
- package/dist/application-spec/generate-application/runtime/spec-code/resolve-spec-code.js +1 -0
- package/dist/application-spec/generate-application/runtime/spec-code/spec-code-module.d.ts +17 -0
- package/dist/application-spec/generate-application/runtime/spec-code/spec-code-module.js +1 -0
- package/dist/application-spec/generate-application/runtime-spec/decode-runtime-spec.d.ts +9 -0
- package/dist/application-spec/generate-application/runtime-spec/decode-runtime-spec.js +1 -0
- package/dist/application-spec/generate-application/runtime-spec/encode-runtime-spec.d.ts +8 -0
- package/dist/application-spec/generate-application/runtime-spec/encode-runtime-spec.js +1 -0
- package/dist/application-spec/generate-application/runtime-spec/encoded-runtime-spec.d.ts +27 -0
- package/dist/application-spec/generate-application/runtime-spec/encoded-runtime-spec.js +1 -0
- package/dist/application-spec/generate-application/runtime-spec/index.d.ts +5 -0
- package/dist/application-spec/generate-application/runtime-spec/index.js +1 -0
- package/dist/application-spec/generate-application/runtime-spec/runtime-spec.d.ts +68 -0
- package/dist/application-spec/generate-application/runtime-spec/runtime-spec.js +1 -0
- package/dist/application-spec/generate-application/runtime-spec/spec-code-id.d.ts +40 -0
- package/dist/application-spec/generate-application/runtime-spec/spec-code-id.js +1 -0
- package/dist/application-spec/parse-application-files/categorize/categorize-files.d.ts +18 -0
- package/dist/application-spec/parse-application-files/categorize/categorize-files.js +1 -1
- package/dist/application-spec/parse-application-files/categorize/earlier-generated-editor-configs.d.ts +16 -0
- package/dist/application-spec/parse-application-files/categorize/earlier-generated-editor-configs.js +9 -0
- package/dist/application-spec/parse-application-files/raw-spec/parse-yaml-spec-file.js +1 -1
- package/dist/application-spec/parse-application-files/spec/application/admin-spec/admin-spec.js +1 -1
- package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.js +1 -1
- package/dist/application-spec/parse-application-files/spec/common/index.d.ts +1 -0
- package/dist/application-spec/parse-application-files/spec/common/index.js +1 -1
- package/dist/application-spec/parse-application-files/spec/common/value-type/format-value-type.d.ts +3 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/format-value-type.js +1 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/index.d.ts +5 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/index.js +1 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/intersect-value-types.d.ts +6 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/intersect-value-types.js +1 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/is-assignable-value-type.d.ts +8 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/is-assignable-value-type.js +1 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/value-type-at.d.ts +10 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/value-type-at.js +1 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/value-type.d.ts +98 -0
- package/dist/application-spec/parse-application-files/spec/common/value-type/value-type.js +1 -0
- package/dist/application-spec/parse-application-files/spec/components/bindings/component-path.d.ts +13 -0
- package/dist/application-spec/parse-application-files/spec/components/bindings/component-path.js +1 -0
- package/dist/application-spec/parse-application-files/spec/components/bindings/index.d.ts +2 -0
- package/dist/application-spec/parse-application-files/spec/components/bindings/index.js +1 -1
- package/dist/application-spec/parse-application-files/spec/components/bindings/read-binding-type.d.ts +24 -0
- package/dist/application-spec/parse-application-files/spec/components/bindings/read-binding-type.js +1 -0
- package/dist/application-spec/parse-application-files/spec/components/component-state-type.d.ts +8 -0
- package/dist/application-spec/parse-application-files/spec/components/component-state-type.js +1 -0
- package/dist/application-spec/parse-application-files/spec/components/filter-criterion-types.d.ts +13 -0
- package/dist/application-spec/parse-application-files/spec/components/filter-criterion-types.js +1 -0
- package/dist/application-spec/parse-application-files/spec/components/static-entity-id.d.ts +14 -0
- package/dist/application-spec/parse-application-files/spec/components/static-entity-id.js +1 -0
- package/dist/application-spec/parse-application-files/spec/components/user-component-entry.d.ts +6 -0
- package/dist/application-spec/parse-application-files/spec/components/user-component-entry.js +1 -1
- package/dist/application-spec/parse-application-files/spec/components/user-components.d.ts +7 -4
- package/dist/application-spec/parse-application-files/spec/components/user-components.js +1 -1
- package/dist/application-spec/parse-application-files/spec/expressions/expression-read-types.d.ts +24 -0
- package/dist/application-spec/parse-application-files/spec/expressions/expression-read-types.js +1 -0
- package/dist/application-spec/parse-application-files/spec/expressions/expression-read.d.ts +13 -0
- package/dist/application-spec/parse-application-files/spec/expressions/expression-read.js +1 -0
- package/dist/application-spec/parse-application-files/spec/expressions/expression-value-type.d.ts +9 -0
- package/dist/application-spec/parse-application-files/spec/expressions/expression-value-type.js +1 -0
- package/dist/application-spec/parse-application-files/spec/expressions/expressions.d.ts +6 -2
- package/dist/application-spec/parse-application-files/spec/expressions/expressions.js +1 -1
- package/dist/application-spec/parse-application-files/spec/expressions/user-expressions.d.ts +3 -1
- package/dist/application-spec/parse-application-files/spec/expressions/user-expressions.js +1 -1
- package/dist/application-spec/parse-application-files/spec/invariants/invariants.d.ts +2 -2
- package/dist/application-spec/parse-application-files/spec/invariants/invariants.js +1 -1
- package/dist/application-spec/parse-application-files/spec/model/index.d.ts +1 -0
- package/dist/application-spec/parse-application-files/spec/model/index.js +1 -1
- package/dist/application-spec/parse-application-files/spec/model/model-type-resolution.d.ts +10 -0
- package/dist/application-spec/parse-application-files/spec/model/model-type-resolution.js +1 -0
- package/dist/client/phoenix-api.d.ts +367 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +7 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/close-unclosed-braces.d.ts +12 -0
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/close-unclosed-braces.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
- package/dist/configurator/configuration-not-found-page/ConfigurationNotFoundPageElement.d.ts +12 -0
- package/dist/configurator/configuration-not-found-page/ConfigurationNotFoundPageElement.js +1 -0
- package/dist/configurator/configuration-not-found-page/index.d.ts +1 -0
- package/dist/configurator/configuration-not-found-page/index.js +1 -0
- package/dist/configurator/pages/ConfiguratorNotFoundPage.js +1 -1
- package/dist/configurator/pages/DefaultConfiguratorLayout.d.ts +3 -2
- package/dist/configurator/pages/LoadedConfiguratorDetailPage.js +1 -1
- package/dist/configurator/pages/RootPage.js +1 -1
- package/dist/configurator/pages/default-configurator-elements.d.ts +3 -1
- package/dist/configurator/pages/default-configurator-elements.js +1 -1
- package/dist/configurator/pages/default-elements/built-in-entity-element.d.ts +10 -0
- package/dist/configurator/pages/default-elements/built-in-entity-element.js +1 -0
- package/dist/configurator/pages/default-elements/built-in-layout-element.d.ts +10 -0
- package/dist/configurator/pages/default-elements/built-in-layout-element.js +1 -0
- package/dist/configurator/pages/default-elements/domain-control-elements.d.ts +6 -0
- package/dist/configurator/pages/default-elements/domain-control-elements.js +1 -0
- package/dist/configurator/pages/default-elements/index.d.ts +4 -0
- package/dist/configurator/pages/default-elements/index.js +1 -0
- package/dist/configurator/pages/default-elements/recipe-panel-elements.d.ts +3 -0
- package/dist/configurator/pages/default-elements/recipe-panel-elements.js +1 -0
- package/dist/configurator/pages/default-elements/sidebar-footer-elements.d.ts +7 -0
- package/dist/configurator/pages/default-elements/sidebar-footer-elements.js +1 -0
- package/dist/configurator/pages/default-elements/toolbar-elements.d.ts +7 -0
- package/dist/configurator/pages/default-elements/toolbar-elements.js +1 -0
- package/dist/configurator/ui/assistant/AssistantMarkdown.d.ts +7 -2
- package/dist/configurator/ui/assistant/AssistantMarkdown.js +1 -1
- package/dist/configurator/ui/assistant/AssistantPanel.js +1 -1
- package/dist/configurator/ui/assistant/AssistantThread.js +1 -1
- package/dist/configurator/ui/assistant/entity-link/AssistantEntityLink.d.ts +1 -1
- package/dist/configurator/ui/assistant/entity-link/AssistantEntityLink.js +1 -1
- package/dist/configurator/ui/assistant/entity-link/entity-link-state.d.ts +1 -1
- package/dist/configurator/ui/assistant/entity-link/index.d.ts +0 -1
- package/dist/configurator/ui/assistant/entity-link/index.js +1 -1
- package/dist/configurator/ui/assistant/form/AssistantForm.d.ts +19 -0
- package/dist/configurator/ui/assistant/form/AssistantForm.js +1 -0
- package/dist/configurator/ui/assistant/form/built-in-form-registry.d.ts +10 -0
- package/dist/configurator/ui/assistant/form/built-in-form-registry.js +1 -0
- package/dist/configurator/ui/assistant/form/compose-answer.d.ts +11 -0
- package/dist/configurator/ui/assistant/form/compose-answer.js +1 -0
- package/dist/configurator/ui/assistant/form/describe-build-errors.d.ts +6 -0
- package/dist/configurator/ui/assistant/form/describe-build-errors.js +1 -0
- package/dist/configurator/ui/assistant/form/form-element-definition.d.ts +14 -0
- package/dist/configurator/ui/assistant/form/form-element-definition.js +1 -0
- package/dist/configurator/ui/assistant/form/form-model.d.ts +38 -0
- package/dist/configurator/ui/assistant/form/form-model.js +1 -0
- package/dist/configurator/ui/assistant/form/form-registry.d.ts +31 -0
- package/dist/configurator/ui/assistant/form/form-registry.js +8 -0
- package/dist/configurator/ui/assistant/form/form-state.d.ts +4 -0
- package/dist/configurator/ui/assistant/form/form-state.js +1 -0
- package/dist/configurator/ui/assistant/form/index.d.ts +2 -0
- package/dist/configurator/ui/assistant/form/index.js +1 -0
- package/dist/configurator/ui/assistant/form/parse-form-block.d.ts +9 -0
- package/dist/configurator/ui/assistant/form/parse-form-block.js +1 -0
- package/dist/configurator/ui/assistant/form/read-form-attributes.d.ts +13 -0
- package/dist/configurator/ui/assistant/form/read-form-attributes.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormGroup.d.ts +3 -0
- package/dist/configurator/ui/assistant/form-elements/FormGroup.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormOptions.d.ts +3 -0
- package/dist/configurator/ui/assistant/form-elements/FormOptions.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormReply.d.ts +3 -0
- package/dist/configurator/ui/assistant/form-elements/FormReply.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormText.d.ts +3 -0
- package/dist/configurator/ui/assistant/form-elements/FormText.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/form-element-props.d.ts +34 -0
- package/dist/configurator/ui/assistant/form-elements/form-element-props.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/index.d.ts +5 -0
- package/dist/configurator/ui/assistant/form-elements/index.js +1 -0
- package/dist/configurator/ui/assistant/reference-link/AssistantReferenceLink.d.ts +16 -0
- package/dist/configurator/ui/assistant/reference-link/AssistantReferenceLink.js +1 -0
- package/dist/configurator/ui/assistant/reference-link/assistant-link-target.d.ts +34 -0
- package/dist/configurator/ui/assistant/reference-link/assistant-link-target.js +1 -0
- package/dist/configurator/ui/assistant/reference-link/assistant-reference-details.d.ts +25 -0
- package/dist/configurator/ui/assistant/reference-link/assistant-reference-details.js +1 -0
- package/dist/configurator/ui/assistant/reference-link/index.d.ts +3 -0
- package/dist/configurator/ui/assistant/reference-link/index.js +1 -0
- package/dist/configurator/ui/assistant/reference-link/reference-styles.d.ts +12 -0
- package/dist/configurator/ui/assistant/reference-link/reference-styles.js +1 -0
- package/dist/configurator/ui/assistant/reference-link/use-assistant-reference-details.d.ts +8 -0
- package/dist/configurator/ui/assistant/reference-link/use-assistant-reference-details.js +1 -0
- package/dist/configurator/ui/assistant/resource-image/AssistantImage.d.ts +9 -0
- package/dist/configurator/ui/assistant/resource-image/AssistantImage.js +1 -0
- package/dist/configurator/ui/assistant/resource-image/index.d.ts +3 -0
- package/dist/configurator/ui/assistant/resource-image/index.js +1 -0
- package/dist/configurator/ui/assistant/resource-image/resource-path.d.ts +11 -0
- package/dist/configurator/ui/assistant/resource-image/resource-path.js +1 -0
- package/dist/configurator/ui/assistant/resource-image/use-resource-image-url.d.ts +5 -0
- package/dist/configurator/ui/assistant/resource-image/use-resource-image-url.js +1 -0
- package/dist/configurator/ui/assistant/streamed-markdown.d.ts +2 -0
- package/dist/configurator/ui/assistant/streamed-markdown.js +2 -2
- package/dist/configurator/ui/assistant/thread-items.d.ts +8 -1
- package/dist/configurator/ui/assistant/thread-items.js +1 -1
- package/dist/configurator/ui/assistant/use-follow-stream.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/services/InvariantViolations.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/services/Services.js +1 -1
- package/dist/configurator/ui/legacy/layout/common/SummaryReadLayout.js +1 -1
- package/dist/configurator/ui/legacy/layout/simple/SimpleOwnerLayout.js +1 -1
- package/dist/configurator/ui/legacy/layout/steps/StepsOwnerLayout.js +1 -1
- package/dist/configurator/ui/legacy/layout/tabs/TabsOwnerLayout.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/LayoutCustomOwnerUi.d.ts +1 -0
- package/dist/configurator/ui/phoenix-layout-elements/LayoutCustomOwnerUi.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/LayoutCustomReadUi.d.ts +1 -0
- package/dist/configurator/ui/phoenix-layout-elements/LayoutCustomReadUi.js +1 -1
- package/dist/configurator/ui/preset-layout/CategoryPresetUi.js +1 -1
- package/dist/configurator/ui/save-message-snackbars/SaveMessageSnackbars.d.ts +10 -0
- package/dist/configurator/ui/save-message-snackbars/SaveMessageSnackbars.js +1 -0
- package/dist/configurator/ui/save-message-snackbars/index.d.ts +1 -0
- package/dist/configurator/ui/save-message-snackbars/index.js +1 -0
- package/dist/docs/controls/select-child-entity/cardselect.mdx +1 -0
- package/dist/docs/fabs/basic.mdx +2 -2
- package/dist/docs/index.json +1 -1
- package/dist/docs/layouts/custom-layout.mdx +324 -15
- package/dist/docs/other-features/not-found-404.mdx +1 -1
- package/dist/docs/phoenix/clerk-sign-in.mdx +1 -1
- package/dist/docs/phoenix/components.mdx +6 -0
- package/dist/docs/phoenix/configurator-interface.mdx +35 -11
- package/dist/docs/phoenix/domain-model.mdx +2 -0
- package/dist/docs/phoenix/getting-started.mdx +5 -3
- package/dist/docs/phoenix/layout-slots.mdx +9 -9
- package/dist/docs/phoenix/localization.mdx +6 -2
- package/dist/docs/phoenix/migration-guide.mdx +12 -10
- package/dist/docs/phoenix/phoenix-cli.mdx +31 -16
- package/dist/docs/phoenix/project-structure.mdx +52 -30
- package/dist/docs/phoenix/quickstart.mdx +7 -7
- package/dist/docs/phoenix/sdk-builder-workflow.mdx +6 -6
- package/dist/docs/phoenix/testing.mdx +8 -0
- package/dist/domain/application/assistant/assistant-form-elements.d.ts +28 -0
- package/dist/domain/application/assistant/assistant-form-elements.js +1 -0
- package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
- package/dist/domain/application/assistant/index.d.ts +2 -0
- package/dist/domain/application/assistant/index.js +1 -1
- package/dist/domain/application/assistant-recipe-groups.d.ts +3 -1
- package/dist/domain/core/schema/extended-schema-validator.js +1 -1
- package/dist/domain/domain-runtime/spec/module-checks/element-registration.d.ts +12 -11
- package/dist/domain/domain-runtime/spec/module-checks/element-registration.js +1 -1
- package/dist/domain/domain-runtime/spec/module-checks/index.d.ts +1 -1
- package/dist/domain/domain-runtime/spec/module-checks/index.js +1 -1
- package/dist/domain/domain-runtime/spec/selectors.js +1 -1
- package/dist/domain/system-components/child-entity-selection.js +1 -1
- package/dist/domain/system-components/common/scene-entity-control-schema.d.ts +3 -0
- package/dist/domain/system-components/common/scene-entity-control-schema.js +1 -1
- package/dist/editor/mocks/CreateMockYaml.js +2 -2
- package/dist/i18n/locales/cs/messages.js +1 -1
- package/dist/i18n/locales/da/messages.js +1 -1
- package/dist/i18n/locales/de/messages.js +1 -1
- package/dist/i18n/locales/de-AT/messages.js +1 -1
- package/dist/i18n/locales/en/messages.js +1 -1
- package/dist/i18n/locales/en-AU/messages.js +1 -1
- package/dist/i18n/locales/en-GB/messages.js +1 -1
- package/dist/i18n/locales/es/messages.js +1 -1
- package/dist/i18n/locales/fr/messages.js +1 -1
- package/dist/i18n/locales/hu/messages.js +1 -1
- package/dist/i18n/locales/it/messages.js +1 -1
- package/dist/i18n/locales/nl/messages.js +1 -1
- package/dist/i18n/locales/pl/messages.js +1 -1
- package/dist/i18n/locales/pt/messages.js +1 -1
- package/dist/i18n/locales/ro/messages.js +1 -1
- package/dist/i18n/locales/sk/messages.js +1 -1
- package/dist/i18n/locales/tr/messages.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/domain-spec/__generated/domain-schema.d.ts +79 -80
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-admin.js +10 -11
- package/dist/legacy/phoenix-cli/project-gen/generators/file-templates/frontend-embedded-admin.js +9 -10
- package/dist/phoenix/application-spec/application-spec-builder.d.ts +0 -2
- package/dist/phoenix/application-spec/application-spec-builder.js +1 -1
- package/dist/phoenix/application-spec/generate-application-spec-project.d.ts +0 -2
- package/dist/phoenix/application-spec/generate-application-spec-project.js +2 -2
- package/dist/phoenix/application-spec/generate-application-spec-story.js +2 -2
- package/dist/phoenix/application-spec/generate-project-files.d.ts +0 -2
- package/dist/phoenix/application-spec/project-files.js +1 -1
- package/dist/phoenix/bin.d.ts +2 -0
- package/dist/phoenix/bin.js +2 -0
- package/dist/phoenix/check-configs/built-in-eslint-config.d.ts +9 -0
- package/dist/phoenix/check-configs/built-in-eslint-config.js +1 -0
- package/dist/phoenix/check-configs/eslint-config.d.ts +10 -0
- package/dist/phoenix/check-configs/eslint-config.js +1 -0
- package/dist/phoenix/check-configs/index.d.ts +8 -0
- package/dist/phoenix/check-configs/index.js +1 -0
- package/dist/phoenix/check-configs/typescript-project.d.ts +5 -0
- package/dist/phoenix/check-configs/typescript-project.js +1 -0
- package/dist/phoenix/cli.d.ts +0 -1
- package/dist/phoenix/cli.js +1 -2
- package/dist/phoenix/commands/build.js +1 -1
- package/dist/phoenix/commands/check.js +1 -1
- package/dist/phoenix/commands/clean.js +1 -1
- package/dist/phoenix/commands/deploy.js +2 -2
- package/dist/phoenix/commands/deps/deps.d.ts +22 -1
- package/dist/phoenix/commands/deps/deps.js +2 -2
- package/dist/phoenix/commands/deps/index.d.ts +1 -1
- package/dist/phoenix/commands/deps/index.js +1 -1
- package/dist/phoenix/commands/deps/sdk-manifest.js +1 -1
- package/dist/phoenix/commands/dev.js +4 -4
- package/dist/phoenix/commands/fix.js +1 -1
- package/dist/phoenix/commands/init.d.ts +17 -5
- package/dist/phoenix/commands/init.js +1 -1
- package/dist/phoenix/commands/link.js +1 -1
- package/dist/phoenix/commands/prettier.js +1 -1
- package/dist/phoenix/commands/sync.js +1 -1
- package/dist/phoenix/commands/unlink.js +1 -1
- package/dist/phoenix/services/application-spec-project-watcher.d.ts +0 -2
- package/dist/phoenix/services/application-spec-project-watcher.js +2 -2
- package/dist/phoenix/services/lingui.d.ts +8 -0
- package/dist/phoenix/services/lingui.js +1 -1
- package/dist/phoenix/services/swc.js +1 -1
- package/dist/phoenix/services/vite-config.js +1 -1
- package/dist/phoenix/utils/index.d.ts +3 -2
- package/dist/phoenix/utils/index.js +1 -1
- package/dist/phoenix/utils/node-version/index.d.ts +1 -0
- package/dist/phoenix/utils/node-version/index.js +1 -0
- package/dist/phoenix/utils/node-version/supported-node-version.d.ts +12 -0
- package/dist/phoenix/utils/node-version/supported-node-version.js +4 -0
- package/dist/phoenix/utils/package-info.d.ts +0 -9
- package/dist/phoenix/utils/package-info.js +1 -1
- package/dist/phoenix/utils/package-manager/index.d.ts +2 -0
- package/dist/phoenix/utils/package-manager/index.js +1 -0
- package/dist/phoenix/utils/package-manager/package-manager-commands.d.ts +19 -0
- package/dist/phoenix/utils/package-manager/package-manager-commands.js +1 -0
- package/dist/phoenix/utils/package-manager/pnpm-project.d.ts +9 -0
- package/dist/phoenix/utils/package-manager/pnpm-project.js +1 -0
- package/dist/phoenix/utils/run-command.d.ts +11 -0
- package/dist/phoenix/utils/run-command.js +1 -1
- package/dist/phoenix/utils/sdk-tool/index.d.ts +1 -0
- package/dist/phoenix/utils/sdk-tool/index.js +1 -0
- package/dist/phoenix/utils/sdk-tool/resolve-sdk-tool-bin.d.ts +15 -0
- package/dist/phoenix/utils/sdk-tool/resolve-sdk-tool-bin.js +1 -0
- package/dist/react-sdk/domain-application-context/DomainLifecycleBoundary.js +1 -1
- package/dist/react-sdk/domain-context/common-hooks/use-configurator-messages.d.ts +15 -4
- package/dist/react-sdk/domain-context/common-hooks/use-configurator-messages.js +1 -1
- package/dist/ui-sdk/theme/types.d.ts +1 -1
- package/package.json +16 -9
- package/schema/domain-spec.json +86 -8
- package/dist/application-spec/generate-application/code/templates/nvmrc.d.ts +0 -1
- package/dist/application-spec/generate-application/code/templates/nvmrc.js +0 -2
- package/dist/application-spec/generate-application/code/templates/package-json.d.ts +0 -10
- package/dist/application-spec/generate-application/code/templates/package-json.js +0 -1
- package/dist/configurator/ui/assistant/entity-link/entity-link-target.d.ts +0 -5
- package/dist/configurator/ui/assistant/entity-link/entity-link-target.js +0 -1
- package/dist/phoenix/commands/generate-project-files.d.ts +0 -6
- package/dist/phoenix/commands/generate-project-files.js +0 -1
package/dist/application-spec/parse-application-files/spec/expressions/user-expressions.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type EvalExpressionParser, type ParseContext } from '../../../core/index.js';
|
|
2
2
|
import type { MergedExpressions } from '../../merge/index.js';
|
|
3
|
-
import type { ModelVersion } from '../model/index.js';
|
|
3
|
+
import type { ModelTypeResolution, ModelVersion } from '../model/index.js';
|
|
4
4
|
import type { Expression } from './expression.js';
|
|
5
5
|
/**
|
|
6
6
|
* Validates user-declared expressions from merged YAML.
|
|
@@ -15,6 +15,8 @@ import type { Expression } from './expression.js';
|
|
|
15
15
|
interface UserExpressionsContext {
|
|
16
16
|
readonly latestModel: ModelVersion;
|
|
17
17
|
readonly evalExpressionParser: EvalExpressionParser;
|
|
18
|
+
/** Resolves the refs of the declared schemas, for checking an inline value against its schema. */
|
|
19
|
+
readonly typeResolution: ModelTypeResolution;
|
|
18
20
|
readonly parsingContext: ParseContext;
|
|
19
21
|
}
|
|
20
22
|
export declare const UserExpressions: (rawExpressions: MergedExpressions, context: UserExpressionsContext) => readonly Expression[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Branded as e}from"@salsita-ai/common/utils";import{schemaFromValue as
|
|
1
|
+
import{Branded as e}from"@salsita-ai/common/utils";import{schemaFromValue as r}from"../../../enhanced-json/index.js";import{DiagnosticCode as t,diagnosticMessages as o}from"../../../errors/index.js";import{ValueType as s,formatValueType as m,isAssignableValueType as a}from"../common/index.js";import{ExpressionName as n}from"../model/index.js";import{expressionValueType as i}from"./expression-value-type.js";import{MemoEvalPlan as l}from"./memo-eval-plan.js";let c=(e,n,c,p,E)=>{if("user"===e.kind)return{schema:e.schema,implementation:{kind:"user"}};let h=l(e.value,n),u={kind:"value",constant:e.constant,value:e.value,plan:h};if(Object.keys(e.schema).length>0){var f,d;let r,l;return f=e.value,d=e.schema,r=i(f,E),a(r,l=s(d,{...E,author:"project"}))||c.error(t.EXPRESSION_VALUE_TYPE_MISMATCH,o.EXPRESSION_VALUE_TYPE_MISMATCH(n,m(r),m(l))),{schema:e.schema,implementation:u}}let N=r(e.value,c,p);if(void 0!==N)return{schema:N,implementation:u}};export const UserExpressions=(r,s)=>{let{latestModel:m,evalExpressionParser:a,typeResolution:i,parsingContext:l}=s,{allNames:p}=m,E=[...p].map(String),h=[];for(let[s,m]of Object.entries(r)){p.has(s)||l.error(t.EXPRESSION_UNKNOWN_ENTITY_KEY,o.EXPRESSION_UNKNOWN_ENTITY_KEY(s,E));let r=e(s);for(let[t,o]of Object.entries(m)){let m=l.at(s),p=n(t,m);if(!p)continue;let E=c(o,`${s}.${t}`,m.at(t),a,i);E&&h.push(e({entityKey:r,name:p,schema:E.schema,declaredSchema:E.schema,implementation:E.implementation}))}}if(!l.hasErrors)return h};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Branded } from '@salsita-ai/common/utils';
|
|
2
|
-
import type { ParseContext } from '../../../core/index.js';
|
|
2
|
+
import type { ParseContext, PhoenixDefinitions } from '../../../core/index.js';
|
|
3
3
|
import type { MergedComponents, MergedExpressions, MergedInvariants, MergedRelations } from '../../merge/index.js';
|
|
4
4
|
import type { ComponentEntry } from '../components/index.js';
|
|
5
5
|
import type { Expression } from '../expressions/index.js';
|
|
@@ -22,5 +22,5 @@ interface InvariantsProps {
|
|
|
22
22
|
}
|
|
23
23
|
/** Explicit empty invariants aggregate for consumers that do not declare invariants. */
|
|
24
24
|
export declare const EmptyInvariants: () => Invariants;
|
|
25
|
-
export declare const Invariants: (props: InvariantsProps, latestModel: ModelVersion, ctx: ParseContext) => Invariants;
|
|
25
|
+
export declare const Invariants: (props: InvariantsProps, latestModel: ModelVersion, phxDefinitions: PhoenixDefinitions, ctx: ParseContext) => Invariants;
|
|
26
26
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Branded as e}from"@salsita-ai/common/utils";import{DiagnosticCode as t,diagnosticMessages as o}from"../../../errors/index.js";import{UserComponentEntry as r}from"../components/index.js";import{ExpressionName as n,InstanceName as i,getResolvedShape as
|
|
1
|
+
import{Branded as e}from"@salsita-ai/common/utils";import{DiagnosticCode as t,diagnosticMessages as o}from"../../../errors/index.js";import{UserComponentEntry as r}from"../components/index.js";import{ExpressionName as n,InstanceName as i,ModelTypeResolution as a,getResolvedShape as s}from"../model/index.js";import{Invariant as l}from"./invariant.js";let p="violations",N="$violations",m=(e,t)=>t.get(e)??[e],O=e=>"dynamic"===e.kind?e.violationTypes:[e.violationType],I=(t,o,r)=>{if(!r)return;let n=[...o.violationTypes].map(e=>`'${String(e)}'`).join(" | "),i={tsType:`ReadonlyArray<Violation<${n}>>`,import:[{module:"@salsita-ai/sdk/domain",member:"Violation"}]};return e({entityKey:t,name:r,schema:i,declaredSchema:i,implementation:{kind:"violations",params:[{entityType:String(t),invariants:o.declaredGroups}]}})},f=(e,t,o,n)=>{let l=i("default",String(e),p,n);if(l)return r({typeOrAlias:e,instanceName:l,componentName:p,rawProps:{violations:{$read:N}}},{resolvedShape:s(t.resolvedShapes,e),parsingContext:n,typeResolution:a(t,o)}).entry};export const EmptyInvariants=()=>e({entries:{},expressions:[],components:[]});export const Invariants=(r,i,a,s)=>{let{rawInvariants:T,rawExpressions:d,rawRelations:A,rawComponents:c}=r,{allNames:y,aliases:S}=i,_=[...y].map(String),u={},v=new Map;for(let[e,r]of Object.entries(T)){let n=s.at(e);if(!y.has(e)){n.error(t.INVARIANT_UNKNOWN_ENTITY_KEY,o.INVARIANT_UNKNOWN_ENTITY_KEY(e,_));continue}let i={};for(let[e,t]of Object.entries(r)){let o=l(e,t,n.at(e));o&&(i[String(o.name)]=o)}u[String(e)]=i;let a=Object.values(i);if(0!==a.length)for(let t of m(e,S)){let o=v.get(t);for(let r of(o||(o={violationTypes:new Set,declaredGroups:[]},v.set(t,o)),o.declaredGroups.push({typeOrAlias:e,invariants:a}),a))for(let e of O(r))o.violationTypes.add(e)}}let g=[],h=[],j=n(N,s);for(let[e,t]of v){let o=I(e,t,j),r=f(e,i,a,s);o&&g.push(o),r&&h.push(r)}for(let[e,r]of Object.entries(c))Object.hasOwn(r,p)&&s.at("components",e,p).error(t.INVARIANT_MANUAL_VIOLATIONS_COMPONENT,o.INVARIANT_MANUAL_VIOLATIONS_COMPONENT(e));return((e,r)=>{let{invariantEntityTypes:n,rawExpressions:i,rawRelations:a,aliases:s}=e,l=e=>{let t=s.get(e);return t?t.some(e=>n.has(String(e))):n.has(e)},p=(e,n)=>{for(let[i,a]of Object.entries(e))Object.hasOwn(a,N)&&l(i)&&r.at(n,i,N).error(t.INVARIANT_VIOLATIONS_EXPRESSION_CONFLICT,o.INVARIANT_VIOLATIONS_EXPRESSION_CONFLICT(i,n))};p(i,"expressions"),p(a,"relations")})({invariantEntityTypes:new Set([...v.keys()].map(String)),rawExpressions:d,rawRelations:A,aliases:S},s),e({entries:u,expressions:g,components:h})};
|
|
@@ -8,6 +8,7 @@ export * from './entity-schema.js';
|
|
|
8
8
|
export * from './entity-types.js';
|
|
9
9
|
export * from './model-version.js';
|
|
10
10
|
export * from './model-version-key.js';
|
|
11
|
+
export * from './model-type-resolution.js';
|
|
11
12
|
export * from './names/index.js';
|
|
12
13
|
export * from './presets.js';
|
|
13
14
|
export * from './resolved-shapes.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./aliases.js";export*from"./all-names.js";export*from"./common-types.js";export*from"./configuration-schema.js";export*from"./data-schemas.js";export*from"./defaults.js";export*from"./entity-schema.js";export*from"./entity-types.js";export*from"./model-version.js";export*from"./model-version-key.js";export*from"./names/index.js";export*from"./presets.js";export*from"./resolved-shapes.js";export*from"./session-data-schema.js";export*from"./shapes/index.js";
|
|
1
|
+
export*from"./aliases.js";export*from"./all-names.js";export*from"./common-types.js";export*from"./configuration-schema.js";export*from"./data-schemas.js";export*from"./defaults.js";export*from"./entity-schema.js";export*from"./entity-types.js";export*from"./model-version.js";export*from"./model-version-key.js";export*from"./model-type-resolution.js";export*from"./names/index.js";export*from"./presets.js";export*from"./resolved-shapes.js";export*from"./session-data-schema.js";export*from"./shapes/index.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PhoenixDefinitions } from '../../../core/index.js';
|
|
2
|
+
import { type ValueTypeResolution } from '../common/index.js';
|
|
3
|
+
import type { ModelVersion } from './model-version.js';
|
|
4
|
+
/** What reading the type of a schema of the model needs: its refs and its entity names. */
|
|
5
|
+
export type ModelTypeResolution = Omit<ValueTypeResolution, 'author' | 'definitions'>;
|
|
6
|
+
/**
|
|
7
|
+
* Resolves the refs of a model's schemas (its common types and the phoenix definitions) and the
|
|
8
|
+
* entity types an entity type or alias name stands for.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ModelTypeResolution: (model: ModelVersion, phxDefinitions: PhoenixDefinitions) => ModelTypeResolution;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createSchemaRefResolver as e}from"../common/index.js";export const ModelTypeResolution=(o,r)=>({resolveRef:e(o.commonTypes,r),entityTypes:e=>{for(let[r,t]of o.aliases)if(String(r)===e)return t.map(String);return[e]}});
|
|
@@ -55,6 +55,38 @@ export interface paths {
|
|
|
55
55
|
readonly patch?: never
|
|
56
56
|
readonly trace?: never
|
|
57
57
|
}
|
|
58
|
+
readonly '/auth/callback': {
|
|
59
|
+
readonly parameters: {
|
|
60
|
+
readonly query?: never
|
|
61
|
+
readonly header?: never
|
|
62
|
+
readonly path?: never
|
|
63
|
+
readonly cookie?: never
|
|
64
|
+
}
|
|
65
|
+
readonly get: operations['completeBrowserLogin']
|
|
66
|
+
readonly put?: never
|
|
67
|
+
readonly post?: never
|
|
68
|
+
readonly delete?: never
|
|
69
|
+
readonly options?: never
|
|
70
|
+
readonly head?: never
|
|
71
|
+
readonly patch?: never
|
|
72
|
+
readonly trace?: never
|
|
73
|
+
}
|
|
74
|
+
readonly '/auth/config': {
|
|
75
|
+
readonly parameters: {
|
|
76
|
+
readonly query?: never
|
|
77
|
+
readonly header?: never
|
|
78
|
+
readonly path?: never
|
|
79
|
+
readonly cookie?: never
|
|
80
|
+
}
|
|
81
|
+
readonly get: operations['getBrowserAuthConfig']
|
|
82
|
+
readonly put?: never
|
|
83
|
+
readonly post?: never
|
|
84
|
+
readonly delete?: never
|
|
85
|
+
readonly options?: never
|
|
86
|
+
readonly head?: never
|
|
87
|
+
readonly patch?: never
|
|
88
|
+
readonly trace?: never
|
|
89
|
+
}
|
|
58
90
|
readonly '/auth/identity': {
|
|
59
91
|
readonly parameters: {
|
|
60
92
|
readonly query?: never
|
|
@@ -72,6 +104,39 @@ export interface paths {
|
|
|
72
104
|
readonly patch?: never
|
|
73
105
|
readonly trace?: never
|
|
74
106
|
}
|
|
107
|
+
readonly '/auth/login': {
|
|
108
|
+
readonly parameters: {
|
|
109
|
+
readonly query?: never
|
|
110
|
+
readonly header?: never
|
|
111
|
+
readonly path?: never
|
|
112
|
+
readonly cookie?: never
|
|
113
|
+
}
|
|
114
|
+
readonly get: operations['startBrowserLogin']
|
|
115
|
+
readonly put?: never
|
|
116
|
+
readonly post?: never
|
|
117
|
+
readonly delete?: never
|
|
118
|
+
readonly options?: never
|
|
119
|
+
readonly head?: never
|
|
120
|
+
readonly patch?: never
|
|
121
|
+
readonly trace?: never
|
|
122
|
+
}
|
|
123
|
+
readonly '/auth/logout': {
|
|
124
|
+
readonly parameters: {
|
|
125
|
+
readonly query?: never
|
|
126
|
+
readonly header?: never
|
|
127
|
+
readonly path?: never
|
|
128
|
+
readonly cookie?: never
|
|
129
|
+
}
|
|
130
|
+
readonly get?: never
|
|
131
|
+
readonly put?: never
|
|
132
|
+
/** @description Destroy the local session and return the fixed Cognito hosted logout URL. Requires the exact shared Studio Origin. */
|
|
133
|
+
readonly post: operations['endBrowserSession']
|
|
134
|
+
readonly delete?: never
|
|
135
|
+
readonly options?: never
|
|
136
|
+
readonly head?: never
|
|
137
|
+
readonly patch?: never
|
|
138
|
+
readonly trace?: never
|
|
139
|
+
}
|
|
75
140
|
readonly '/auth/me': {
|
|
76
141
|
readonly parameters: {
|
|
77
142
|
readonly query?: never
|
|
@@ -89,6 +154,23 @@ export interface paths {
|
|
|
89
154
|
readonly patch?: never
|
|
90
155
|
readonly trace?: never
|
|
91
156
|
}
|
|
157
|
+
readonly '/auth/session': {
|
|
158
|
+
readonly parameters: {
|
|
159
|
+
readonly query?: never
|
|
160
|
+
readonly header?: never
|
|
161
|
+
readonly path?: never
|
|
162
|
+
readonly cookie?: never
|
|
163
|
+
}
|
|
164
|
+
/** @description Read the opaque browser session and current account status/memberships. Requires the exact shared Studio Origin. */
|
|
165
|
+
readonly get: operations['getBrowserSession']
|
|
166
|
+
readonly put?: never
|
|
167
|
+
readonly post?: never
|
|
168
|
+
readonly delete?: never
|
|
169
|
+
readonly options?: never
|
|
170
|
+
readonly head?: never
|
|
171
|
+
readonly patch?: never
|
|
172
|
+
readonly trace?: never
|
|
173
|
+
}
|
|
92
174
|
readonly '/auth/token': {
|
|
93
175
|
readonly parameters: {
|
|
94
176
|
readonly query?: never
|
|
@@ -1620,6 +1702,114 @@ export interface operations {
|
|
|
1620
1702
|
}
|
|
1621
1703
|
}
|
|
1622
1704
|
}
|
|
1705
|
+
readonly completeBrowserLogin: {
|
|
1706
|
+
readonly parameters: {
|
|
1707
|
+
readonly query: {
|
|
1708
|
+
readonly code: string
|
|
1709
|
+
readonly state: string
|
|
1710
|
+
}
|
|
1711
|
+
readonly header?: never
|
|
1712
|
+
readonly path?: never
|
|
1713
|
+
readonly cookie?: never
|
|
1714
|
+
}
|
|
1715
|
+
readonly requestBody?: never
|
|
1716
|
+
readonly responses: {
|
|
1717
|
+
/** @description Redirect to the configured sign-in or Studio destination. */
|
|
1718
|
+
readonly 302: {
|
|
1719
|
+
headers: {
|
|
1720
|
+
readonly [name: string]: unknown
|
|
1721
|
+
}
|
|
1722
|
+
content: {
|
|
1723
|
+
readonly 'application/json': Record<string, unknown>
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
/** @description Bad Request! */
|
|
1727
|
+
readonly 400: {
|
|
1728
|
+
headers: {
|
|
1729
|
+
readonly [name: string]: unknown
|
|
1730
|
+
}
|
|
1731
|
+
content: {
|
|
1732
|
+
readonly 'application/json': components['schemas']['BadRequestError']
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
/** @description Unauthorized! */
|
|
1736
|
+
readonly 401: {
|
|
1737
|
+
headers: {
|
|
1738
|
+
readonly [name: string]: unknown
|
|
1739
|
+
}
|
|
1740
|
+
content: {
|
|
1741
|
+
readonly 'application/json': components['schemas']['UnauthorizedError']
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
/** @description Forbidden! */
|
|
1745
|
+
readonly 403: {
|
|
1746
|
+
headers: {
|
|
1747
|
+
readonly [name: string]: unknown
|
|
1748
|
+
}
|
|
1749
|
+
content: {
|
|
1750
|
+
readonly 'application/json': components['schemas']['ForbiddenError']
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
/** @description Not Found! */
|
|
1754
|
+
readonly 404: {
|
|
1755
|
+
headers: {
|
|
1756
|
+
readonly [name: string]: unknown
|
|
1757
|
+
}
|
|
1758
|
+
content: {
|
|
1759
|
+
readonly 'application/json': components['schemas']['NotFoundError']
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
/** @description Service Unavailable! */
|
|
1763
|
+
readonly 503: {
|
|
1764
|
+
headers: {
|
|
1765
|
+
readonly [name: string]: unknown
|
|
1766
|
+
}
|
|
1767
|
+
content: {
|
|
1768
|
+
readonly 'application/json': components['schemas']['ServiceUnavailableError']
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
/** @description An unexpected error occurred! */
|
|
1772
|
+
readonly default: {
|
|
1773
|
+
headers: {
|
|
1774
|
+
readonly [name: string]: unknown
|
|
1775
|
+
}
|
|
1776
|
+
content: {
|
|
1777
|
+
readonly 'application/json': components['schemas']['DefaultResponse']
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
readonly getBrowserAuthConfig: {
|
|
1783
|
+
readonly parameters: {
|
|
1784
|
+
readonly query?: never
|
|
1785
|
+
readonly header?: never
|
|
1786
|
+
readonly path?: never
|
|
1787
|
+
readonly cookie?: never
|
|
1788
|
+
}
|
|
1789
|
+
readonly requestBody?: never
|
|
1790
|
+
readonly responses: {
|
|
1791
|
+
/** @description Shared Studio origin when browser sign-in is configured; null otherwise. */
|
|
1792
|
+
readonly 200: {
|
|
1793
|
+
headers: {
|
|
1794
|
+
readonly [name: string]: unknown
|
|
1795
|
+
}
|
|
1796
|
+
content: {
|
|
1797
|
+
readonly 'application/json': {
|
|
1798
|
+
readonly studioOrigin: string | null
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
/** @description An unexpected error occurred! */
|
|
1803
|
+
readonly default: {
|
|
1804
|
+
headers: {
|
|
1805
|
+
readonly [name: string]: unknown
|
|
1806
|
+
}
|
|
1807
|
+
content: {
|
|
1808
|
+
readonly 'application/json': components['schemas']['DefaultResponse']
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1623
1813
|
readonly resolveIdentity: {
|
|
1624
1814
|
readonly parameters: {
|
|
1625
1815
|
readonly query?: never
|
|
@@ -1699,6 +1889,112 @@ export interface operations {
|
|
|
1699
1889
|
}
|
|
1700
1890
|
}
|
|
1701
1891
|
}
|
|
1892
|
+
readonly startBrowserLogin: {
|
|
1893
|
+
readonly parameters: {
|
|
1894
|
+
readonly query?: never
|
|
1895
|
+
readonly header?: never
|
|
1896
|
+
readonly path?: never
|
|
1897
|
+
readonly cookie?: never
|
|
1898
|
+
}
|
|
1899
|
+
readonly requestBody?: never
|
|
1900
|
+
readonly responses: {
|
|
1901
|
+
/** @description Redirect to the configured sign-in or Studio destination. */
|
|
1902
|
+
readonly 302: {
|
|
1903
|
+
headers: {
|
|
1904
|
+
readonly [name: string]: unknown
|
|
1905
|
+
}
|
|
1906
|
+
content: {
|
|
1907
|
+
readonly 'application/json': Record<string, unknown>
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
/** @description Bad Request! */
|
|
1911
|
+
readonly 400: {
|
|
1912
|
+
headers: {
|
|
1913
|
+
readonly [name: string]: unknown
|
|
1914
|
+
}
|
|
1915
|
+
content: {
|
|
1916
|
+
readonly 'application/json': components['schemas']['BadRequestError']
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
/** @description Not Found! */
|
|
1920
|
+
readonly 404: {
|
|
1921
|
+
headers: {
|
|
1922
|
+
readonly [name: string]: unknown
|
|
1923
|
+
}
|
|
1924
|
+
content: {
|
|
1925
|
+
readonly 'application/json': components['schemas']['NotFoundError']
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
/** @description An unexpected error occurred! */
|
|
1929
|
+
readonly default: {
|
|
1930
|
+
headers: {
|
|
1931
|
+
readonly [name: string]: unknown
|
|
1932
|
+
}
|
|
1933
|
+
content: {
|
|
1934
|
+
readonly 'application/json': components['schemas']['DefaultResponse']
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
readonly endBrowserSession: {
|
|
1940
|
+
readonly parameters: {
|
|
1941
|
+
readonly query?: never
|
|
1942
|
+
readonly header?: never
|
|
1943
|
+
readonly path?: never
|
|
1944
|
+
readonly cookie?: never
|
|
1945
|
+
}
|
|
1946
|
+
readonly requestBody?: never
|
|
1947
|
+
readonly responses: {
|
|
1948
|
+
/** @description Navigate to this URL to finish hosted logout. */
|
|
1949
|
+
readonly 200: {
|
|
1950
|
+
headers: {
|
|
1951
|
+
readonly [name: string]: unknown
|
|
1952
|
+
}
|
|
1953
|
+
content: {
|
|
1954
|
+
readonly 'application/json': {
|
|
1955
|
+
/** Format: uri */
|
|
1956
|
+
readonly logoutUrl: string
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
/** @description Bad Request! */
|
|
1961
|
+
readonly 400: {
|
|
1962
|
+
headers: {
|
|
1963
|
+
readonly [name: string]: unknown
|
|
1964
|
+
}
|
|
1965
|
+
content: {
|
|
1966
|
+
readonly 'application/json': components['schemas']['BadRequestError']
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
/** @description Forbidden! */
|
|
1970
|
+
readonly 403: {
|
|
1971
|
+
headers: {
|
|
1972
|
+
readonly [name: string]: unknown
|
|
1973
|
+
}
|
|
1974
|
+
content: {
|
|
1975
|
+
readonly 'application/json': components['schemas']['ForbiddenError']
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
/** @description Not Found! */
|
|
1979
|
+
readonly 404: {
|
|
1980
|
+
headers: {
|
|
1981
|
+
readonly [name: string]: unknown
|
|
1982
|
+
}
|
|
1983
|
+
content: {
|
|
1984
|
+
readonly 'application/json': components['schemas']['NotFoundError']
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
/** @description An unexpected error occurred! */
|
|
1988
|
+
readonly default: {
|
|
1989
|
+
headers: {
|
|
1990
|
+
readonly [name: string]: unknown
|
|
1991
|
+
}
|
|
1992
|
+
content: {
|
|
1993
|
+
readonly 'application/json': components['schemas']['DefaultResponse']
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1702
1998
|
readonly getApiSession: {
|
|
1703
1999
|
readonly parameters: {
|
|
1704
2000
|
readonly query?: never
|
|
@@ -1748,6 +2044,77 @@ export interface operations {
|
|
|
1748
2044
|
}
|
|
1749
2045
|
}
|
|
1750
2046
|
}
|
|
2047
|
+
readonly getBrowserSession: {
|
|
2048
|
+
readonly parameters: {
|
|
2049
|
+
readonly query?: never
|
|
2050
|
+
readonly header?: never
|
|
2051
|
+
readonly path?: never
|
|
2052
|
+
readonly cookie?: never
|
|
2053
|
+
}
|
|
2054
|
+
readonly requestBody?: never
|
|
2055
|
+
readonly responses: {
|
|
2056
|
+
/** @description Current account and fixed session expiry, in Unix milliseconds. */
|
|
2057
|
+
readonly 200: {
|
|
2058
|
+
headers: {
|
|
2059
|
+
readonly [name: string]: unknown
|
|
2060
|
+
}
|
|
2061
|
+
content: {
|
|
2062
|
+
readonly 'application/json': {
|
|
2063
|
+
readonly expiresAt: number
|
|
2064
|
+
/** Format: uuid */
|
|
2065
|
+
readonly userId: string
|
|
2066
|
+
readonly workspaces: readonly {
|
|
2067
|
+
/** Format: uuid */
|
|
2068
|
+
readonly customerId: string
|
|
2069
|
+
readonly name: string
|
|
2070
|
+
/** @enum {string} */
|
|
2071
|
+
readonly role: 'user' | 'admin' | 'superadmin'
|
|
2072
|
+
readonly slug: string
|
|
2073
|
+
readonly tags: readonly string[]
|
|
2074
|
+
/** @enum {string} */
|
|
2075
|
+
readonly type: 'standard' | 'sdk_builder'
|
|
2076
|
+
}[]
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
/** @description Unauthorized! */
|
|
2081
|
+
readonly 401: {
|
|
2082
|
+
headers: {
|
|
2083
|
+
readonly [name: string]: unknown
|
|
2084
|
+
}
|
|
2085
|
+
content: {
|
|
2086
|
+
readonly 'application/json': components['schemas']['UnauthorizedError']
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
/** @description Forbidden! */
|
|
2090
|
+
readonly 403: {
|
|
2091
|
+
headers: {
|
|
2092
|
+
readonly [name: string]: unknown
|
|
2093
|
+
}
|
|
2094
|
+
content: {
|
|
2095
|
+
readonly 'application/json': components['schemas']['ForbiddenError']
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
/** @description Not Found! */
|
|
2099
|
+
readonly 404: {
|
|
2100
|
+
headers: {
|
|
2101
|
+
readonly [name: string]: unknown
|
|
2102
|
+
}
|
|
2103
|
+
content: {
|
|
2104
|
+
readonly 'application/json': components['schemas']['NotFoundError']
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
/** @description An unexpected error occurred! */
|
|
2108
|
+
readonly default: {
|
|
2109
|
+
headers: {
|
|
2110
|
+
readonly [name: string]: unknown
|
|
2111
|
+
}
|
|
2112
|
+
content: {
|
|
2113
|
+
readonly 'application/json': components['schemas']['DefaultResponse']
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
1751
2118
|
readonly exchangeAuthCode: {
|
|
1752
2119
|
readonly parameters: {
|
|
1753
2120
|
readonly query?: never
|
|
@@ -2,7 +2,7 @@ import type { AnyClientTool } from '@tanstack/ai';
|
|
|
2
2
|
import { type UIMessage } from '@tanstack/ai-client';
|
|
3
3
|
import { type ObservableWithLastValue } from '@salsita-ai/common/utils';
|
|
4
4
|
import { type AuthorizedPhoenixApiClient } from '#package/client';
|
|
5
|
-
import type { DomainContextSelectors, DomainServicesSelectors, InitializableSystem, SessionAssistantSetup, SpecSelectors } from '#package/domain';
|
|
5
|
+
import type { AssistantManifest, DomainContextSelectors, DomainServicesSelectors, InitializableSystem, SessionAssistantSetup, SpecSelectors } from '#package/domain';
|
|
6
6
|
import type { ConfiguratorExtensionSelectors } from '../../selectors.js';
|
|
7
7
|
/** A tool of the assistant that the model calls and the browser runs, as the chat client accepts it. */
|
|
8
8
|
export type AssistantClientTool = AnyClientTool;
|
|
@@ -146,6 +146,12 @@ export declare class AssistantSystem implements InitializableSystem {
|
|
|
146
146
|
* at; nothing when that step is not a change of the assistant. It never completes.
|
|
147
147
|
*/
|
|
148
148
|
readonly undoTipToolCallId$: ObservableWithLastValue<string | undefined>;
|
|
149
|
+
/**
|
|
150
|
+
* The manifest the initialized session runs, narrowed by the project's setup handler: what the
|
|
151
|
+
* agent can read, so the panel reads recipes and options the way the agent does. `null` while the
|
|
152
|
+
* assistant is off for the session or its setup failed.
|
|
153
|
+
*/
|
|
154
|
+
getSessionManifest: () => AssistantManifest | null;
|
|
149
155
|
/**
|
|
150
156
|
* A new configuration load: the chat of the previous one is deactivated and both observables go
|
|
151
157
|
* back to their empty values. An activation that is still held outlives it and gets the chat of
|
|
@@ -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}from"./graphql-tools.js";let d=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}),c=Object.freeze({open:!1,hasUnreadReply:!1,isInputFocused:!1}),u=Object.freeze({}),_=Object.freeze({results:Object.freeze([]),committed:!1,sideEffects:Object.freeze([]),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."}),g=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(d);_panel=new i(c);_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??u,resolveLocalizable:e=>s.getResolveLocalizable()(e)});let r={getGraphQLSystem:()=>t.getGraphQLSystem(),getStoreSystem:()=>i.getStoreSystem(),getActiveMode:()=>i.getActiveMode(),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;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(c),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({...d,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 _;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)}})),
|
|
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}from"./graphql-tools.js";let d=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}),c=Object.freeze({open:!1,hasUnreadReply:!1,isInputFocused:!1}),u=Object.freeze({}),_=Object.freeze({results:Object.freeze([]),committed:!1,sideEffects:Object.freeze([]),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."}),g=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(d);_panel=new i(c);_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??u,resolveLocalizable:e=>s.getResolveLocalizable()(e)});let r={getGraphQLSystem:()=>t.getGraphQLSystem(),getStoreSystem:()=>i.getStoreSystem(),getActiveMode:()=>i.getActiveMode(),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(c),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({...d,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 _;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)}})),f=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&&g(f)&&(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))}}),m=!1,p=()=>{m||(m=!0,this._finishing.delete(v),f.dispose())},v={client:f,configurationId:s,generation:i,authorizedClient:r,getConnection:n,dispose:p};this._current=v,f.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!==d&&this._chat.next(d),e};_endChat=()=>{let e=this._retireChat();if(e){if(!e.client.getIsLoading()&&g(e.client))return void e.dispose();this._finishing.add(e)}}}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agent's operation document with the closing braces it left off added at its end. Models
|
|
3
|
+
* often drop the last `}` of a nested selection, and the only error GraphQL gives for it is
|
|
4
|
+
* "Expected Name, found <EOF>", which costs the agent a round trip to fix. At the end of a
|
|
5
|
+
* document, closing braces are the only completion there is, so this cannot change what a valid
|
|
6
|
+
* document means; a brace missing in the middle nests the following fields one level deeper, which
|
|
7
|
+
* validation then rejects. Appending keeps the positions GraphQL reports for the agent's own text.
|
|
8
|
+
* A document with no unclosed brace, which covers every document that parses, or one that still
|
|
9
|
+
* does not parse with them closed is returned as it is, so GraphQL reports the agent's own syntax
|
|
10
|
+
* error and not one of the repair.
|
|
11
|
+
*/
|
|
12
|
+
export declare const closeUnclosedBraces: (document: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Lexer as r,Source as e,TokenKind as t,parse as n}from"graphql";export const closeUnclosedBraces=c=>{let a=(n=>{let c=new r(new e(n)),a=0;try{for(let r=c.advance();r.kind!==t.EOF;r=c.advance())r.kind===t.BRACE_L?a+=1:r.kind===t.BRACE_R&&(a-=1)}catch{return 0}return a})(c);if(a<=0)return c;let l=`${c}${" }".repeat(a)}`;return(r=>{try{return n(r),!0}catch{return!1}})(l)?l:c};
|
package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ export declare class GraphQLSystem {
|
|
|
97
97
|
/**
|
|
98
98
|
* Runs the operations in order through one working state that starts at `originalState`: a query
|
|
99
99
|
* reads the current working state, and each mutation field advances it with its own emission.
|
|
100
|
-
* The
|
|
100
|
+
* The closing braces an operation's document left off are added, then the lenses it spreads are injected into it. Nothing is committed. The first operation that fails stops the list; every later one gets a
|
|
101
101
|
* "not run" error instead.
|
|
102
102
|
*/
|
|
103
103
|
prepare: (originalState: AnyDomainState, operations: readonly GraphQLOperation[]) => Promise<readonly PreparedOperation[]>;
|
package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{GraphQLError as e,NoSchemaIntrospectionCustomRule as t,defaultFieldResolver as i,execute as o,getNamedType as n,parse as r,specifiedRules as a,validate as s,validateSchema as l}from"graphql";import{assertExistence as c,createSelector as d,isMessageDescriptor as h,isMultilingualString as u}from"@salsita-ai/common/utils";import{DomainEntityIdSchema as m,createAssistantExecutionSchema as f,findAssistantMutation as p}from"#package/domain";import{
|
|
1
|
+
import{GraphQLError as e,NoSchemaIntrospectionCustomRule as t,defaultFieldResolver as i,execute as o,getNamedType as n,parse as r,specifiedRules as a,validate as s,validateSchema as l}from"graphql";import{assertExistence as c,createSelector as d,isMessageDescriptor as h,isMultilingualString as u}from"@salsita-ai/common/utils";import{DomainEntityIdSchema as m,createAssistantExecutionSchema as f,findAssistantMutation as p}from"#package/domain";import{closeUnclosedBraces as g}from"./close-unclosed-braces.js";import{createEntityMeta as y}from"./entity-meta.js";import{injectAssistantLenses as v}from"./inject-assistant-lenses.js";import{readSideEffects as S}from"./side-effects.js";let _={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.")]},x={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.")]},w=new RegExp(m.pattern),E=[...a,t],$=e=>"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type&&"id"in e&&"string"==typeof e.id,b=(e,t)=>"object"==typeof e&&null!==e?Reflect.get(e,t):void 0,T=e=>e instanceof Error?e.message:String(e),C=e=>/[.!?]$/.test(e)?e:`${e}.`,R=e=>"object"==typeof e&&null!==e&&Object.getPrototypeOf(e)===Object.prototype,j=(e,t)=>{let i=R(e)?e._raw:void 0;if($(i))return i;if(!Array.isArray(e)&&!R(e))return e;if(t.has(e))throw Error("The value contains itself.");let o=new Set([...t,e]);return Array.isArray(e)?e.map(e=>j(e,o)):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,j(t,o)]))};export const localize=(e,t)=>Array.isArray(e)?e.map(e=>localize(e,t)):"string"==typeof e||h(e)||u(e)?t(e):e;let A=t=>new e(`The configurator cannot handle this request: ${C(t)} This is a fault in the configurator, not in your request. Tell the user this is not available.`),M=e=>(e.errors?.length??0)>0,z=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=d([d.leaf(e=>e)],e=>{try{let t=f(e),i=l(t);return i.length>0?A(i.map(e=>e.message).join(" ")):t}catch(e){return A(T(e))}});_selectLenses=d([d.leaf(e=>e)],e=>r(e));_selectFieldResolver=d([d.leaf(e=>e)],t=>(o,r,a,s)=>{if(s.parentType===s.schema.getQueryType())return i(o,r,a,s);if(s.parentType===s.schema.getMutationType())return this._resolveMutation(s.fieldName,String(s.path.key),r,a);if(!$(o))return i(o,r,a,s);if("meta"===s.fieldName){let e;return y({entity:o,state:("object"==typeof(e=b(o,"_state"))&&null!==e&&"entities"in e&&"rootEntityId"in e?e:void 0)??a.state},{manifest:a.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)})}let{source:l,localized:c}=t[s.parentType.name]?.[s.fieldName]??{source:s.fieldName},d=((t,i)=>{try{return b(t,i)}catch(o){throw new e(`Expression "${i}" failed on ${$(t)?t.id:"an entity"}: ${C(T(o))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:o instanceof Error?o:void 0})}})(o,l);return c?localize(d,this._context.domainServicesSelectors.getResolveLocalizable()):l.startsWith("$")&&"JSON"===n(s.returnType).name?((t,i,o)=>{try{return j(o,new Set)}catch(o){throw new e(`Expression "${i}" returned a value that is not plain serializable data on ${$(t)?t.id:"an entity"}: ${C(T(o))} This is a fault in the configurator, not in your request. Tell the user this is not available.`,{originalError:o instanceof Error?o:void 0})}})(o,l,d):d});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 o=i.rootEntityId;let n=t.filter(e=>!w.test(e));if(n.length>0)throw new e(`${n.map(e=>`"${e}"`).join(", ")} ${1===n.length?"is not an entity id":"are not entity ids"}. Entity ids have the form "<Type>-<number>", e.g. "${o}". Use ids as returned by the "id" field.`);return t.map(e=>w.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=>$(e)?e.type:void 0;initialize=()=>{};_resolveMutation=(t,i,o,n)=>{if(void 0!==n.failedMutationField)throw new e(`Not run: the earlier field "${n.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,o,n)}catch(e){throw n.failedMutationField=i,e}};_runMutation=(t,i,o)=>{let n=p(t,o.manifest);if(!n)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=o.state,a=n.implementation(i,r,{manifest:o.manifest,action:this._context.domainContextSelectors.getActionSystem().createContext(r),resolveLocalizable:this._context.domainServicesSelectors.getResolveLocalizable()});if(a.updates.length>0){let i=this._context.domainContextSelectors.getStoreSystem().prepareStateEmission(a.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: ${C(T(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.`);o.emissions.push(i),o.state=i.state}return a.readResult({previousState:r,state:o.state})};_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:_};let o=this._selectSchema(t.sdl);return o instanceof e?{ready:!1,result:{errors:[o]}}:{ready:!0,assistant:t,schema:o,lenses:t.lenses?.definitions?this._selectLenses(t.lenses.definitions):void 0,fieldResolver:this._selectFieldResolver(t.fields)}};_run=(t,i,n,a)=>{let l;try{l=r(t)}catch(t){return{errors:[t instanceof e?t:new e(T(t))]}}let c=s(n.schema,l,E);return c.length>0?{errors:c}:o({schema:n.schema,document:l,rootValue:this._rootValue,contextValue:a,variableValues:i.variables,operationName:i.operationName,fieldResolver:n.fieldResolver,typeResolver:this._resolveType})};prepare=async(t,i)=>{let o,n=this._setup();if(!n.ready)return i.map(()=>({result:n.result,emissions:[]}));let r={manifest:n.assistant,state:t,emissions:[],failedMutationField:void 0},a=[];for(let[t,s]of i.entries())if(void 0===o){let i=r.emissions.length;r.failedMutationField=void 0;let l=g(s.document),c=n.lenses?v(l,n.lenses):l,d=c instanceof e?{errors:[c]}:await this._run(c,s,n,r);a.push({result:d,emissions:r.emissions.slice(i)}),M(d)&&(o=t)}else a.push({result:z(o),emissions:[]});return a};readSideEffects=e=>{let t=this._context.domainServicesSelectors.getResolveLocalizable();return e.flatMap(({emissions:e})=>e.flatMap(e=>S(e.updates,t)))};_prepareAndCommit=async e=>{let t,i,o,n=this._context.domainContextSelectors.getStoreSystem(),r=await this.prepare(n.stateSlices.committed.value.state,e),a=r.map(({result:e})=>e),s=this.readSideEffects(r),l=r.flatMap(e=>e.emissions);if(a.some(M)||0===l.length)return{results:a,sideEffects:s,outcome:"none"};let d=(t=c(l[0]),i=c(l[l.length-1]),o=l.some(e=>void 0!==e.transformationLog),{kind:"committed",previousState:t.previousState,state:i.state,updates:l.flatMap(e=>e.updates),validity:i.validity,transformationLog:o?l.flatMap(e=>e.transformationLog??[]):void 0});return{results:a,sideEffects:s,outcome:n.commitPrepared(d),preparedState:d.state}};execute=async e=>{if(!this._context.domainContextSelectors.getStoreSystem().isInitialized)return{results:e.map(()=>x),committed:!1,sideEffects:[]};let t=await this._prepareAndCommit(e),{results:i,sideEffects:o,outcome:n,preparedState:r}="conflict"===t.outcome?await this._prepareAndCommit(e):t;return"committed"===n?{results:i,committed:!0,sideEffects:o,preparedState:r}:"held"===n?{results:i,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,preparedState:r}:"conflict"===n?{results:i,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}:{results:i,committed:!1,sideEffects:o}}}
|