@salsita-ai/sdk 0.50.0-develop.b5d443db78 → 0.50.0-develop.b65a5a9c66
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 +10 -3
- package/dist/admin/common/admin-interface.d.ts +13 -3
- package/dist/admin/common/admin-interface.js +1 -1
- package/dist/admin/ui/layout/UserProfile.d.ts +1 -1
- package/dist/admin/ui/layout/UserProfile.js +1 -1
- package/dist/admin/ui/maintenance/ImportPresets.js +1 -1
- package/dist/application/mount-application.js +1 -1
- package/dist/application/mount-configurator.js +1 -1
- package/dist/application/studio-embedding.d.ts +6 -0
- package/dist/application/studio-embedding.js +1 -0
- package/dist/application-spec/core/enhanced-json-schema.d.ts +5 -6
- package/dist/application-spec/core/enhanced-json-schema.js +1 -1
- package/dist/application-spec/core/markers/index.d.ts +1 -0
- package/dist/application-spec/core/markers/index.js +1 -1
- package/dist/application-spec/core/markers/set-in-studio-marker.d.ts +15 -0
- package/dist/application-spec/core/markers/set-in-studio-marker.js +1 -0
- package/dist/application-spec/errors/diagnostic-codes.d.ts +22 -0
- package/dist/application-spec/errors/diagnostic-codes.js +1 -1
- package/dist/application-spec/errors/diagnostic-messages.d.ts +23 -1
- package/dist/application-spec/errors/diagnostic-messages.js +1 -1
- package/dist/application-spec/generate-application/code/domain-runtime-files.d.ts +3 -3
- package/dist/application-spec/generate-application/code/domain-runtime-files.js +1 -1
- package/dist/application-spec/generate-application/code/index.d.ts +1 -0
- package/dist/application-spec/generate-application/code/standalone-app-files.d.ts +4 -15
- package/dist/application-spec/generate-application/code/standalone-app-files.js +1 -1
- package/dist/application-spec/generate-application/code/templates/admin-config.d.ts +5 -1
- package/dist/application-spec/generate-application/code/templates/admin-config.js +4 -3
- package/dist/application-spec/generate-application/code/templates/application-types.js +5 -5
- package/dist/application-spec/generate-application/code/templates/configurator-config.js +8 -6
- package/dist/application-spec/generate-application/code/templates/configurator-domain-code.d.ts +0 -1
- package/dist/application-spec/generate-application/code/templates/configurator-domain-code.js +6 -8
- package/dist/application-spec/generate-application/code/templates/configurator-frontend-code.d.ts +1 -0
- package/dist/application-spec/generate-application/code/templates/configurator-frontend-code.js +8 -6
- package/dist/application-spec/generate-application/code/templates/domain-spec/factory-types/domain-factory-types.d.ts +6 -8
- package/dist/application-spec/generate-application/code/templates/domain-spec/factory-types/domain-factory-types.js +3 -3
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-base-configurator-builder.js +2 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-domain-block.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-domain-block.js +38 -41
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-phx-globals.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/domain-spec/generate-phx-globals.js +19 -3
- package/dist/application-spec/generate-application/code/templates/domain-spec.js +12 -12
- package/dist/application-spec/generate-application/code/templates/domain.js +3 -3
- package/dist/application-spec/generate-application/code/templates/editor.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/editor.js +16 -3
- package/dist/application-spec/generate-application/code/templates/frontend-config.js +7 -3
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-action-types.d.ts +3 -3
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-action-types.js +3 -3
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-assistant-form-element-types.d.ts +10 -6
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-assistant-form-element-types.js +7 -7
- package/dist/application-spec/generate-application/code/templates/global-definition/generate-phx-types.js +12 -13
- package/dist/application-spec/generate-application/code/templates/globals.js +21 -12
- package/dist/application-spec/generate-application/code/templates/html-index.d.ts +12 -1
- package/dist/application-spec/generate-application/code/templates/html-index.js +9 -10
- package/dist/application-spec/generate-application/code/templates/index.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/sign-in-page-options.d.ts +5 -0
- package/dist/application-spec/generate-application/code/templates/sign-in-page-options.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/core/cli.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/core/sdk.js +8 -36
- package/dist/application-spec/generate-application/code/templates/skills/core/workflow.js +15 -11
- package/dist/application-spec/generate-application/code/templates/skills/features/application-states/views-and-tools.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/assistant/index.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/assistant/index.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/assistant/panel.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/assistant/panel.js +42 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/assistant/reading-and-changing.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/assistant/reading-and-changing.js +55 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/assistant/session-setup.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/assistant/session-setup.js +16 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/custom-layout/custom-layout.js +3 -3
- package/dist/application-spec/generate-application/code/templates/skills/features/custom-layout/pages.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/custom-layout/pages.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/custom-layout/sign-in.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/custom-layout/sign-in.js +19 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/domain-controls/custom-controls.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/domain-controls/scene-controls.js +4 -2
- package/dist/application-spec/generate-application/code/templates/skills/features/domain-model/actions.js +3 -3
- package/dist/application-spec/generate-application/code/templates/skills/features/domain-model/components.js +2 -2
- package/dist/application-spec/generate-application/code/templates/skills/features/domain-model/expressions.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/features.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/state/violations.js +2 -2
- package/dist/application-spec/generate-application/code/templates/skills/features/variants.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/authentication.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/authentication.js +48 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/backend-data.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/backend-data.js +45 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/entry-and-environment.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/entry-and-environment.js +36 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/finalization.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/finalization.js +92 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/index.d.ts +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/index.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/publishing.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/publishing.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/session-fields.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/session-fields.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/tasks/callback.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/tasks/callback.js +26 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/tasks/documents.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/tasks/documents.js +51 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/tasks/email.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/tasks/email.js +38 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/tasks/index.d.ts +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/tasks/index.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/tasks/integrations.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/tasks/integrations.js +88 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/tasks/links-and-images.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/tasks/links-and-images.js +68 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/tasks/tasks.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/tasks/tasks.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/webhooks.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/webhooks.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/guide.d.ts +2 -2
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill-bundle.js +3 -3
- package/dist/application-spec/generate-application/code/templates/skills/phx-members-without-guide.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/processes/asset-conversion.js +3 -3
- package/dist/application-spec/generate-application/code/templates/skills/processes/assistant-configuration.d.ts +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/processes/assistant-configuration.js +3 -0
- package/dist/application-spec/generate-application/code/templates/skills/processes/feedback/report.js +29 -1
- package/dist/application-spec/generate-application/code/templates/skills/processes/finalization.js +2 -2
- package/dist/application-spec/generate-application/code/templates/skills/processes/first-draft/build.js +29 -15
- package/dist/application-spec/generate-application/code/templates/skills/processes/first-draft/direction.js +17 -14
- package/dist/application-spec/generate-application/code/templates/skills/processes/first-draft/first-draft.js +2 -2
- package/dist/application-spec/generate-application/code/templates/skills/processes/first-draft/handoff.js +3 -3
- package/dist/application-spec/generate-application/code/templates/skills/processes/index.d.ts +2 -0
- package/dist/application-spec/generate-application/code/templates/skills/processes/index.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/processes/model-migration.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/processes/review/appearance.js +2 -2
- package/dist/application-spec/generate-application/code/templates/skills/processes/review/code.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/processes/review/review.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/processes/review/visual-inspection.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/processes/scene-realism.d.ts +2 -0
- package/dist/application-spec/generate-application/code/templates/skills/processes/scene-realism.js +29 -0
- package/dist/application-spec/generate-application/code/templates/skills/processes/specification/product-definition.js +2 -0
- package/dist/application-spec/generate-application/code/templates/skills/processes/specification/specification.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/processes/specification/ux-specification.d.ts +2 -0
- package/dist/application-spec/generate-application/code/templates/skills/processes/specification/ux-specification.js +28 -0
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.d.ts +0 -7
- package/dist/application-spec/generate-application/code/templates/skills/sdk-content.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/sdk-subpath-imports.js +1 -1
- package/dist/application-spec/generate-application/code/templates/webhook-builders.js +8 -6
- package/dist/application-spec/generate-application/code/templates/webhook-index.js +2 -6
- package/dist/application-spec/generate-application/code/webhook-safe-files.d.ts +3 -1
- package/dist/application-spec/generate-application/code/webhook-safe-files.js +1 -1
- package/dist/application-spec/parse-application-files/access/access-handler-kinds.d.ts +18 -0
- package/dist/application-spec/parse-application-files/access/access-handler-kinds.js +1 -0
- package/dist/application-spec/parse-application-files/access/analyzed-file.d.ts +7 -0
- package/dist/application-spec/parse-application-files/access/check-access-handler-files.d.ts +20 -0
- package/dist/application-spec/parse-application-files/access/check-access-handler-files.js +1 -0
- package/dist/application-spec/parse-application-files/access/check-auth-hook-files.d.ts +17 -0
- package/dist/application-spec/parse-application-files/access/check-auth-hook-files.js +1 -0
- package/dist/application-spec/parse-application-files/access/index.d.ts +5 -0
- package/dist/application-spec/parse-application-files/access/index.js +1 -0
- package/dist/application-spec/parse-application-files/access/sign-in-control.d.ts +7 -0
- package/dist/application-spec/parse-application-files/access/sign-in-control.js +1 -0
- package/dist/application-spec/parse-application-files/categorize/categorize-files.d.ts +2 -1
- package/dist/application-spec/parse-application-files/categorize/categorize-files.js +1 -1
- package/dist/application-spec/parse-application-files/categorize/module-analysis.d.ts +30 -4
- package/dist/application-spec/parse-application-files/categorize/module-analysis.js +1 -1
- package/dist/application-spec/parse-application-files/categorize/webhook-safety.js +1 -1
- package/dist/application-spec/parse-application-files/merge/merged-app-metadata.d.ts +17 -1
- package/dist/application-spec/parse-application-files/merge/merged-app-metadata.js +1 -1
- package/dist/application-spec/parse-application-files/merge/merged-assistant.js +1 -1
- package/dist/application-spec/parse-application-files/merge/merged-spec.d.ts +7 -1
- package/dist/application-spec/parse-application-files/merge/merged-spec.js +1 -1
- package/dist/application-spec/parse-application-files/parse-application-files.js +1 -1
- package/dist/application-spec/parse-application-files/parse-common-admin-spec.js +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/raw-actions.d.ts +3 -2
- package/dist/application-spec/parse-application-files/raw-spec/raw-actions.js +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.d.ts +67 -8
- package/dist/application-spec/parse-application-files/raw-spec/raw-assistant.js +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/raw-components.js +1 -1
- package/dist/application-spec/parse-application-files/raw-spec/raw-spec-file.d.ts +12 -3
- package/dist/application-spec/parse-application-files/raw-spec/raw-spec-file.js +1 -1
- package/dist/application-spec/parse-application-files/resolve/resolve-import-modules.js +1 -1
- package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.d.ts +6 -0
- package/dist/application-spec/parse-application-files/spec/application/configurator-spec/configurator-spec.js +1 -1
- package/dist/application-spec/parse-application-files/spec/expressions/user-expressions.js +1 -1
- package/dist/application-spec/parse-application-files/spec/model/index.d.ts +2 -1
- package/dist/application-spec/parse-application-files/spec/model/index.js +1 -1
- package/dist/application-spec/parse-application-files/spec/model/session-data-schema.d.ts +5 -2
- package/dist/application-spec/parse-application-files/spec/model/session-data-schema.js +1 -1
- package/dist/application-spec/parse-application-files/spec/model/session-fields/index.d.ts +1 -0
- package/dist/application-spec/parse-application-files/spec/model/session-fields/index.js +1 -0
- package/dist/application-spec/parse-application-files/spec/model/session-fields/session-fields.d.ts +15 -0
- package/dist/application-spec/parse-application-files/spec/model/session-fields/session-fields.js +1 -0
- package/dist/application-spec/parse-application-files/spec/relations/relations.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/actions.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/app-metadata.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-form-elements.d.ts +14 -2
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-form-elements.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.d.ts +7 -10
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-schema.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-server-settings.d.ts +5 -6
- package/dist/application-spec/parse-application-files/spec/sections/assistant/assistant-server-settings.js +1 -1
- package/dist/application-spec/parse-application-files/spec/sections/assistant/index.d.ts +0 -1
- package/dist/application-spec/webhook-boundary.js +1 -1
- package/dist/client/authenticated-client.d.ts +5 -1
- package/dist/client/authenticated-client.js +1 -1
- package/dist/client/authorized-client.d.ts +4 -1
- package/dist/client/authorized-client.js +1 -1
- package/dist/client/base-client.d.ts +15 -1
- package/dist/client/base-client.js +1 -1
- package/dist/client/cli-client/cli-api-client.d.ts +17 -0
- package/dist/client/cli-client/cli-api-client.js +1 -0
- package/dist/client/cli-client/index.d.ts +2 -0
- package/dist/client/cli-client/index.js +1 -0
- package/dist/client/cli-client/unsupported-api-version-error.d.ts +11 -0
- package/dist/client/cli-client/unsupported-api-version-error.js +1 -0
- package/dist/client/contract.d.ts +53 -10
- package/dist/client/contract.js +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.js +1 -1
- package/dist/client/local-authorized-client.d.ts +1 -0
- package/dist/client/local-authorized-client.js +1 -1
- package/dist/client/memory-authorized-client.d.ts +1 -0
- package/dist/client/memory-authorized-client.js +1 -1
- package/dist/client/phoenix-api.d.ts +8470 -2127
- package/dist/client/unauthenticated-client.d.ts +1 -0
- package/dist/client/unauthenticated-client.js +1 -1
- package/dist/configurator/ConfiguratorApp.js +1 -1
- package/dist/configurator/agent-at-work/AgentAtWorkFallback.d.ts +7 -0
- package/dist/configurator/agent-at-work/AgentAtWorkFallback.js +1 -0
- package/dist/configurator/agent-at-work/AgentAtWorkPage.d.ts +20 -0
- package/dist/configurator/agent-at-work/AgentAtWorkPage.js +1 -0
- package/dist/configurator/agent-at-work/AgentModeBadge.d.ts +11 -0
- package/dist/configurator/agent-at-work/AgentModeBadge.js +1 -0
- package/dist/configurator/agent-at-work/StudioMark.d.ts +8 -0
- package/dist/configurator/agent-at-work/StudioMark.js +1 -0
- package/dist/configurator/agent-at-work/agent-at-work-copy.d.ts +17 -0
- package/dist/configurator/agent-at-work/agent-at-work-copy.js +1 -0
- package/dist/configurator/agent-at-work/agent-at-work-styles.d.ts +23 -0
- package/dist/configurator/agent-at-work/agent-at-work-styles.js +374 -0
- package/dist/configurator/agent-at-work/index.d.ts +3 -0
- package/dist/configurator/agent-at-work/index.js +1 -0
- package/dist/configurator/application-runtime/extensions/configurator-extension-systems.d.ts +5 -4
- package/dist/configurator/application-runtime/extensions/configurator-extension-systems.js +1 -1
- package/dist/configurator/application-runtime/extensions/create-configurator-extensions.js +1 -1
- package/dist/configurator/application-runtime/extensions/selectors.d.ts +4 -2
- package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/action-system/action-context.d.ts +14 -0
- package/dist/configurator/application-runtime/extensions/systems/action-system/action-context.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/action-system/action-factory.d.ts +13 -0
- package/dist/configurator/application-runtime/extensions/systems/action-system/action-system.d.ts +55 -0
- package/dist/configurator/application-runtime/extensions/systems/action-system/action-system.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/action-system/action.d.ts +56 -0
- package/dist/configurator/application-runtime/extensions/systems/action-system/action.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/action-system/index.d.ts +6 -0
- package/dist/configurator/application-runtime/extensions/systems/action-system/index.js +1 -0
- package/dist/{domain/domain-runtime/spec → configurator/application-runtime/extensions/systems/action-system}/prepare-action-implementations.d.ts +4 -3
- package/dist/{domain/domain-runtime/spec → configurator/application-runtime/extensions/systems/action-system}/prepare-action-implementations.js +2 -2
- package/dist/{domain/spec/modules → configurator/application-runtime/extensions/systems/action-system}/resolve-action-modules.d.ts +2 -2
- package/dist/configurator/application-runtime/extensions/systems/action-system/resolve-action-modules.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-annotation.d.ts +14 -8
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-image-view.d.ts +18 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-image-view.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-speech-player.d.ts +69 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-speech-player.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +252 -22
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/composer-attachments.d.ts +63 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/composer-attachments.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +52 -36
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/rasterize-image.d.ts +13 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/rasterize-image.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/speakable-reply.d.ts +7 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/speakable-reply.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/index.d.ts +3 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/index.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/register-webmcp-tools.d.ts +33 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/register-webmcp-tools.js +6 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/share-link.d.ts +14 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/share-link.js +2 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/to-webmcp-result.d.ts +10 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/to-webmcp-result.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/camera-control-system/camera-control-system.d.ts +41 -35
- package/dist/configurator/application-runtime/extensions/systems/camera-control-system/camera-control-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/export-system/export-system.d.ts +18 -5
- package/dist/configurator/application-runtime/extensions/systems/export-system/export-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.d.ts +8 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/entity-meta.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.d.ts +46 -12
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/is-offered-for-selection.d.ts +16 -0
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/is-offered-for-selection.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/read-offered-navigation.d.ts +26 -0
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/read-offered-navigation.js +1 -0
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/violations.d.ts +25 -8
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/violations.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/image-rendering-system/export-image-capture.d.ts +15 -4
- package/dist/configurator/application-runtime/extensions/systems/image-rendering-system/export-image-capture.js +3 -3
- package/dist/configurator/application-runtime/extensions/systems/image-rendering-system/image-rendering-system.d.ts +15 -7
- package/dist/configurator/application-runtime/extensions/systems/image-rendering-system/image-rendering-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/index.d.ts +8 -3
- package/dist/configurator/application-runtime/extensions/systems/index.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/layout-system/layout-system.d.ts +11 -0
- package/dist/configurator/application-runtime/extensions/systems/layout-system/layout-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/sketching-system/sketching-system.d.ts +5 -5
- package/dist/configurator/application-runtime/hooks/use-configurator.d.ts +3 -3
- package/dist/configurator/common/configurator-interface.d.ts +21 -9
- package/dist/configurator/common/configurator-interface.js +1 -1
- package/dist/configurator/index.d.ts +1 -0
- package/dist/configurator/index.js +1 -1
- package/dist/configurator/{ui/configurator-layout/universal → pages}/ExportingOverlay.d.ts +3 -2
- package/dist/configurator/pages/ExportingOverlay.js +1 -0
- package/dist/configurator/pages/InertRoot.d.ts +10 -0
- package/dist/configurator/pages/InertRoot.js +1 -0
- package/dist/configurator/pages/LoadedConfiguratorDetailPage.js +1 -1
- package/dist/configurator/pages/PresetCreationErrorPage.d.ts +1 -1
- package/dist/configurator/pages/PresetCreationErrorPage.js +1 -1
- package/dist/configurator/pages/error-boundaries/AgentModeErrorFallback.d.ts +8 -0
- package/dist/configurator/pages/error-boundaries/AgentModeErrorFallback.js +1 -0
- package/dist/configurator/pages/error-boundaries/DevContextFallback.d.ts +4 -2
- package/dist/configurator/pages/error-boundaries/DevContextFallback.js +1 -1
- package/dist/configurator/pages/error-boundaries/DevLoadingFallback.d.ts +6 -4
- package/dist/configurator/pages/error-boundaries/DevLoadingFallback.js +1 -1
- package/dist/configurator/pages/error-boundaries/GeneralErrorBoundary.js +1 -1
- package/dist/configurator/scene/cameras/CameraPadding.d.ts +5 -0
- package/dist/configurator/scene/cameras/CameraPadding.js +1 -1
- package/dist/configurator/scene/resources/use-phx-gltf.js +1 -1
- package/dist/configurator/scene/scene-entity/materials/LocalCreatedMaterial.js +1 -1
- package/dist/configurator/scene/scene-entity/materials/RemoteReplacedMaterial.d.ts +5 -0
- package/dist/configurator/scene/scene-entity/materials/RemoteReplacedMaterial.js +1 -1
- package/dist/configurator/scene/scene-entity/materials/use-dispose-replaced.d.ts +27 -0
- package/dist/configurator/scene/scene-entity/materials/use-dispose-replaced.js +1 -0
- package/dist/configurator/toolbar-actions/use-toolbar-actions.js +1 -1
- package/dist/configurator/ui/assistant/AssistantChips.d.ts +78 -6
- package/dist/configurator/ui/assistant/AssistantChips.js +1 -1
- package/dist/configurator/ui/assistant/AssistantComposer.d.ts +99 -1
- package/dist/configurator/ui/assistant/AssistantComposer.js +1 -1
- package/dist/configurator/ui/assistant/AssistantMarkdown.d.ts +37 -3
- package/dist/configurator/ui/assistant/AssistantMarkdown.js +1 -1
- package/dist/configurator/ui/assistant/AssistantPanel.d.ts +51 -4
- package/dist/configurator/ui/assistant/AssistantPanel.js +1 -1
- package/dist/configurator/ui/assistant/AssistantThread.d.ts +85 -2
- package/dist/configurator/ui/assistant/AssistantThread.js +1 -1
- package/dist/configurator/ui/assistant/AssistantThreadItemView.d.ts +83 -6
- package/dist/configurator/ui/assistant/AssistantThreadItemView.js +1 -1
- package/dist/configurator/ui/assistant/alert/AssistantAlert.d.ts +35 -1
- package/dist/configurator/ui/assistant/alert/AssistantAlert.js +1 -1
- package/dist/configurator/ui/assistant/alert/index.d.ts +1 -1
- package/dist/configurator/ui/assistant/annotation/AnnotationBadge.d.ts +34 -0
- package/dist/configurator/ui/assistant/annotation/AnnotationBadge.js +1 -1
- package/dist/configurator/ui/assistant/annotation/AnnotationOverlay.d.ts +2 -3
- package/dist/configurator/ui/assistant/annotation/AnnotationViewer.js +1 -1
- package/dist/configurator/ui/assistant/annotation/MessageAnnotations.js +1 -1
- package/dist/configurator/ui/assistant/annotation/annotation-layout.d.ts +59 -5
- package/dist/configurator/ui/assistant/annotation/annotation-layout.js +1 -1
- package/dist/configurator/ui/assistant/annotation/editor/AnnotationComment.d.ts +40 -5
- package/dist/configurator/ui/assistant/annotation/editor/AnnotationComment.js +1 -1
- package/dist/configurator/ui/assistant/annotation/editor/AnnotationEditor.d.ts +6 -5
- package/dist/configurator/ui/assistant/annotation/editor/AnnotationEditor.js +1 -1
- package/dist/configurator/ui/assistant/annotation/editor/annotation-pins.d.ts +5 -0
- package/dist/configurator/ui/assistant/annotation/editor/annotation-pins.js +1 -1
- package/dist/configurator/ui/assistant/annotation/editor/index.d.ts +1 -0
- package/dist/configurator/ui/assistant/annotation/index.d.ts +3 -2
- package/dist/configurator/ui/assistant/annotation/index.js +1 -1
- package/dist/configurator/ui/assistant/assistant-failure.d.ts +9 -4
- package/dist/configurator/ui/assistant/assistant-failure.js +1 -1
- package/dist/configurator/ui/assistant/attachments/MessageImages.d.ts +49 -5
- package/dist/configurator/ui/assistant/attachments/MessageImages.js +1 -1
- package/dist/configurator/ui/assistant/attachments/index.d.ts +1 -1
- package/dist/configurator/ui/assistant/composer/composer-frame.d.ts +7 -2
- package/dist/configurator/ui/assistant/composer/composer-frame.js +1 -1
- package/dist/configurator/ui/assistant/composer/index.d.ts +1 -1
- package/dist/configurator/ui/assistant/composer/index.js +1 -1
- package/dist/configurator/ui/assistant/disclaimer/AssistantDisclaimerDialog.d.ts +10 -0
- package/dist/configurator/ui/assistant/disclaimer/AssistantDisclaimerDialog.js +1 -0
- package/dist/configurator/ui/assistant/disclaimer/AssistantDisclaimerLine.d.ts +10 -0
- package/dist/configurator/ui/assistant/disclaimer/AssistantDisclaimerLine.js +1 -0
- package/dist/configurator/ui/assistant/disclaimer/index.d.ts +2 -0
- package/dist/configurator/ui/assistant/disclaimer/index.js +1 -0
- package/dist/configurator/ui/assistant/drawing/AssistantDrawing.d.ts +58 -0
- package/dist/configurator/ui/assistant/drawing/AssistantDrawing.js +1 -0
- package/dist/configurator/ui/assistant/drawing/index.d.ts +2 -0
- package/dist/configurator/ui/assistant/drawing/index.js +1 -0
- package/dist/configurator/ui/assistant/drawing/parse-drawing.d.ts +18 -0
- package/dist/configurator/ui/assistant/drawing/parse-drawing.js +1 -0
- package/dist/configurator/ui/assistant/drawing/use-drawing-url.d.ts +8 -0
- package/dist/configurator/ui/assistant/drawing/use-drawing-url.js +1 -0
- package/dist/configurator/ui/assistant/entity-link/AssistantEntityLink.d.ts +35 -1
- package/dist/configurator/ui/assistant/entity-link/AssistantEntityLink.js +1 -1
- package/dist/configurator/ui/assistant/entity-link/index.d.ts +1 -1
- package/dist/configurator/ui/assistant/form/AssistantForm.d.ts +59 -2
- package/dist/configurator/ui/assistant/form/AssistantForm.js +1 -1
- package/dist/configurator/ui/assistant/form/built-in-form-slots.d.ts +16 -0
- package/dist/configurator/ui/assistant/form/built-in-form-slots.js +1 -0
- package/dist/configurator/ui/assistant/form/form-model.d.ts +9 -0
- package/dist/configurator/ui/assistant/form/index.d.ts +2 -1
- package/dist/configurator/ui/assistant/form/parse-form-block.d.ts +6 -5
- package/dist/configurator/ui/assistant/form/parse-form-block.js +1 -1
- package/dist/configurator/ui/assistant/form/read-form-tile.d.ts +8 -0
- package/dist/configurator/ui/assistant/form/read-form-tile.js +1 -0
- package/dist/configurator/ui/assistant/form/registry/built-in-form-elements.d.ts +6 -3
- package/dist/configurator/ui/assistant/form/registry/built-in-form-elements.js +1 -1
- package/dist/configurator/ui/assistant/form/registry/create-assistant-form-element.d.ts +11 -7
- package/dist/configurator/ui/assistant/form/registry/form-registry.d.ts +1 -1
- package/dist/configurator/ui/assistant/form/registry/form-registry.js +1 -1
- package/dist/configurator/ui/assistant/form/registry/index.d.ts +1 -1
- package/dist/configurator/ui/assistant/form/split-form-rows.d.ts +7 -0
- package/dist/configurator/ui/assistant/form/split-form-rows.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/FormConfirm.d.ts +51 -0
- package/dist/configurator/ui/assistant/form-elements/FormConfirm.js +1 -1
- package/dist/configurator/ui/assistant/form-elements/FormGroup.d.ts +47 -0
- package/dist/configurator/ui/assistant/form-elements/FormGroup.js +1 -1
- package/dist/configurator/ui/assistant/form-elements/FormNumber.d.ts +43 -0
- package/dist/configurator/ui/assistant/form-elements/FormNumber.js +1 -1
- package/dist/configurator/ui/assistant/form-elements/FormOptions.d.ts +56 -2
- package/dist/configurator/ui/assistant/form-elements/FormOptions.js +1 -1
- package/dist/configurator/ui/assistant/form-elements/FormReply.d.ts +43 -0
- package/dist/configurator/ui/assistant/form-elements/FormReply.js +1 -1
- package/dist/configurator/ui/assistant/form-elements/FormText.d.ts +47 -0
- package/dist/configurator/ui/assistant/form-elements/FormText.js +1 -1
- package/dist/configurator/ui/assistant/form-elements/FormTile.d.ts +72 -0
- package/dist/configurator/ui/assistant/form-elements/FormTile.js +1 -0
- package/dist/configurator/ui/assistant/form-elements/form-element-props.d.ts +27 -0
- package/dist/configurator/ui/assistant/form-elements/index.d.ts +8 -9
- package/dist/configurator/ui/assistant/form-elements/index.js +1 -1
- package/dist/configurator/ui/assistant/image-view/ImageView.d.ts +66 -0
- package/dist/configurator/ui/assistant/image-view/ImageView.js +1 -0
- package/dist/configurator/ui/assistant/image-view/index.d.ts +1 -0
- package/dist/configurator/ui/assistant/image-view/index.js +1 -0
- package/dist/configurator/ui/assistant/image-view/use-image-blob.d.ts +7 -0
- package/dist/configurator/ui/assistant/image-view/use-image-blob.js +1 -0
- package/dist/configurator/ui/assistant/index.d.ts +21 -10
- package/dist/configurator/ui/assistant/index.js +1 -1
- package/dist/configurator/ui/assistant/panel/AssistantPanelHeader.d.ts +57 -0
- package/dist/configurator/ui/assistant/panel/AssistantPanelHeader.js +1 -0
- package/dist/configurator/ui/assistant/panel/index.d.ts +1 -0
- package/dist/configurator/ui/assistant/panel/index.js +1 -0
- package/dist/configurator/ui/assistant/reference-link/AssistantReferenceLink.d.ts +43 -1
- package/dist/configurator/ui/assistant/reference-link/AssistantReferenceLink.js +1 -1
- package/dist/configurator/ui/assistant/reference-link/assistant-reference-details.d.ts +4 -1
- package/dist/configurator/ui/assistant/reference-link/assistant-reference-details.js +1 -1
- package/dist/configurator/ui/assistant/reference-link/index.d.ts +3 -2
- package/dist/configurator/ui/assistant/reference-link/index.js +1 -1
- package/dist/configurator/ui/assistant/resource-image/AssistantImage.d.ts +49 -2
- package/dist/configurator/ui/assistant/resource-image/AssistantImage.js +1 -1
- package/dist/configurator/ui/assistant/resource-image/index.d.ts +1 -1
- package/dist/configurator/ui/assistant/resource-image/index.js +1 -1
- package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.d.ts +34 -0
- package/dist/configurator/ui/assistant/screenshots/ScreenshotThumbnails.js +1 -1
- package/dist/configurator/ui/assistant/screenshots/index.d.ts +1 -1
- package/dist/configurator/ui/assistant/screenshots/tool-screenshots.d.ts +2 -6
- package/dist/configurator/ui/assistant/screenshots/tool-screenshots.js +1 -1
- package/dist/configurator/ui/assistant/screenshots/use-screenshot-src.d.ts +5 -6
- package/dist/configurator/ui/assistant/screenshots/use-screenshot-src.js +1 -1
- package/dist/configurator/ui/assistant/thread-items.d.ts +17 -3
- package/dist/configurator/ui/assistant/thread-items.js +1 -1
- package/dist/configurator/ui/assistant/use-assistant-composer.d.ts +32 -7
- package/dist/configurator/ui/assistant/use-assistant-composer.js +2 -2
- package/dist/configurator/ui/assistant/use-assistant-thread.d.ts +15 -1
- package/dist/configurator/ui/assistant/use-assistant-thread.js +1 -1
- package/dist/configurator/ui/assistant/use-load-older-on-top.d.ts +3 -3
- package/dist/configurator/ui/assistant/use-load-older-on-top.js +1 -1
- package/dist/configurator/ui/assistant/{annotation/use-end-on-unmount.d.ts → use-on-unmount.d.ts} +1 -1
- package/dist/configurator/ui/assistant/use-on-unmount.js +1 -0
- package/dist/configurator/ui/assistant/voice/RecordingBar.d.ts +21 -0
- package/dist/configurator/ui/assistant/voice/RecordingBar.js +1 -0
- package/dist/configurator/ui/assistant/voice/ReplyPlayButton.d.ts +43 -0
- package/dist/configurator/ui/assistant/voice/ReplyPlayButton.js +1 -0
- package/dist/configurator/ui/assistant/voice/index.d.ts +4 -0
- package/dist/configurator/ui/assistant/voice/index.js +1 -0
- package/dist/configurator/ui/assistant/voice/use-voice-recording.d.ts +39 -0
- package/dist/configurator/ui/assistant/voice/use-voice-recording.js +1 -0
- package/dist/configurator/ui/assistant/voice/voice-capture.d.ts +22 -0
- package/dist/configurator/ui/assistant/voice/voice-capture.js +1 -0
- package/dist/configurator/ui/configurator-layout/index.d.ts +1 -1
- package/dist/configurator/ui/configurator-layout/index.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/canvas/LayoutCanvas.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/desktop-sidebar/DesktopSidebar.js +4 -4
- package/dist/configurator/ui/configurator-layout/slots/index.d.ts +2 -0
- package/dist/configurator/ui/configurator-layout/slots/index.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/view-controls/DesktopViewControls.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/view-controls/MobileViewControls.js +1 -1
- package/dist/configurator/ui/configurator-layout/slots/view-controls/NestedViewControls.d.ts +7 -0
- package/dist/configurator/ui/configurator-layout/slots/view-controls/NestedViewControls.js +1 -0
- package/dist/configurator/ui/configurator-layout/slots/view-controls/use-view-control-items.d.ts +6 -0
- package/dist/configurator/ui/configurator-layout/slots/view-controls/use-view-control-items.js +1 -0
- package/dist/configurator/ui/configurator-layout/universal/DesktopPreview.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/Layout.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/MobileLayout.js +3 -3
- package/dist/configurator/ui/configurator-layout/universal/MobilePreview.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/use-layout-scene-safe-area.js +1 -1
- package/dist/configurator/ui/configurator-layout/universal/use-preview-description.d.ts +1 -0
- package/dist/configurator/ui/configurator-layout/universal/use-preview-description.js +1 -0
- package/dist/configurator/ui/index.d.ts +1 -1
- package/dist/configurator/ui/legacy/layout/common/ViewControls.js +1 -1
- package/dist/configurator/ui/phoenix-layout-elements/AssistantToolbarButton.js +1 -1
- package/dist/docs/index.json +130 -5
- package/dist/docs/integrations/woocommerce/overview.mdx +4 -2
- package/dist/docs/layouts/nested-view-controls.mdx +223 -0
- package/dist/docs/layouts/presets/custom.mdx +1 -0
- package/dist/docs/layouts/preview/always.mdx +22 -0
- package/dist/docs/layouts/view-controls.mdx +2 -0
- package/dist/docs/other-features/domain-actions.mdx +82 -55
- package/dist/docs/other-features/violation-messages.mdx +3 -1
- package/dist/docs/phoenix/admin.mdx +25 -64
- package/dist/docs/phoenix/application-states.mdx +1 -1
- package/dist/docs/phoenix/assistant/actions.mdx +183 -0
- package/dist/docs/phoenix/assistant/changing-the-configuration.mdx +333 -0
- package/dist/docs/phoenix/assistant/instructions-and-ai-settings.mdx +221 -0
- package/dist/docs/phoenix/assistant/overview.mdx +137 -0
- package/dist/docs/phoenix/assistant/per-session-setup.mdx +166 -0
- package/dist/docs/phoenix/assistant/reading-the-configuration.mdx +349 -0
- package/dist/docs/phoenix/assistant/screenshots.mdx +135 -0
- package/dist/docs/phoenix/assistant/security-and-limits.mdx +151 -0
- package/dist/docs/phoenix/assistant/the-panel.mdx +298 -0
- package/dist/docs/phoenix/blender-rendering.mdx +3 -1
- package/dist/docs/phoenix/clerk-sign-in.mdx +9 -5
- package/dist/docs/phoenix/configurator-interface.mdx +105 -10
- package/dist/docs/phoenix/data-sources.mdx +71 -51
- package/dist/docs/phoenix/deployments.mdx +3 -3
- package/dist/docs/phoenix/finalization.mdx +2 -2
- package/dist/docs/phoenix/getting-started.mdx +1 -1
- package/dist/docs/phoenix/integration/authentication-external.mdx +5 -5
- package/dist/docs/phoenix/integration/authentication-internal.mdx +3 -3
- package/dist/docs/phoenix/integration/finalization-internal.mdx +2 -5
- package/dist/docs/phoenix/integration/integration-modes-internal.mdx +9 -0
- package/dist/docs/phoenix/layout-slots.mdx +2 -2
- package/dist/docs/phoenix/localization.mdx +2 -1
- package/dist/docs/phoenix/migrations.mdx +1 -1
- package/dist/docs/phoenix/phoenix-cli.mdx +100 -60
- package/dist/docs/phoenix/project-structure.mdx +30 -15
- package/dist/docs/phoenix/publishing.mdx +21 -28
- package/dist/docs/phoenix/sdk-builder-workflow.mdx +61 -30
- package/dist/docs/phoenix/sessions-and-access.mdx +180 -153
- package/dist/docs/phoenix/sharing.mdx +1 -1
- package/dist/docs/phoenix/theming.mdx +5 -9
- package/dist/docs/phoenix/webhook-membership.mdx +4 -1
- package/dist/docs/phoenix/webhooks.mdx +449 -296
- package/dist/docs/ux-guidelines/choosing-navigation.mdx +2 -0
- package/dist/docs/ux-guidelines/designing-the-configuration-journey.mdx +43 -0
- package/dist/docs/ux-guidelines/interaction-modes.mdx +2 -2
- package/dist/docs/ux-guidelines/overview.mdx +11 -9
- package/dist/domain/admin-domain/index.d.ts +2 -2
- package/dist/domain/application/access/access-handlers.d.ts +19 -0
- package/dist/domain/application/access/access-handlers.js +1 -0
- package/dist/domain/application/access/anonymous-handler.d.ts +16 -0
- package/dist/domain/application/access/anonymous-handler.js +1 -0
- package/dist/domain/application/access/chunk-scopes-handler.d.ts +27 -0
- package/dist/domain/application/access/chunk-scopes-handler.js +1 -0
- package/dist/domain/application/access/code-handler.d.ts +16 -0
- package/dist/domain/application/access/code-handler.js +1 -0
- package/dist/domain/application/access/index.d.ts +7 -0
- package/dist/domain/application/access/index.js +1 -0
- package/dist/domain/application/access/refresh-handler.d.ts +16 -0
- package/dist/domain/application/access/refresh-handler.js +1 -0
- package/dist/domain/application/access/signed-in-handler.d.ts +44 -0
- package/dist/domain/application/access/signed-in-handler.js +1 -0
- package/dist/domain/application/access/visitor-handler.d.ts +23 -0
- package/dist/domain/application/access/visitor-handler.js +1 -0
- package/dist/domain/application/application-config.d.ts +37 -1
- package/dist/domain/application/assistant/assistant-exposure.d.ts +22 -0
- package/dist/domain/application/assistant/assistant-exposure.js +1 -0
- package/dist/domain/application/assistant/assistant-selection.d.ts +30 -0
- package/dist/domain/application/assistant/assistant-selection.js +1 -0
- package/dist/domain/application/assistant/build-assistant-lenses.js +4 -4
- package/dist/domain/application/assistant/build-assistant-manifest.d.ts +2 -2
- package/dist/domain/application/assistant/build-assistant-manifest.js +1 -1
- package/dist/domain/application/assistant/generate-assistant-prompt.d.ts +18 -2
- package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
- package/dist/domain/application/assistant/index.d.ts +5 -1
- package/dist/domain/application/assistant/index.js +1 -1
- package/dist/domain/application/assistant/prepare-assistant-navigation-updates.d.ts +16 -0
- package/dist/domain/application/assistant/prepare-assistant-navigation-updates.js +1 -0
- package/dist/domain/application/assistant/read-assistant-navigation.d.ts +40 -0
- package/dist/domain/application/assistant/read-assistant-navigation.js +1 -0
- package/dist/domain/application/assistant/session-setup/apply-assistant-setup.js +1 -1
- package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.d.ts +30 -2
- package/dist/domain/application/assistant/session-setup/assistant-setup-manifest.js +1 -1
- package/dist/domain/application/assistant/session-setup/assistant-takes-images.d.ts +7 -0
- package/dist/domain/application/assistant/session-setup/assistant-takes-images.js +1 -0
- package/dist/domain/application/assistant/session-setup/index.d.ts +1 -0
- package/dist/domain/application/assistant/session-setup/index.js +1 -1
- package/dist/domain/application/assistant-field-options.d.ts +2 -0
- package/dist/domain/application/assistant-field-options.js +1 -1
- package/dist/domain/application/assistant-mutations.d.ts +17 -11
- package/dist/domain/application/assistant-mutations.js +1 -1
- package/dist/domain/application/assistant-recipe-groups.d.ts +4 -3
- package/dist/domain/application/assistant-recipe-groups.js +1 -1
- package/dist/domain/application/configurator-builder.d.ts +47 -37
- package/dist/domain/application/configurator-builder.js +1 -1
- package/dist/domain/application/index.d.ts +2 -1
- package/dist/domain/application/index.js +1 -1
- package/dist/domain/application/standard-properties.d.ts +1 -1
- package/dist/domain/application/standard-properties.js +1 -1
- package/dist/domain/available-system-components/available-system-components.d.ts +1 -1
- package/dist/domain/available-system-components/available-system-components.js +1 -1
- package/dist/domain/core/action/action.d.ts +0 -49
- package/dist/domain/core/action/index.d.ts +0 -1
- package/dist/domain/core/action/index.js +1 -1
- package/dist/domain/core/component/system-component-filter.d.ts +1 -0
- package/dist/domain/core/component/system-component-filter.js +1 -1
- package/dist/domain/core/component/view-state-component.d.ts +4 -3
- package/dist/domain/core/component/view-state-component.js +1 -1
- package/dist/domain/core/domain-factory.d.ts +8 -3
- package/dist/domain/core/domain-factory.js +1 -1
- package/dist/domain/core/fit-session-data.d.ts +16 -0
- package/dist/domain/core/fit-session-data.js +1 -0
- package/dist/domain/core/index.d.ts +1 -1
- package/dist/domain/core/index.js +1 -1
- package/dist/domain/core/invariant/control-violation-hints.d.ts +37 -0
- package/dist/domain/core/invariant/control-violation-hints.js +1 -0
- package/dist/domain/core/invariant/index.d.ts +1 -0
- package/dist/domain/core/invariant/index.js +1 -1
- package/dist/domain/domain-builder/domain-builder.d.ts +1 -6
- package/dist/domain/domain-builder/domain-builder.js +1 -1
- package/dist/domain/domain-context/domain-context-systems.d.ts +3 -5
- package/dist/domain/domain-context/index.d.ts +0 -1
- package/dist/domain/domain-context/index.js +1 -1
- package/dist/domain/domain-context/navigation-system/navigation-system.d.ts +2 -2
- package/dist/domain/domain-context/navigation-system/navigation-system.js +1 -1
- package/dist/domain/domain-context/transformers/when-builder.js +1 -1
- package/dist/domain/domain-runtime/domain-context/actions.d.ts +4 -0
- package/dist/domain/domain-runtime/domain-context/actions.js +1 -1
- package/dist/domain/domain-runtime/domain-context/domain-context.d.ts +9 -1
- package/dist/domain/domain-runtime/domain-context/domain-context.js +1 -1
- package/dist/domain/domain-runtime/domain-context/index.d.ts +0 -1
- package/dist/domain/domain-runtime/domain-context/selectors.d.ts +6 -4
- package/dist/domain/domain-runtime/domain-context/selectors.js +1 -1
- package/dist/domain/domain-runtime/domain-context/types.d.ts +8 -4
- package/dist/domain/domain-runtime/domain-runtime.d.ts +27 -13
- package/dist/domain/domain-runtime/domain-runtime.js +1 -1
- package/dist/domain/domain-runtime/environment/actions.d.ts +1 -0
- package/dist/domain/domain-runtime/environment/actions.js +1 -1
- package/dist/domain/domain-runtime/environment/initialize.js +1 -1
- package/dist/domain/domain-runtime/environment/selectors.d.ts +2 -0
- package/dist/domain/domain-runtime/environment/selectors.js +1 -1
- package/dist/domain/domain-runtime/environment/types.d.ts +6 -0
- package/dist/domain/domain-runtime/spec/index.d.ts +0 -1
- package/dist/domain/domain-runtime/spec/index.js +1 -1
- package/dist/domain/domain-runtime/spec/initialize.js +1 -1
- package/dist/domain/domain-runtime/spec/selectors.d.ts +2 -2
- package/dist/domain/domain-runtime/spec/types.d.ts +12 -10
- package/dist/domain/extensions/assistant/assistant-greeting.d.ts +30 -0
- package/dist/domain/extensions/assistant/assistant-greeting.js +1 -0
- package/dist/domain/extensions/assistant/index.d.ts +1 -0
- package/dist/domain/extensions/assistant/index.js +1 -0
- package/dist/domain/extensions/export-images/agent-screenshot.d.ts +5 -4
- package/dist/domain/extensions/export-images/agent-screenshot.js +1 -1
- package/dist/domain/extensions/index.d.ts +1 -1
- package/dist/domain/extensions/index.js +1 -1
- package/dist/domain/index.d.ts +1 -1
- package/dist/domain/index.js +1 -1
- package/dist/domain/mocks/create-mock-domain-runtime.d.ts +13 -6
- package/dist/domain/spec/expressions/relation-expression-params.d.ts +1 -1
- package/dist/domain/spec/modules/index.d.ts +0 -1
- package/dist/domain/spec/modules/index.js +1 -1
- package/dist/domain/spec/phx/phx-domain.d.ts +0 -1
- package/dist/domain/spec/phx/phx-domain.js +1 -1
- package/dist/domain/spec/runtime/application-spec-slice.d.ts +5 -5
- package/dist/domain/spec/runtime/application-spec-slice.js +1 -1
- package/dist/domain/spec/runtime/create-application.d.ts +5 -2
- package/dist/domain/spec/runtime/create-application.js +1 -1
- package/dist/domain/spec/runtime-spec/runtime-spec.d.ts +2 -2
- package/dist/domain/spec/sections/actions.d.ts +3 -2
- package/dist/domain/spec/sections/app-metadata.d.ts +13 -0
- package/dist/domain/spec/sections/assistant/assistant-features.d.ts +13 -0
- package/dist/domain/spec/sections/assistant/assistant-features.js +1 -0
- package/dist/domain/spec/sections/assistant/assistant-manifest.d.ts +35 -2
- package/dist/domain/spec/sections/assistant/assistant-navigation.d.ts +21 -0
- package/dist/domain/spec/sections/assistant/assistant-navigation.js +1 -0
- package/dist/domain/spec/sections/assistant/assistant-resolved-manifest.d.ts +55 -13
- package/dist/domain/spec/sections/assistant/assistant-select.d.ts +12 -0
- package/dist/domain/spec/sections/assistant/assistant-select.js +1 -0
- package/dist/domain/spec/sections/assistant/form/assistant-form-elements.d.ts +10 -26
- package/dist/domain/spec/sections/assistant/form/assistant-form-elements.js +1 -1
- package/dist/domain/spec/sections/assistant/index.d.ts +5 -2
- package/dist/domain/system-components/index.d.ts +1 -0
- package/dist/domain/system-components/index.js +1 -1
- package/dist/domain/system-components/navigation/index.d.ts +1 -0
- package/dist/domain/system-components/navigation/index.js +1 -0
- package/dist/domain/system-components/navigation/view-controls.d.ts +24 -0
- package/dist/domain/system-components/navigation/view-controls.js +1 -0
- package/dist/editor/Editor.d.ts +5 -0
- package/dist/editor/Editor.js +1 -1
- package/dist/editor/EditorMode.d.ts +2 -0
- package/dist/editor/EditorMode.js +1 -1
- package/dist/editor/agent-mode/AgentModeBridge.d.ts +10 -0
- package/dist/editor/agent-mode/AgentModeBridge.js +1 -0
- package/dist/editor/agent-mode/agent-at-work-fonts.d.ts +2 -0
- package/dist/editor/agent-mode/agent-at-work-fonts.js +1 -0
- package/dist/editor/console-reporter/BrowserConsoleReporter.js +1 -1
- package/dist/editor/console-reporter/console-capture.d.ts +20 -0
- package/dist/editor/console-reporter/console-capture.js +1 -0
- package/dist/editor/domain-editors/DomainSpecContext.js +1 -1
- package/dist/editor/domain-editors/apply-spec-update.js +1 -1
- package/dist/editor/domain-editors/use-implementation-files.d.ts +4 -3
- package/dist/editor/domain-editors/use-implementation-files.js +1 -1
- package/dist/editor/index.d.ts +1 -0
- package/dist/editor/index.js +1 -1
- package/dist/editor/variants/VariantAnswerFooter.d.ts +8 -1
- package/dist/editor/variants/VariantAnswerFooter.js +1 -1
- package/dist/editor/variants/VariantPageUnavailable.d.ts +5 -0
- package/dist/editor/variants/VariantPageUnavailable.js +1 -0
- package/dist/editor/variants/VariantPreviewHandler.js +1 -1
- package/dist/editor/variants/variant-preview-fonts.d.ts +2 -0
- package/dist/editor/variants/variant-preview-fonts.js +1 -0
- package/dist/editor/variants/variant-preview-styles.d.ts +40 -48
- package/dist/editor/variants/variant-preview-styles.js +493 -1
- package/dist/extras/clerk/index.d.ts +6 -0
- package/dist/extras/cognito/AccountAvatar.d.ts +7 -0
- package/dist/extras/cognito/AccountAvatar.js +1 -0
- package/dist/extras/cognito/AccountControl.d.ts +13 -0
- package/dist/extras/cognito/AccountControl.js +1 -0
- package/dist/extras/cognito/AdminSignInPage.d.ts +26 -0
- package/dist/extras/cognito/AdminSignInPage.js +1 -0
- package/dist/extras/cognito/CognitoSignInPage.d.ts +8 -0
- package/dist/extras/cognito/CognitoSignInPage.js +1 -0
- package/dist/extras/cognito/ConfiguratorSignInPage.d.ts +19 -0
- package/dist/extras/cognito/ConfiguratorSignInPage.js +1 -0
- package/dist/extras/cognito/SignInFailurePage.d.ts +11 -0
- package/dist/extras/cognito/SignInFailurePage.js +1 -0
- package/dist/extras/cognito/SignInGateLayout.d.ts +25 -0
- package/dist/extras/cognito/SignInGateLayout.js +1 -0
- package/dist/extras/cognito/SignInNotice.d.ts +8 -0
- package/dist/extras/cognito/SignInNotice.js +1 -0
- package/dist/extras/cognito/index.d.ts +5 -0
- package/dist/extras/cognito/index.js +1 -0
- package/dist/globals/index.d.ts +5 -0
- 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/deployment-cli/commands/create-environment.js +1 -1
- package/dist/legacy/deployment-cli/commands/list-environments.js +1 -1
- package/dist/legacy/deployment-cli/commands/register-deployment.js +1 -1
- package/dist/legacy/domain-cli/gen/configurator-builder.js +5 -4
- 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 +25 -3
- package/dist/legacy/phoenix-cli/commands/prepare-deployment-command.js +1 -1
- package/dist/legacy/phoenix-cli/commands/prepare-local-environment-command.js +1 -1
- package/dist/legacy/phoenix-cli/services/prepare-development-environment.js +1 -1
- package/dist/legacy/phoenix-cli/services/webhook-service/transport.js +1 -1
- package/dist/legacy/webhook-cli/lib/webhook-boundary.js +1 -1
- package/dist/phoenix/application-spec/application-spec-builder.d.ts +2 -2
- package/dist/phoenix/application-spec/application-spec-builder.js +1 -1
- package/dist/phoenix/application-spec/generate-application-spec-project.d.ts +2 -1
- package/dist/phoenix/application-spec/generate-application-spec-project.js +2 -2
- package/dist/phoenix/application-spec/generate-project-files.d.ts +4 -3
- package/dist/phoenix/application-spec/generate-project-files.js +1 -1
- package/dist/phoenix/application-spec/index.d.ts +2 -1
- package/dist/phoenix/application-spec/index.js +1 -1
- package/dist/phoenix/application-spec/read-spec-project.d.ts +1 -2
- package/dist/phoenix/application-spec/read-spec-project.js +1 -1
- package/dist/phoenix/application-spec/resolve-deployment-data.d.ts +10 -2
- package/dist/phoenix/application-spec/resolve-deployment-data.js +2 -2
- package/dist/phoenix/cli.js +1 -1
- package/dist/phoenix/commands/account/index.d.ts +1 -0
- package/dist/phoenix/commands/account/index.js +1 -0
- package/dist/phoenix/commands/account/whoami.d.ts +10 -0
- package/dist/phoenix/commands/account/whoami.js +4 -0
- package/dist/phoenix/commands/build.d.ts +2 -1
- package/dist/phoenix/commands/build.js +1 -1
- package/dist/phoenix/commands/clean.d.ts +2 -1
- package/dist/phoenix/commands/clean.js +1 -1
- package/dist/phoenix/commands/cleanup-environment.js +1 -1
- package/dist/phoenix/commands/deploy.d.ts +7 -2
- package/dist/phoenix/commands/deploy.js +9 -3
- package/dist/phoenix/commands/deployment-build-envs-command.js +1 -1
- package/dist/phoenix/commands/deps/deps.js +2 -2
- package/dist/phoenix/commands/dev.d.ts +2 -1
- package/dist/phoenix/commands/dev.js +4 -4
- package/dist/phoenix/commands/feedback.d.ts +2 -2
- package/dist/phoenix/commands/feedback.js +1 -1
- package/dist/phoenix/commands/finish-deployment-command.js +1 -1
- package/dist/phoenix/commands/index.d.ts +1 -0
- package/dist/phoenix/commands/index.js +1 -1
- package/dist/phoenix/commands/init-starter-spec.js +3 -4
- package/dist/phoenix/commands/init.d.ts +2 -2
- package/dist/phoenix/commands/init.js +1 -1
- package/dist/phoenix/commands/login.d.ts +6 -3
- package/dist/phoenix/commands/login.js +3 -3
- package/dist/phoenix/commands/logout.js +1 -1
- package/dist/phoenix/commands/prepare-deployment-command.js +2 -2
- package/dist/phoenix/commands/prepare-local-environment-command.js +1 -1
- package/dist/phoenix/commands/sync.d.ts +2 -1
- package/dist/phoenix/commands/sync.js +1 -1
- package/dist/phoenix/services/application-spec-project-watcher.d.ts +3 -1
- package/dist/phoenix/services/application-spec-project-watcher.js +2 -2
- package/dist/phoenix/services/cli-credentials.d.ts +26 -7
- package/dist/phoenix/services/cli-credentials.js +2 -2
- package/dist/phoenix/services/cli-server/describe-saved-logins.d.ts +5 -0
- package/dist/phoenix/services/cli-server/describe-saved-logins.js +1 -0
- package/dist/phoenix/services/cli-server/index.d.ts +2 -0
- package/dist/phoenix/services/cli-server/index.js +1 -0
- package/dist/phoenix/services/cli-server/resolve-cli-server-url.d.ts +19 -0
- package/dist/phoenix/services/cli-server/resolve-cli-server-url.js +1 -0
- package/dist/phoenix/services/dev-experience/dev-experience.d.ts +31 -0
- package/dist/phoenix/services/dev-experience/dev-experience.js +1 -0
- package/dist/phoenix/services/dev-experience/index.d.ts +3 -0
- package/dist/phoenix/services/dev-experience/index.js +1 -0
- package/dist/phoenix/services/dev-experience/read-explicit-editor-setting.d.ts +7 -0
- package/dist/phoenix/services/dev-experience/read-explicit-editor-setting.js +1 -0
- package/dist/phoenix/services/dev-experience/regenerated-page-experience.d.ts +24 -0
- package/dist/phoenix/services/dev-experience/regenerated-page-experience.js +1 -0
- package/dist/phoenix/services/development-credential.js +1 -1
- package/dist/phoenix/services/frontend-config.d.ts +2 -0
- package/dist/phoenix/services/index.d.ts +6 -3
- package/dist/phoenix/services/index.js +1 -1
- package/dist/phoenix/services/phoenix-pubsub.d.ts +4 -0
- package/dist/phoenix/services/phoenix-regions.d.ts +6 -1
- package/dist/phoenix/services/phoenix-regions.js +1 -1
- package/dist/phoenix/services/prepare-development-environment.js +2 -2
- package/dist/phoenix/services/session/phoenix-application.d.ts +2 -1
- package/dist/phoenix/services/session/phoenix-application.js +2 -2
- package/dist/phoenix/services/signed-in-development-environment.d.ts +15 -4
- package/dist/phoenix/services/signed-in-development-environment.js +1 -1
- package/dist/phoenix/services/spec-project/describe-workspace-projects.d.ts +11 -0
- package/dist/phoenix/services/spec-project/describe-workspace-projects.js +1 -0
- package/dist/phoenix/services/spec-project/index.d.ts +3 -0
- package/dist/phoenix/services/spec-project/index.js +1 -0
- package/dist/phoenix/services/spec-project/resolve-deploy-target.d.ts +47 -0
- package/dist/phoenix/services/spec-project/resolve-deploy-target.js +1 -0
- package/dist/phoenix/services/spec-project/resolve-target-project.d.ts +34 -0
- package/dist/phoenix/services/spec-project/resolve-target-project.js +2 -0
- package/dist/phoenix/services/spec-project/write-spec-project.d.ts +7 -0
- package/dist/phoenix/services/spec-project/write-spec-project.js +1 -0
- package/dist/phoenix/services/telemetry/telemetry-event.js +1 -1
- package/dist/phoenix/services/telemetry/telemetry-state.d.ts +1 -1
- package/dist/phoenix/services/telemetry/telemetry-state.js +1 -1
- package/dist/phoenix/services/variant-file-session.js +1 -1
- package/dist/phoenix/services/vite-config.d.ts +2 -1
- package/dist/phoenix/services/vite-config.js +1 -1
- package/dist/phoenix/services/webhook-service/transport.js +1 -1
- package/dist/react-sdk/application-runtime/common-services/index.d.ts +1 -0
- package/dist/react-sdk/application-runtime/common-services/index.js +1 -1
- package/dist/react-sdk/application-runtime/common-services/selectors.d.ts +2 -0
- package/dist/react-sdk/application-runtime/common-services/selectors.js +1 -1
- package/dist/react-sdk/application-runtime/common-services/webmcp/index.d.ts +3 -0
- package/dist/react-sdk/application-runtime/common-services/webmcp/index.js +1 -0
- package/dist/react-sdk/application-runtime/common-services/webmcp/webmcp-host.d.ts +35 -0
- package/dist/react-sdk/application-runtime/common-services/webmcp/webmcp-host.js +1 -0
- package/dist/react-sdk/application-runtime/common-services/webmcp/webmcp-model-context.d.ts +44 -0
- package/dist/react-sdk/application-runtime/common-services/webmcp/webmcp-model-context.js +1 -0
- package/dist/react-sdk/application-runtime/common-services/webmcp/webmcp-tool-result.d.ts +24 -0
- package/dist/react-sdk/application-runtime/common-services/webmcp/webmcp-tool-result.js +1 -0
- package/dist/react-sdk/application-runtime/domain-application-context/application-runtime-extension.d.ts +7 -1
- package/dist/react-sdk/application-runtime/domain-application-context/application-runtime-extension.js +1 -1
- package/dist/react-sdk/application-runtime/domain-application-context/configuration-persist-system.d.ts +6 -0
- package/dist/react-sdk/application-runtime/domain-application-context/configuration-persist-system.js +1 -1
- package/dist/react-sdk/application-runtime/domain-application-context/domain-application-systems.d.ts +2 -2
- package/dist/react-sdk/application-runtime/domain-application-context/selectors.d.ts +1 -3
- package/dist/react-sdk/application-runtime/domain-application-context/selectors.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/index.d.ts +1 -0
- package/dist/react-sdk/application-runtime/hooks/index.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-application.d.ts +2 -0
- package/dist/react-sdk/application-runtime/hooks/responsive/use-responsive-store.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/use-environment.d.ts +7 -0
- package/dist/react-sdk/application-runtime/hooks/use-environment.js +1 -1
- package/dist/react-sdk/application-runtime/hooks/use-spec.d.ts +1 -1
- package/dist/react-sdk/application-runtime/hooks/use-webmcp-host.d.ts +7 -0
- package/dist/react-sdk/application-runtime/hooks/use-webmcp-host.js +1 -0
- package/dist/react-sdk/application-runtime/host-properties/selectors.d.ts +2 -2
- package/dist/react-sdk/application-runtime/integration/integration-mode.d.ts +30 -0
- package/dist/react-sdk/application-runtime/integration/integration-mode.js +1 -1
- package/dist/react-sdk/application-runtime/mocks/create-mock-application-runtime.js +1 -1
- package/dist/react-sdk/application-runtime/responsive/actions.d.ts +6 -0
- package/dist/react-sdk/application-runtime/responsive/actions.js +1 -1
- package/dist/react-sdk/application-runtime/responsive/initialize.js +1 -1
- package/dist/react-sdk/application-runtime/responsive/selectors.js +1 -1
- package/dist/react-sdk/application-runtime/responsive/types.d.ts +9 -0
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.d.ts +48 -18
- package/dist/react-sdk/application-runtime/runtime/create-application-runtime.js +1 -1
- package/dist/react-sdk/application-runtime/session/actions.d.ts +2 -1
- package/dist/react-sdk/application-runtime/session/actions.js +1 -1
- package/dist/react-sdk/application-runtime/session/initialize.js +1 -1
- package/dist/react-sdk/application-runtime/session/selectors.d.ts +2 -0
- package/dist/react-sdk/application-runtime/session/selectors.js +1 -1
- package/dist/react-sdk/application-runtime/session/session-service.d.ts +34 -1
- package/dist/react-sdk/application-runtime/session/session-service.js +1 -1
- package/dist/react-sdk/application-runtime/session/session-token.d.ts +8 -0
- package/dist/react-sdk/application-runtime/session/session-token.js +1 -1
- package/dist/react-sdk/application-runtime/session/types.d.ts +6 -1
- package/dist/react-sdk/domain-context/common-hooks/use-domain-context.d.ts +3 -2
- package/dist/react-sdk/domain-context/common-hooks/use-state-validity.d.ts +1 -1
- package/dist/react-sdk/domain-context/common-hooks/use-state-validity.js +1 -1
- package/dist/react-sdk/domain-context/index.d.ts +3 -2
- package/dist/react-sdk/domain-context/index.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/generate-share-link-hooks.d.ts +1 -5
- package/dist/react-sdk/domain-context/system-hooks/generate-share-link-hooks.js +1 -1
- package/dist/react-sdk/domain-context/system-hooks/generate-share-link.d.ts +25 -0
- package/dist/react-sdk/domain-context/system-hooks/generate-share-link.js +1 -0
- package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.d.ts +5 -3
- package/dist/react-sdk/domain-context/system-hooks/navigation-hooks.js +1 -1
- package/dist/react-sdk/preset-selection/PresetSelectionProvider.d.ts +11 -0
- package/dist/react-sdk/preset-selection/PresetSelectionProvider.js +1 -1
- package/dist/react-sdk/preset-selection/PresetWebMcpTools.d.ts +14 -0
- package/dist/react-sdk/preset-selection/PresetWebMcpTools.js +1 -0
- package/dist/react-sdk/preset-selection/index.d.ts +2 -1
- package/dist/react-sdk/preset-selection/index.js +1 -1
- package/dist/react-sdk/preset-selection/register-preset-webmcp-tools.d.ts +31 -0
- package/dist/react-sdk/preset-selection/register-preset-webmcp-tools.js +1 -0
- package/dist/react-sdk/session/AccessDeniedAdminPage.d.ts +13 -0
- package/dist/react-sdk/session/AccessDeniedAdminPage.js +1 -0
- package/dist/react-sdk/session/AccessDeniedPage.d.ts +20 -0
- package/dist/react-sdk/session/AccessDeniedPage.js +1 -0
- package/dist/react-sdk/session/ConfiguratorUnavailablePage.d.ts +5 -0
- package/dist/react-sdk/session/ConfiguratorUnavailablePage.js +1 -0
- package/dist/react-sdk/session/SessionServiceProvider.d.ts +5 -0
- package/dist/react-sdk/session/SessionServiceProvider.js +1 -1
- package/dist/react-sdk/session/index.d.ts +3 -0
- package/dist/react-sdk/session/index.js +1 -1
- package/dist/react-sdk/session/sign-in-address.d.ts +13 -0
- package/dist/react-sdk/session/sign-in-address.js +1 -0
- package/dist/react-sdk/session/studio-frame.d.ts +7 -0
- package/dist/react-sdk/session/studio-frame.js +1 -0
- package/dist/react-sdk/session/use-sign-in.d.ts +50 -0
- package/dist/react-sdk/session/use-sign-in.js +1 -0
- package/dist/ui-sdk/components/preview/Preview.d.ts +12 -4
- package/dist/ui-sdk/components/preview/Preview.js +2 -2
- package/dist/ui-sdk/components/snackbar/Snackbar.d.ts +3 -2
- package/dist/ui-sdk/components/snackbar/Snackbar.js +1 -1
- package/dist/ui-sdk/components/toolbar/desktop-toolbar/ToolbarPopper.d.ts +2 -0
- package/dist/ui-sdk/components/toolbar/desktop-toolbar/ToolbarPopper.js +1 -1
- package/dist/ui-sdk/components/view-controls/ViewControlsContext.d.ts +3 -1
- package/dist/ui-sdk/components/view-controls/ViewControlsItem.js +1 -1
- package/dist/ui-sdk/components/view-controls/ViewControlsRoot.d.ts +6 -1
- package/dist/ui-sdk/components/view-controls/ViewControlsRoot.js +1 -1
- package/dist/ui-sdk/icons/__generated/Microphone.d.ts +3 -0
- package/dist/ui-sdk/icons/__generated/Microphone.js +1 -0
- package/dist/ui-sdk/icons/__generated/MicrophoneSlash.d.ts +3 -0
- package/dist/ui-sdk/icons/__generated/MicrophoneSlash.js +1 -0
- package/dist/ui-sdk/icons/__generated/SpeakerHigh.d.ts +3 -0
- package/dist/ui-sdk/icons/__generated/SpeakerHigh.js +1 -0
- package/dist/ui-sdk/icons/__generated/SpeakerSlash.d.ts +3 -0
- package/dist/ui-sdk/icons/__generated/SpeakerSlash.js +1 -0
- package/dist/ui-sdk/icons/__generated/Stop.d.ts +3 -0
- package/dist/ui-sdk/icons/__generated/Stop.js +1 -0
- package/dist/ui-sdk/icons/__generated/index.d.ts +10 -0
- package/dist/ui-sdk/icons/__generated/index.js +1 -1
- package/dist/ui-sdk/icons/icons-registry.js +1 -1
- package/dist/ui-sdk/theme/types.d.ts +0 -4
- package/dist/webhook/builders/auth-handler-builder.d.ts +24 -1
- package/dist/webhook/builders/auth-handler-builder.js +1 -1
- package/dist/webhook/builders/common.d.ts +14 -3
- package/dist/webhook/builders/webhook-builder.d.ts +18 -0
- package/dist/webhook/builders/webhook-builder.js +1 -1
- package/package.json +11 -4
- package/schema/domain-spec.json +444 -65
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks.d.ts +0 -2
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks.js +0 -1
- package/dist/application-spec/generate-application/code/templates/skills/processes/specification/ux-guidelines.d.ts +0 -2
- package/dist/application-spec/generate-application/code/templates/skills/processes/specification/ux-guidelines.js +0 -25
- package/dist/configurator/ui/assistant/annotation/annotation-host-context.d.ts +0 -5
- package/dist/configurator/ui/assistant/annotation/annotation-host-context.js +0 -1
- package/dist/configurator/ui/assistant/annotation/use-end-on-unmount.js +0 -1
- package/dist/configurator/ui/assistant/form-elements/FormCard.d.ts +0 -9
- package/dist/configurator/ui/assistant/form-elements/FormCard.js +0 -1
- package/dist/configurator/ui/assistant/form-elements/FormSwatch.d.ts +0 -10
- package/dist/configurator/ui/assistant/form-elements/FormSwatch.js +0 -1
- package/dist/configurator/ui/assistant/theme.d.ts +0 -2
- package/dist/configurator/ui/assistant/theme.js +0 -1
- package/dist/configurator/ui/configurator-layout/universal/ExportingOverlay.js +0 -1
- package/dist/domain/core/action/action-factory.d.ts +0 -11
- package/dist/domain/domain-context/action-system/action-system.d.ts +0 -38
- package/dist/domain/domain-context/action-system/action-system.js +0 -1
- package/dist/domain/domain-context/action-system/index.d.ts +0 -1
- package/dist/domain/domain-context/action-system/index.js +0 -1
- package/dist/domain/domain-runtime/domain-context/action-context.d.ts +0 -11
- package/dist/domain/extensions/view-controls.d.ts +0 -25
- package/dist/domain/extensions/view-controls.js +0 -1
- package/dist/domain/spec/modules/resolve-action-modules.js +0 -1
- /package/dist/{domain/domain-runtime/domain-context/action-context.js → application-spec/parse-application-files/access/analyzed-file.js} +0 -0
- /package/dist/{domain/core/action → configurator/application-runtime/extensions/systems/action-system}/action-factory.js +0 -0
|
@@ -3,9 +3,13 @@ import { type UIMessage } from '@tanstack/ai-client';
|
|
|
3
3
|
import { type ObservableWithLastValue } from '@salsita-ai/common/utils';
|
|
4
4
|
import { type AssistantMessageAnnotation } from '@salsita-ai/contracts/assistant';
|
|
5
5
|
import { type AuthorizedPhoenixApiClient } from '#package/client';
|
|
6
|
-
import type
|
|
6
|
+
import { type AssistantManifest, type DomainContextSelectors, type DomainServicesSelectors, type InitializableSystem, type SessionAssistantSetup } from '#package/domain';
|
|
7
|
+
import { type WebMcpHost } from '#package/react-sdk';
|
|
7
8
|
import type { ConfiguratorExtensionSelectors } from '../../selectors.js';
|
|
8
|
-
import type {
|
|
9
|
+
import type { AssistantAnnotationOverlay } from './assistant-annotation.js';
|
|
10
|
+
import type { AssistantImageView } from './assistant-image-view.js';
|
|
11
|
+
import { type AssistantPlayback } from './assistant-speech-player.js';
|
|
12
|
+
import { type AssistantAttachment, type AssistantDraftAttachment } from './composer-attachments.js';
|
|
9
13
|
/** A tool of the assistant that the model calls and the browser runs, as the chat client accepts it. */
|
|
10
14
|
export type AssistantClientTool = AnyClientTool;
|
|
11
15
|
/**
|
|
@@ -22,14 +26,44 @@ export interface AssistantSystemContext {
|
|
|
22
26
|
/** The assistant the initialized session runs: its tools, its exposed fields and whether chat runs at all. */
|
|
23
27
|
readonly getAssistantSetup: () => SessionAssistantSetup;
|
|
24
28
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* so a test can provide one that takes none.
|
|
29
|
+
* Creates the one audio element the replies are read aloud through, the first time one is. A browser-bound step
|
|
30
|
+
* the system takes, so a test can provide an element that plays nothing.
|
|
28
31
|
*/
|
|
29
|
-
readonly
|
|
32
|
+
readonly createAudio: () => HTMLAudioElement;
|
|
33
|
+
/**
|
|
34
|
+
* The application's WebMCP host: its model context is the browser's entry point, through which the
|
|
35
|
+
* system offers its tools to the agents in the visitor's browser (`null` where there is none, which
|
|
36
|
+
* leaves them unregistered), and each load tells it how its tools settled.
|
|
37
|
+
*/
|
|
38
|
+
readonly getWebMcpHost: () => WebMcpHost;
|
|
39
|
+
/** The domain-application slice, whose persist system saves the configuration before a share link is generated. */
|
|
40
|
+
readonly domainApplicationContextSelectors: {
|
|
41
|
+
readonly getConfigurationPersistSystem: () => {
|
|
42
|
+
readonly save: () => Promise<string>;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
30
45
|
}
|
|
31
|
-
/**
|
|
32
|
-
|
|
46
|
+
/**
|
|
47
|
+
* What the user annotates; see {@link AssistantSystem.annotate}:
|
|
48
|
+
*
|
|
49
|
+
* - `view` — their current view of the configurator.
|
|
50
|
+
* - `image` — an image, such as one of the thread.
|
|
51
|
+
* - `attachment` — an image attached to the message being written, by its id in `composerAttachments$`; the
|
|
52
|
+
* annotation takes its place.
|
|
53
|
+
*
|
|
54
|
+
* `background` is a CSS colour behind the image and in the margins around it, such as the theme's background.
|
|
55
|
+
*/
|
|
56
|
+
export type AssistantAnnotationTarget = {
|
|
57
|
+
readonly type: 'view';
|
|
58
|
+
} | {
|
|
59
|
+
readonly type: 'image';
|
|
60
|
+
readonly image: Blob;
|
|
61
|
+
readonly background: string;
|
|
62
|
+
} | {
|
|
63
|
+
readonly type: 'attachment';
|
|
64
|
+
readonly attachmentId: string;
|
|
65
|
+
readonly background: string;
|
|
66
|
+
};
|
|
33
67
|
/**
|
|
34
68
|
* The conversation with the assistant as the panel paints it. One value is published per change, so
|
|
35
69
|
* it changes with every chunk of a streaming reply.
|
|
@@ -52,16 +86,33 @@ export interface AssistantChatSnapshot {
|
|
|
52
86
|
* limits. Nothing when that request carried none.
|
|
53
87
|
*/
|
|
54
88
|
readonly retryAfterSeconds: number | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* How the run of the reply failed, when it did: `busy` when the AI service behind the assistant was busy, `other`
|
|
91
|
+
* for any other failure. Set from the failed run's error code on a live reply, and from the thread read when the
|
|
92
|
+
* thread's newest run failed; nothing once a chat request was answered again, and for a failure that is not a failed
|
|
93
|
+
* run (a refusal, a dropped connection, an image upload or a compaction that failed), which also clears it. A failed run's reply is regenerated by {@link AssistantSystem.regenerate}.
|
|
94
|
+
*/
|
|
95
|
+
readonly runFailed: 'busy' | 'other' | undefined;
|
|
55
96
|
/** False when the server said this session may read the thread but not add to it. */
|
|
56
97
|
readonly isContinuable: boolean;
|
|
57
98
|
/**
|
|
58
|
-
* True when the server said
|
|
59
|
-
* on a message it refused for it. The thread stays readable, but the server refuses every new message until the
|
|
60
|
-
*
|
|
99
|
+
* True when the server said a lock counted from the assistant's bans refuses the user here: on the thread read, or
|
|
100
|
+
* on a message it refused for it. The thread stays readable, but the server refuses every new message until the
|
|
101
|
+
* lock ends.
|
|
61
102
|
*/
|
|
62
103
|
readonly isLocked: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* True when that lock is one of the user's network address, which other users there share, and not one of the user:
|
|
106
|
+
* it ends on its own, sooner than a ban.
|
|
107
|
+
*/
|
|
108
|
+
readonly isNetworkLocked: boolean;
|
|
63
109
|
/** False until the first request of the chat, the thread read, was answered or failed. */
|
|
64
110
|
readonly isLoaded: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* True when the server said, on the thread read, that this session may send voice messages: the
|
|
113
|
+
* deployment's `assistant.ai.voice`, as the project's setup handler left it for the session.
|
|
114
|
+
*/
|
|
115
|
+
readonly isVoiceEnabled: boolean;
|
|
65
116
|
/**
|
|
66
117
|
* True while a thread this session may not continue is being continued in a new one, which the
|
|
67
118
|
* user's next message starts; see {@link AssistantSystem.resume}.
|
|
@@ -100,6 +151,12 @@ export interface AssistantSendOptions {
|
|
|
100
151
|
* could not be uploaded into the new thread. The caller gets it back, so it can be sent again.
|
|
101
152
|
*/
|
|
102
153
|
readonly onUnsent?: () => void;
|
|
154
|
+
/**
|
|
155
|
+
* A recording the user spoke, sent as the message in place of text: the server transcribes it and
|
|
156
|
+
* the chat shows the transcript once it arrives. The text is empty then. A voice message the server
|
|
157
|
+
* refuses is taken out of the chat and given back through `onUnsent`, unless nothing was heard in it.
|
|
158
|
+
*/
|
|
159
|
+
readonly audio?: Blob;
|
|
103
160
|
}
|
|
104
161
|
/** A closed thread of the conversation as the panel paints it above the thread that continues it. */
|
|
105
162
|
export interface AssistantEarlierThreadSnapshot {
|
|
@@ -135,6 +192,10 @@ export declare class AssistantSystem implements InitializableSystem {
|
|
|
135
192
|
private readonly _chat;
|
|
136
193
|
private readonly _panel;
|
|
137
194
|
private readonly _annotationOverlay;
|
|
195
|
+
private readonly _imageView;
|
|
196
|
+
private readonly _composerAttachments;
|
|
197
|
+
/** Releases the layout's inert hold, taken while there is an annotation overlay; nothing otherwise. */
|
|
198
|
+
private _releaseInert;
|
|
138
199
|
/** Identity of the `annotate()` call that runs; a new configuration load forgets it, which cancels it. */
|
|
139
200
|
private _annotationRun;
|
|
140
201
|
/** Identity of the current `activate()` call; nothing while the chat is not active. */
|
|
@@ -182,21 +243,56 @@ export declare class AssistantSystem implements InitializableSystem {
|
|
|
182
243
|
* each is read once and kept while the configuration stays loaded.
|
|
183
244
|
*/
|
|
184
245
|
private _screenshotUrls;
|
|
246
|
+
private readonly _player;
|
|
247
|
+
/**
|
|
248
|
+
* The chat whose reply answers a voice message, which reads it aloud once it has ended; see `send`. Nothing when
|
|
249
|
+
* the latest message was typed.
|
|
250
|
+
*/
|
|
251
|
+
private _voiceReplyChat;
|
|
252
|
+
private readonly _toolDependencies;
|
|
253
|
+
/** Aborting it unregisters the WebMCP tools of the current load; nothing while none are registered. */
|
|
254
|
+
private _webMcpRegistration;
|
|
255
|
+
/** The session manifest the WebMCP tools were last settled for, registered or not. */
|
|
256
|
+
private _webMcpManifest;
|
|
185
257
|
constructor(_context: AssistantSystemContext);
|
|
186
258
|
/** The conversation. It never completes, and holds the empty chat whenever no chat is active. */
|
|
187
259
|
readonly chat$: ObservableWithLastValue<AssistantChatSnapshot>;
|
|
188
260
|
/** The state of the built-in panel. It never completes. */
|
|
189
261
|
readonly panel$: ObservableWithLastValue<AssistantPanelSnapshot>;
|
|
190
262
|
/**
|
|
191
|
-
* What covers the configurator for an annotation, as the
|
|
263
|
+
* What covers the configurator for an annotation, as the configurator page renders it; nothing while no
|
|
192
264
|
* annotation is made or shown. See {@link AssistantSystem.annotate}. It never completes.
|
|
193
265
|
*/
|
|
194
266
|
readonly annotationOverlay$: ObservableWithLastValue<AssistantAnnotationOverlay | null>;
|
|
267
|
+
/**
|
|
268
|
+
* The image of the chat the configurator page shows larger, beside the panel: a drawing of a reply,
|
|
269
|
+
* a project image of a reply or an image of a sent message; nothing while none is open. See
|
|
270
|
+
* {@link AssistantSystem.viewImage}. It never completes.
|
|
271
|
+
*/
|
|
272
|
+
readonly imageView$: ObservableWithLastValue<AssistantImageView | null>;
|
|
273
|
+
/**
|
|
274
|
+
* The images and annotations attached to the message being written, in their order, as the composer
|
|
275
|
+
* shows and sends them. They outlive the composer: an annotation finished after it went away is
|
|
276
|
+
* still attached when it comes back. A new configuration load takes them off. It never completes.
|
|
277
|
+
*/
|
|
278
|
+
readonly composerAttachments$: ObservableWithLastValue<ReadonlyArray<AssistantDraftAttachment>>;
|
|
279
|
+
/**
|
|
280
|
+
* Whether one more image or annotation fits in the message being written, up to 4 together, counting
|
|
281
|
+
* the images being prepared and the annotation being made. It never completes.
|
|
282
|
+
*/
|
|
283
|
+
readonly hasFreeAttachmentSlot$: ObservableWithLastValue<boolean>;
|
|
195
284
|
/**
|
|
196
285
|
* The `apply` tool call whose committed state is the step of the undo history the configuration is
|
|
197
286
|
* at; nothing when that step is not a change of the assistant. It never completes.
|
|
198
287
|
*/
|
|
199
288
|
readonly undoTipToolCallId$: ObservableWithLastValue<string | undefined>;
|
|
289
|
+
/** The reply being read aloud, and what its reading is doing. It never completes. */
|
|
290
|
+
readonly playback$: ObservableWithLastValue<AssistantPlayback>;
|
|
291
|
+
/**
|
|
292
|
+
* True when the user muted the replies that read themselves aloud after a voice message; the browser remembers it.
|
|
293
|
+
* The play buttons work either way. It never completes.
|
|
294
|
+
*/
|
|
295
|
+
readonly muted$: ObservableWithLastValue<boolean>;
|
|
200
296
|
/**
|
|
201
297
|
* The manifest the initialized session runs, narrowed by the project's setup handler: what the
|
|
202
298
|
* agent can read, so the panel reads recipes and options the way the agent does. `null` while the
|
|
@@ -284,23 +380,62 @@ export declare class AssistantSystem implements InitializableSystem {
|
|
|
284
380
|
*
|
|
285
381
|
* It never rejects: a message the client could not send is reported as the error of the chat.
|
|
286
382
|
*/
|
|
287
|
-
send: (content: string, attachments?: ReadonlyArray<AssistantAttachment>, { onSent, onUnsent }?: AssistantSendOptions) => Promise<void>;
|
|
383
|
+
send: (content: string, attachments?: ReadonlyArray<AssistantAttachment>, { onSent, onUnsent, audio }?: AssistantSendOptions) => Promise<void>;
|
|
288
384
|
/**
|
|
289
|
-
* Lets the user annotate their current view of the configurator,
|
|
290
|
-
*
|
|
291
|
-
*
|
|
385
|
+
* Lets the user annotate their current view of the configurator, or an image, and attaches what
|
|
386
|
+
* they made to the message being written (see `composerAttachments$`). Resolves with the id of the
|
|
387
|
+
* attachment, or with `null` when they cancel, the view cannot be frozen or the image drawn, or another
|
|
388
|
+
* configuration is loaded meanwhile. While the message is full, or another annotation is made or
|
|
389
|
+
* shown, nothing happens: it resolves with `null` at once. The annotation holds a slot of the
|
|
390
|
+
* message from the start, so nothing attached meanwhile can push it over the limit.
|
|
391
|
+
*
|
|
392
|
+
* With an `attachment` target, the user annotates that image of the message instead, and the annotation
|
|
393
|
+
* takes its place, at its position, so it needs no free slot. Nothing happens, and it resolves with
|
|
394
|
+
* `null`, when that attachment is not attached or is already an annotation; also when it is taken off
|
|
395
|
+
* while the user annotates it.
|
|
292
396
|
*
|
|
293
|
-
* The
|
|
294
|
-
* is still, the view glides from the canvas padding to none, so the product is
|
|
295
|
-
* configurator area, and the next frame is frozen for the editor
|
|
296
|
-
* view glides back to the padding
|
|
397
|
+
* The configurator is inert from the start, and `annotationOverlay$` says what covers it. For the
|
|
398
|
+
* view, once the camera is still, the view glides from the canvas padding to none, so the product is
|
|
399
|
+
* centred on the whole configurator area, and the next frame is frozen for the editor; when the editor
|
|
400
|
+
* finishes, the view glides back to the padding. An image is drawn contain-fitted over its background
|
|
401
|
+
* on a canvas the size of the configurator view, and the camera stays as it is.
|
|
297
402
|
*/
|
|
298
|
-
annotate: () => Promise<
|
|
403
|
+
annotate: (target: AssistantAnnotationTarget) => Promise<string | null>;
|
|
404
|
+
/** Annotates the view or an image in a slot of its own, and attaches the annotation to the message. */
|
|
405
|
+
private _annotateIntoSlot;
|
|
299
406
|
/**
|
|
300
407
|
* Shows an annotation of a sent message over the configurator, read-only, until its overlay is
|
|
301
408
|
* closed. Nothing happens while another annotation is made or shown.
|
|
302
409
|
*/
|
|
303
410
|
viewAnnotation: (annotation: AssistantMessageAnnotation) => void;
|
|
411
|
+
/**
|
|
412
|
+
* Shows an image of the chat larger, beside the panel, in place of the one that is open, until
|
|
413
|
+
* {@link AssistantSystem.closeImageView} or a new configuration load. Unlike an annotation it leaves
|
|
414
|
+
* the configurator usable: the user can go on writing while it is open.
|
|
415
|
+
*/
|
|
416
|
+
viewImage: (view: AssistantImageView) => void;
|
|
417
|
+
/** Closes the image that is open; nothing happens when none is. */
|
|
418
|
+
closeImageView: () => void;
|
|
419
|
+
/**
|
|
420
|
+
* Attaches an image, prepared for the upload, to the message being written, after the others, and
|
|
421
|
+
* returns its id; `null` when the message is full. Free a slot reserved for it first.
|
|
422
|
+
*/
|
|
423
|
+
attach: (blob: Blob) => string | null;
|
|
424
|
+
/**
|
|
425
|
+
* Holds one attachment slot of the message being written, for an image that is being prepared, until
|
|
426
|
+
* the returned function frees it; `null` when the message is full. The function returns whether the
|
|
427
|
+
* image is still to be attached: `false` once a configuration load took the attachments off meanwhile.
|
|
428
|
+
*/
|
|
429
|
+
reserveAttachmentSlot: () => (() => boolean) | null;
|
|
430
|
+
/**
|
|
431
|
+
* Puts attachments of a message the chat gave back in front of the others, as many as fit, the first
|
|
432
|
+
* ones first, and returns whether all of them fit.
|
|
433
|
+
*/
|
|
434
|
+
restoreAttachments: (attachments: ReadonlyArray<AssistantDraftAttachment>) => boolean;
|
|
435
|
+
/** Takes an attachment off the message being written; nothing happens when it is not attached. */
|
|
436
|
+
removeAttachment: (id: string) => void;
|
|
437
|
+
/** Takes every attachment off the message being written. */
|
|
438
|
+
clearAttachments: () => void;
|
|
304
439
|
/**
|
|
305
440
|
* Makes the chat ready for the next message. A thread the server no longer lets this session
|
|
306
441
|
* continue, because the assistant's setup changed since it was started or the thread reached
|
|
@@ -320,6 +455,25 @@ export declare class AssistantSystem implements InitializableSystem {
|
|
|
320
455
|
* failed is forgotten, so it can be asked for again. Rejects without a chat or when the read fails.
|
|
321
456
|
*/
|
|
322
457
|
loadScreenshotUrl: (imageId: string) => Promise<string>;
|
|
458
|
+
/**
|
|
459
|
+
* Reads a reply of the conversation aloud, by the id of its message, stopping the one being read; a reply being
|
|
460
|
+
* read is stopped instead. Its speech is read from the server through the client of the current chat, once per
|
|
461
|
+
* reply, and nothing happens without a chat. A reply the server cannot read aloud is logged, and stays idle.
|
|
462
|
+
*/
|
|
463
|
+
playReply: (messageId: string) => void;
|
|
464
|
+
/** Stops the reply being read aloud. */
|
|
465
|
+
stopPlayback: () => void;
|
|
466
|
+
/**
|
|
467
|
+
* Mutes or unmutes the replies that read themselves aloud after a voice message; muting stops the one being read.
|
|
468
|
+
* The browser remembers the choice.
|
|
469
|
+
*/
|
|
470
|
+
setMuted: (muted: boolean) => void;
|
|
471
|
+
/**
|
|
472
|
+
* Lets the page read the reply to a voice message aloud on its own once it has ended. Call it while the user taps,
|
|
473
|
+
* such as on the tap that records or sends the message: Safari plays audio that no tap started only on an element
|
|
474
|
+
* that played during one before. Calls after the first do nothing.
|
|
475
|
+
*/
|
|
476
|
+
unlockPlayback: () => void;
|
|
323
477
|
/**
|
|
324
478
|
* Loads the closed thread named by `earlierThreadId` of the chat, whole, and paints it above the
|
|
325
479
|
* painted ones; when it is the oldest painted thread itself, closed while only its newest messages
|
|
@@ -345,6 +499,17 @@ export declare class AssistantSystem implements InitializableSystem {
|
|
|
345
499
|
* server is therefore gone from the thread and has to be written again.
|
|
346
500
|
*/
|
|
347
501
|
reloadThread: () => void;
|
|
502
|
+
/**
|
|
503
|
+
* Runs the model again on the user's newest message, after the run that answered it failed. Only Try again calls
|
|
504
|
+
* it. It restarts the chat client and reads the thread again before regenerating, because only the stored thread
|
|
505
|
+
* is right in each case it serves: the failed run never stored the user's message, the connection dropped while
|
|
506
|
+
* the run went on, or the page loaded on a failed thread. Once the read thread is painted, the chat client
|
|
507
|
+
* regenerates the reply, which drops whatever the failed run produced after the message there and on the server.
|
|
508
|
+
* The message itself is not sent again. When the read thread no longer reports a failed run, only the read
|
|
509
|
+
* happens. The server, not the client, decides whether a regeneration is allowed.
|
|
510
|
+
*/
|
|
511
|
+
regenerate: () => void;
|
|
512
|
+
private _restartChat;
|
|
348
513
|
/**
|
|
349
514
|
* Undoes the changes of the given `apply` tool calls, one undo step at a time, while the step the
|
|
350
515
|
* configuration is at is one of them. A change the user made in between stops it, so it is never
|
|
@@ -357,6 +522,35 @@ export declare class AssistantSystem implements InitializableSystem {
|
|
|
357
522
|
undoToolCalls: (toolCallIds: ReadonlySet<string>) => void;
|
|
358
523
|
setOpen: (open: boolean) => void;
|
|
359
524
|
setInputFocused: (isInputFocused: boolean) => void;
|
|
525
|
+
/** Every change of the annotation overlay goes through here: the configurator is inert while there is one. */
|
|
526
|
+
private _setAnnotationOverlay;
|
|
527
|
+
/** The camera path of `annotate`: still camera, glide off the padding, freeze, edit, glide back. */
|
|
528
|
+
private _annotateView;
|
|
529
|
+
/**
|
|
530
|
+
* Runs one annotation as the current `annotate()` call and resolves with what the user made, or with
|
|
531
|
+
* `null` when a configuration loaded meanwhile cancelled it: it belongs to the message of another one.
|
|
532
|
+
*/
|
|
533
|
+
private _runAnnotation;
|
|
534
|
+
/** The attachment path of `annotate`: annotate an image of the message, which the annotation replaces. */
|
|
535
|
+
private _annotateAttachment;
|
|
536
|
+
/**
|
|
537
|
+
* The size an annotated image is drawn at: the size a frozen view has, the canvas's drawing buffer, so the editor lays
|
|
538
|
+
* an image out like a view; the window at the device's pixel ratio when there is no canvas or it is not shown.
|
|
539
|
+
*/
|
|
540
|
+
private _annotationArea;
|
|
541
|
+
/** The image path of `annotate`: draw the image, edit. The camera stays as it is. */
|
|
542
|
+
private _annotateImage;
|
|
543
|
+
/**
|
|
544
|
+
* Opens the editor on `view` and resolves with what the user made, or `null` when they cancel.
|
|
545
|
+
*
|
|
546
|
+
* The 3D canvas is paused while the editor covers it: a canvas drawn every frame, with heavy
|
|
547
|
+
* postprocessing, would otherwise keep drawing beneath it and make the editor lag. The pause is the
|
|
548
|
+
* export system's shared one, so an export overlapping the editor neither resumes the canvas under it
|
|
549
|
+
* nor leaves it paused afterwards. It ends as the editor resolves, before the view glides back.
|
|
550
|
+
* The canvas keeps the pause through its own renders, such as on a resize (`frameloopPaused$`).
|
|
551
|
+
*/
|
|
552
|
+
private _edit;
|
|
553
|
+
private _logAnnotationFailure;
|
|
360
554
|
/** A new configuration load cancels an annotation that is made, and closes one that is shown. */
|
|
361
555
|
private _closeAnnotationOverlay;
|
|
362
556
|
/**
|
|
@@ -365,7 +559,10 @@ export declare class AssistantSystem implements InitializableSystem {
|
|
|
365
559
|
* is no such message. A refused continuation of a reply is not one: its message is stored.
|
|
366
560
|
*/
|
|
367
561
|
private _findRefusedMessageIndex;
|
|
368
|
-
/**
|
|
562
|
+
/**
|
|
563
|
+
* The content of a user message: its text, when it has any, or its recording, and a reference to
|
|
564
|
+
* each of its images.
|
|
565
|
+
*/
|
|
369
566
|
private _messageContent;
|
|
370
567
|
/**
|
|
371
568
|
* Uploads the images of a message into the chat's thread, in their order, and resolves with their
|
|
@@ -389,6 +586,12 @@ export declare class AssistantSystem implements InitializableSystem {
|
|
|
389
586
|
*/
|
|
390
587
|
private _findTipToolCallId;
|
|
391
588
|
private _refreshUndoTip;
|
|
589
|
+
private _loadSpeech;
|
|
590
|
+
/**
|
|
591
|
+
* Reads aloud the reply to a voice message, its newest message with text, unless the user muted it or that message
|
|
592
|
+
* cannot be read aloud; a browser that refuses leaves its play button to start it.
|
|
593
|
+
*/
|
|
594
|
+
private _readVoiceReply;
|
|
392
595
|
private _committedState;
|
|
393
596
|
private _patchPanel;
|
|
394
597
|
/**
|
|
@@ -410,6 +613,33 @@ export declare class AssistantSystem implements InitializableSystem {
|
|
|
410
613
|
* A chat that finishes a reply for another configuration is on another thread and is left alone.
|
|
411
614
|
*/
|
|
412
615
|
private _takeOverThread;
|
|
616
|
+
/**
|
|
617
|
+
* Offers the assistant's tools to the AI agents in the visitor's browser through WebMCP for the
|
|
618
|
+
* session loaded now, in place of those of an earlier load. They come and go with the chat's
|
|
619
|
+
* activation, because the page that holds it is what tells the system that the spec has an
|
|
620
|
+
* `assistant` section and that the configuration is on screen; see {@link AssistantSystem.activate}.
|
|
621
|
+
* Nothing else of the chat is needed: no model runs here, so the server's assistant flags and
|
|
622
|
+
* limits do not apply. Nothing is registered without the browser API, while the assistant is off
|
|
623
|
+
* for the session or its setup failed, or when the spec or the setup handler turned WebMCP off.
|
|
624
|
+
*
|
|
625
|
+
* Every load tells the WebMCP host how its tools settled, registered or not, so the preset tool
|
|
626
|
+
* that opened this configuration can tell its agent whether `configurator_guide` is there.
|
|
627
|
+
*
|
|
628
|
+
* An outside agent's `apply` gets none of the panel's records: no chip row, no change record
|
|
629
|
+
* cleared, nothing in the thread. To the panel's assistant its edits are the user's own. It is not
|
|
630
|
+
* locked against a running panel reply either; the conflict retry of `GraphQLSystem.execute` is
|
|
631
|
+
* all that orders the two.
|
|
632
|
+
*
|
|
633
|
+
* The tools are settled again when the session's manifest changes while the configuration is open:
|
|
634
|
+
* a session refreshed in place, with a new role or new session data, can narrow or widen it, or turn
|
|
635
|
+
* WebMCP off. The change is noticed at the store reset that such a refresh makes; see
|
|
636
|
+
* `_refreshWebMcp`. An editor hot reload that changes the `assistant` section is picked up the same
|
|
637
|
+
* way when it resets the store, and otherwise takes effect at the next load.
|
|
638
|
+
*/
|
|
639
|
+
private _registerWebMcp;
|
|
640
|
+
private _unregisterWebMcp;
|
|
641
|
+
/** Registers the WebMCP tools again when the session's manifest is no longer the one they were settled for. */
|
|
642
|
+
private _refreshWebMcp;
|
|
413
643
|
private _startClient;
|
|
414
644
|
/**
|
|
415
645
|
* Lets go of the current chat and puts the empty chat in its place. The client itself is left as
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ChatClient as t,fetchServerSentEvents as e}from"@tanstack/ai-client";import{BehaviorSubject as a,firstValueFrom as s,race as i,timer as n}from"rxjs";import{filter as r,skip as o}from"rxjs/operators";import{isShallowEqual as l}from"@salsita-ai/common/utils";import{assistantImageReference as h}from"@salsita-ai/contracts/assistant";import{AssistantRequestError as c}from"#package/client";import{ChangeRecorder as d}from"./change-recorder.js";import{createApplyClientTool as u,createQueryClientTool as _,toToolResult as g}from"./graphql-tools.js";let f=Object.freeze({messages:Object.freeze([]),isLoading:!1,error:void 0,failedStatus:void 0,retryAfterSeconds:void 0,isContinuable:!0,isLocked:!1,isLoaded:!1,isResuming:!1,earlierThreads:Object.freeze([]),earlierThreadId:null,isLoadingEarlierThread:!1,hasOlderMessages:!1,isLoadingOlderMessages:!1}),v=Object.freeze({top:0,right:0,bottom:0,left:0}),m=Object.freeze({kind:"transition"}),p=Object.freeze({open:!1,hasUnreadReply:!1,isInputFocused:!1}),S=Object.freeze({}),y=g({results:[],committed:!1,sideEffects:[],warnings:[],screenshots:new Map,message:"Nothing was run, because the user closed the configurator while this reply was being written. Do not call any more tools in this reply and end it now. The tools work again as soon as the user writes the next message."}),x=t=>{if(t.getError())return!0;let e=t.getMessages().at(-1)?.parts.at(-1);return e?.type!=="tool-call"&&e?.type!=="tool-result"},w=async t=>{try{let e=await t.clone().json(),a=e?.page;return a?.truncated===!0&&"string"==typeof a.cursor&&""!==a.cursor}catch{return!1}};export class AssistantSystem{_context;_tools;_chat=new a(f);_panel=new a(p);_annotationOverlay=new a(null);_annotationRun=null;_activation=null;_current=null;_finishing=new Set;_resuming=null;_refused=null;_firstAttempt=null;_chain={};_recorder;_recording=null;_applyToolCallIds=new WeakMap;_undoTipToolCallId=new a(void 0);_screenshotUrls=new Map;constructor(t){this._context=t;let{configuratorExtensionSelectors:e,domainContextSelectors:a,domainServicesSelectors:s,getAssistantSetup:i}=t;this._recorder=new d({maxEntities:30},{readers:{selectedEntityId:t=>a.getNavigationSystem().getActiveSelectionState(t),navigationState:t=>a.getNavigationSystem().getActiveNavigationState(t),viewState:t=>a.getNavigationSystem().getActiveViewState(t),toolState:t=>a.getNavigationSystem().getActiveToolState(t)},getExposedFields:()=>i().manifest?.fields??S,resolveLocalizable:t=>s.getResolveLocalizable()(t)});let n={getGraphQLSystem:()=>e.getGraphQLSystem(),getStoreSystem:()=>a.getStoreSystem(),getActiveMode:()=>a.getActiveMode(),getIsViewMode:()=>a.getIsViewMode(),clearChanges:()=>this._recorder.clear(this._committedState()),rememberCommit:(t,e)=>{this._applyToolCallIds.set(e,t),this._refreshUndoTip()}};this._tools=[_(n),u(n)],a.getUndoSystem().tip$.subscribe(this._refreshUndoTip)}chat$=this._chat;panel$=this._panel;annotationOverlay$=this._annotationOverlay;undoTipToolCallId$=this._undoTipToolCallId;getSessionManifest=()=>this._context.getAssistantSetup().manifest;initialize=()=>{let{committed:t}=this._context.domainContextSelectors.getStoreSystem().stateSlices;this._recording??=t.pipe(o(1)).subscribe(this._recorder.record),this._recorder.reset(t.value.state),this._endChat(),this._patchPanel(p),this._releaseScreenshotUrls(),this._closeAnnotationOverlay(),this._activation&&this._startClient()};activate=()=>{this._endChat();let t={};return this._activation=t,this._startClient(),()=>{this._activation===t&&(this._activation=null,this._endChat())}};send=async(t,e=[],{onSent:a,onUnsent:s}={})=>{if(!this._chat.value.isContinuable&&!await this.resume())return;let i=this._current;if(!i)return;let n={changes:this._recorder.take(this._committedState()),locale:this._context.domainServicesSelectors.getI18n().locale},r=()=>this._recorder.reset(this._committedState()),o=e.map(t=>t instanceof Blob?t:t.blob),l=!1,h=(s,i)=>{l||(l=!0,a?.());let r=e.flatMap((t,e)=>{let a=i[e];return t instanceof Blob||void 0===a?[]:[{imageId:a,pins:t.pins}]});return this._sendOn(s,this._messageContent(t,i),0===r.length?n:{...n,annotations:r})};this._firstAttempt=i;try{let t=0===o.length?[]:await this._uploadImages(i,o);if(null===t||!i.generation.active)return void r();if("refused"!==t){await h(i,t);let e=this._findRefusedMessageIndex(i);if(-1===e)return;this._refused={chat:i,index:e}}}finally{this._firstAttempt===i&&(this._firstAttempt=null)}if(!await this.resume()){l||r();return}let c=this._current,d=c?await this._uploadSuccessorImages(c,o):null;if(!c||null===d||"refused"===d||!c.generation.active){c&&"refused"===d&&this._reportUploadFailure(c,this._chat.value.error),l&&s?.(),r();return}await h(c,d)};annotate=async()=>{if(null!==this._annotationOverlay.value)return null;let{getCameraControlSystem:t,getCanvasSystem:e}=this._context.configuratorExtensionSelectors,a=t(),o=e().r3fHandle$.value?.get().frameloop==="demand",l={},h=()=>this._annotationRun===l;if(this._annotationRun=l,this._annotationOverlay.next(m),await s(i(a.transitionState$.pipe(r(t=>"still"===t||"sleep"===t&&!o)),n(2e3))),!h())return this._annotationOverlay.next(null),null;let c=a.holdCameraOffset(),d=null;try{await a.glideCameraOffset(v);let t=await this._context.freezeView();h()&&(d=await new Promise(e=>{this._annotationOverlay.next({kind:"editor",view:t,finish:e})}))}catch(e){let t=e instanceof Error?e:Error(String(e));this._context.domainServicesSelectors.getLogger().error("The configurator view could not be frozen for an annotation",{},t)}this._annotationOverlay.next(m);try{await a.glideCameraOffset(a.canvasPadding$.value)}finally{c(),this._annotationOverlay.next(null),h()&&(this._annotationRun=null)}return d};viewAnnotation=t=>{if(null!==this._annotationOverlay.value)return;let e={kind:"viewer",annotation:t,close:()=>{this._annotationOverlay.value===e&&this._annotationOverlay.next(null)}};this._annotationOverlay.next(e)};resume=async()=>{let t=this._current;if(!t)return!1;if(this._chat.value.isContinuable)return!0;if(this._resuming)return this._resuming;let e=this._compact(t).finally(()=>{this._resuming===e&&(this._resuming=null)});return this._resuming=e,e};loadScreenshotUrl=t=>{let e=this._screenshotUrls.get(t);if(e)return e;let a=this._current;if(!a)return Promise.reject(Error(`The screenshot ${t} cannot be read, because the assistant chat is not active. Open the assistant panel of the configuration first.`));let s=this._screenshotUrls,i=a.authorizedClient.getAssistantImage(a.configurationId,t).then(t=>URL.createObjectURL(t));return s.set(t,i),i.catch(()=>{s.get(t)===i&&s.delete(t)}),i};loadEarlierThread=async()=>{let t=this._current,{earlierThreadId:e,isLoadingEarlierThread:a,hasOlderMessages:s}=this._chat.value;if(!t||null===e||a||s)return;let i=this._chain;this._chat.next({...this._chat.value,isLoadingEarlierThread:!0});try{let a=await t.authorizedClient.getAssistantEarlierThread(t.configurationId,e);if(this._chain!==i||this._chat.value.earlierThreadId!==e)return;let[s,...n]=this._chat.value.earlierThreads,r={threadId:e,messages:a.messages};this._chat.next({...this._chat.value,earlierThreads:s?.threadId===e?[r,...n]:[r,...this._chat.value.earlierThreads],earlierThreadId:a.previousThreadId})}catch(t){this._context.domainServicesSelectors.getLogger().warn("Could not load the earlier assistant conversation",{error:t})}finally{this._chain===i&&this._chat.next({...this._chat.value,isLoadingEarlierThread:!1})}};loadOlderMessages=async()=>{let t=this._current,{hasOlderMessages:e,isLoadingOlderMessages:a}=this._chat.value;if(t&&e&&!a){this._chat.next({...this._chat.value,isLoadingOlderMessages:!0});try{await t.client.loadOlderMessages()}catch(t){this._context.domainServicesSelectors.getLogger().warn("Could not load older assistant messages",{error:t})}finally{t===this._current&&this._chat.next({...this._chat.value,hasOlderMessages:t.client.getHasOlderMessages(),isLoadingOlderMessages:!1})}}};stop=async()=>{let t=this._current;if(!t)return;let e=t.client.getCurrentRunId();if(t.client.stop(),null!=e)try{let a=t.getConnection();await fetch(`${a.url}/runs/${encodeURIComponent(e)}/cancel`,{method:"POST",headers:await a.headers()})}catch(t){this._context.domainServicesSelectors.getLogger().warn("Could not cancel the assistant run on the server",{error:t})}};reloadThread=()=>{if(!this._activation)return;let t=this._retireChat();t?.client.stop(),t?.dispose(),this._recorder.reset(this._committedState()),this._startClient()};undoToolCalls=t=>{let e=this._context.domainContextSelectors.getUndoSystem(),a=()=>{let e=this._findTipToolCallId();return void 0!==e&&t.has(e)};for(;a();)e.undo()};setOpen=t=>{this._patchPanel(t?{open:t,hasUnreadReply:!1}:{open:t,isInputFocused:!1})};setInputFocused=t=>{this._patchPanel({isInputFocused:t})};_closeAnnotationOverlay=()=>{let t=this._annotationOverlay.value;this._annotationRun=null,t?.kind==="editor"&&t.finish(null),t?.kind==="viewer"&&t.close()};_findRefusedMessageIndex=t=>{var e;let a,{failedStatus:s,isContinuable:i}=this._chat.value;return this._firstAttempt===t&&t.generation.active&&409===s&&!i?(a=(e=t.client.getMessages()).map(t=>t.role).lastIndexOf("user"),e.slice(a+1).every(t=>0===t.parts.length)?a:-1):-1};_messageContent=(t,e)=>0===e.length?t:[...t?[{type:"text",content:t}]:[],...e.map(t=>({type:"image",source:{type:"url",value:h(t)}}))];_uploadImages=async(t,e)=>{if(0===e.length)return[];t.generation.active&&this._chat.next({...this._chat.value,error:void 0,failedStatus:void 0});try{return(await Promise.all(e.map(e=>t.authorizedClient.uploadAssistantImage(t.configurationId,e)))).map(({imageId:t})=>t)}catch(a){let e=a instanceof Error?a:Error(String(a));if(e instanceof c&&e.threadNotContinuable)return t.generation.active&&this._chat.next({...this._chat.value,isContinuable:!1,error:e,failedStatus:e.status}),"refused";return this._reportUploadFailure(t,e),null}};_uploadSuccessorImages=async(t,e)=>{if(0===e.length)return[];this._chat.next({...this._chat.value,isResuming:!0});try{return await this._uploadImages(t,e)}finally{t.generation.active&&this._chat.next({...this._chat.value,isResuming:!1})}};_reportUploadFailure=(t,e)=>{t.generation.active&&this._chat.next({...this._chat.value,error:e,failedStatus:e instanceof c?e.status:void 0}),this._context.domainServicesSelectors.getLogger().error("The images of the assistant message could not be uploaded",{},e)};_sendOn=async(t,e,a)=>{let{client:s}=t;s.getIsLoading()||null===s.getResumeState()||s.stop();try{await s.sendMessage({content:e,metadata:a})}catch(a){let e=a instanceof Error?a:Error(String(a));t.generation.active&&this._chat.next({...this._chat.value,error:e}),this._context.domainServicesSelectors.getLogger().error("The assistant message could not be sent",{},e)}};_compact=async t=>{this._chat.next({...this._chat.value,isResuming:!0,error:void 0,failedStatus:void 0});try{let{previousThreadId:e}=await t.authorizedClient.compactAssistantThread(t.configurationId);if(!t.generation.active)return!1;let{messages:a,earlierThreads:s,earlierThreadId:i,isLoadingEarlierThread:n}=this._chat.value,r=this._refused?.chat===t?a.slice(0,this._refused.index):a,o=t.client.getHasOlderMessages()?e:i;return t.generation.active=!1,this._current=null,t.client.stop(),t.dispose(),this._chat.next({...f,earlierThreads:[...s,{threadId:e,messages:r}],earlierThreadId:o,isLoadingEarlierThread:n}),this._startClient(),!0}catch(a){let e=a instanceof Error?a:Error(String(a));if(e instanceof c&&409===e.status)return t.generation.active&&this.reloadThread(),!1;return t.generation.active&&this._chat.next({...this._chat.value,isResuming:!1,error:e,failedStatus:e instanceof c?e.status:void 0,...e instanceof c&&e.locked&&{isLocked:!0}}),this._context.domainServicesSelectors.getLogger().error("The assistant thread could not be resumed",{},e),!1}};_findTipToolCallId=()=>{let t=this._context.domainContextSelectors.getUndoSystem(),e=t.tip$.value?.committedState;return void 0!==e&&t.canUndo()?this._applyToolCallIds.get(e):void 0};_refreshUndoTip=()=>{let t=this._findTipToolCallId();t!==this._undoTipToolCallId.value&&this._undoTipToolCallId.next(t)};_committedState=()=>this._context.domainContextSelectors.getStoreSystem().stateSlices.committed.value.state;_patchPanel=t=>{let e={...this._panel.value,...t};l(e,this._panel.value)||this._panel.next(e)};_takeOverThread=t=>{for(let e of this._finishing)e.configurationId===t&&(e.client.stop(),e.dispose())};_startClient=()=>{let a={active:!0},s=this._context.getConfigurationId();this._takeOverThread(s);let i=this._context.getAuthorizedClient(),n=()=>{if(a.active){let{manifest:t,error:e}=this._context.getAssistantSetup();if(e)throw e;if(!t)throw Error("The assistant is disabled for this session.")}return i.getAssistantChatConnection(s)},r=t=>{if(!a.active)return;let e={...this._chat.value,...t};l(e,this._chat.value)||this._chat.next(e)},o=async(t,e)=>{let a,s=await fetch(t,e).finally(()=>r({isLoaded:!0})),i=s.headers.get("x-assistant-thread-continuable"),n="true"===s.headers.get("x-assistant-locked"),o=null!=i&&s.ok,l=o&&0===this._chat.value.earlierThreads.length,h=l?s.headers.get("x-assistant-previous-thread"):null;return r({failedStatus:s.ok?void 0:s.status,retryAfterSeconds:s.ok?void 0:null!==(a=s.headers.get("retry-after"))&&/^\d+$/.test(a.trim())?Number(a):void 0,...null!=i&&{isContinuable:"false"!==i},...(o||n)&&{isLocked:n},...l&&{earlierThreadId:h,...null!==h&&{hasOlderMessages:await w(s)}}}),s},h=async()=>({headers:await n().headers(),fetchClient:o}),c=e(()=>n().url,h),d=e(()=>`${n().url}/runs`,h),u=this._tools.map(t=>({...t,execute:(e,s)=>{if(!a.active)return y;let{manifest:i,error:n}=this._context.getAssistantSetup();return n||!i?{error:n?.message??"The assistant is disabled for this session."}:t.execute?.(e,s)}})),_=new t({threadId:`assistant:${s}`,connection:{...c,joinRun:d.joinRun},persistence:!0,history:{pageSize:50},tools:u,onMessagesChange:t=>r({messages:t,hasOlderMessages:_.getHasOlderMessages()}),onLoadingChange:t=>{let e=a.active&&this._chat.value.isLoading;r({isLoading:t}),!t&&x(_)&&(a.active?e&&!this._panel.value.open&&this._patchPanel({hasUnreadReply:!0}):f())},onErrorChange:t=>{a.active&&t!==this._chat.value.error&&(!t||-1===this._findRefusedMessageIndex(v))&&(r({error:t}),t&&this._context.domainServicesSelectors.getLogger().error("The assistant request failed",{status:this._chat.value.failedStatus},t))}}),g=!1,f=()=>{g||(g=!0,this._finishing.delete(v),_.dispose())},v={client:_,configurationId:s,generation:a,authorizedClient:i,getConnection:n,dispose:f};this._current=v,_.attach()};_retireChat=()=>{let t=this._current;return this._current=null,t&&(t.generation.active=!1),this._chain={},this._resuming=null,this._refused=null,this._chat.value!==f&&this._chat.next(f),t};_releaseScreenshotUrls=()=>{for(let t of this._screenshotUrls.values())t.then(URL.revokeObjectURL,()=>void 0);this._screenshotUrls=new Map};_endChat=()=>{let t=this._retireChat();if(t){if(!t.client.getIsLoading()&&x(t.client))return void t.dispose();this._finishing.add(t)}}}
|
|
1
|
+
import{ChatClient as e,fetchServerSentEvents as t}from"@tanstack/ai-client";import{BehaviorSubject as i,firstValueFrom as a,race as s,timer as n}from"rxjs";import{filter as r,skip as o}from"rxjs/operators";import{match as l}from"ts-pattern";import{isShallowEqual as h}from"@salsita-ai/common/utils";import{ASSISTANT_TRANSCRIPT_EVENT as c,AssistantTranscriptEvent as u,assistantImageReference as d}from"@salsita-ai/contracts/assistant";import{AssistantRequestError as _}from"#package/client";import{applicationConfigComponent as g}from"#package/domain";import{generateShareLink as p}from"#package/react-sdk";import{AssistantSpeechPlayer as m}from"./assistant-speech-player.js";import{ChangeRecorder as f}from"./change-recorder.js";import{ComposerAttachments as v}from"./composer-attachments.js";import{createApplyClientTool as y,createQueryClientTool as S,runApplyTool as w,runQueryTool as x,toToolResult as b}from"./graphql-tools.js";import{rasterizeImage as C}from"./rasterize-image.js";import{isSpeakableReply as A}from"./speakable-reply.js";import{registerWebMcpTools as I,runShareLinkTool as M}from"./webmcp/index.js";let T=Object.freeze({messages:Object.freeze([]),isLoading:!1,error:void 0,failedStatus:void 0,retryAfterSeconds:void 0,runFailed:void 0,isContinuable:!0,isLocked:!1,isNetworkLocked:!1,isLoaded:!1,isVoiceEnabled:!1,isResuming:!1,earlierThreads:Object.freeze([]),earlierThreadId:null,isLoadingEarlierThread:!1,hasOlderMessages:!1,isLoadingOlderMessages:!1}),O=Object.freeze({top:0,right:0,bottom:0,left:0}),R=Object.freeze({kind:"transition"}),k=Object.freeze({open:!1,hasUnreadReply:!1,isInputFocused:!1}),L=Object.freeze({}),E=b({results:[],committed:!1,sideEffects:[],warnings:[],screenshots:new Map,message:"Nothing was run, because the user closed the configurator while this reply was being written. Do not call any more tools in this reply and end it now. The tools work again as soon as the user writes the next message."}),$=e=>{if(e.getError())return!0;let t=e.getMessages().at(-1)?.parts.at(-1);return t?.type!=="tool-call"&&t?.type!=="tool-result"},U=async e=>{try{let t=await e.clone().json(),i=t?.page;return i?.truncated===!0&&"string"==typeof i.cursor&&""!==i.cursor}catch{return!1}},F=e=>{let t=e.map(e=>e.role).lastIndexOf("user");return e.slice(t+1).every(e=>0===e.parts.length)?t:-1},j=async e=>{let t=new Uint8Array(await e.arrayBuffer()),i="";for(let e=0;e<t.length;e+=32768)i+=String.fromCharCode(...t.subarray(e,e+32768));return btoa(i)};export class AssistantSystem{_context;_tools;_chat=new i(T);_panel=new i(k);_annotationOverlay=new i(null);_imageView=new i(null);_composerAttachments=new v;_releaseInert=null;_annotationRun=null;_activation=null;_current=null;_finishing=new Set;_resuming=null;_refused=null;_firstAttempt=null;_chain={};_recorder;_recording=null;_applyToolCallIds=new WeakMap;_undoTipToolCallId=new i(void 0);_screenshotUrls=new Map;_player=new m({createAudio:()=>this._context.createAudio(),logError:(e,t)=>this._context.domainServicesSelectors.getLogger().error(e,{},t)});_voiceReplyChat=null;_toolDependencies;_webMcpRegistration=null;_webMcpManifest=null;constructor(e){this._context=e;let{configuratorExtensionSelectors:t,domainContextSelectors:i,domainServicesSelectors:a,getAssistantSetup:s}=e,n=(e,t)=>e?.find(e=>e.state===t)?.name??t;this._recorder=new f({maxEntities:30},{readers:{selectedEntityId:e=>i.getNavigationSystem().getActiveSelectionState(e),navigationState:e=>n(s().manifest?.navigation?.navigationStates,i.getNavigationSystem().getActiveNavigationState(e)),viewState:e=>n(s().manifest?.navigation?.viewStates,i.getNavigationSystem().getActiveViewState(e)),toolState:e=>n(s().manifest?.navigation?.toolStates,i.getNavigationSystem().getActiveToolState(e))},getExposedFields:()=>s().manifest?.fields??L,resolveLocalizable:e=>a.getResolveLocalizable()(e)}),this._toolDependencies={getGraphQLSystem:()=>t.getGraphQLSystem(),getStoreSystem:()=>i.getStoreSystem(),getActiveMode:()=>i.getActiveMode(),getIsViewMode:()=>i.getIsViewMode(),getApplicationConfig:()=>i.getComponentReader().readFirstRootComponent({componentTypes:[g]},this._committedState())?.state,generateShareLink:({shareStrategy:e,...t})=>p({configurationId:this._context.getConfigurationId(),shareStrategy:e,save:()=>this._context.domainApplicationContextSelectors.getConfigurationPersistSystem().save(),apiClient:this._context.getAuthorizedClient()},t)};let r=(e,t)=>{void 0!==t&&void 0!==e.preparedState&&(this._applyToolCallIds.set(e.preparedState,t),this._refreshUndoTip()),e.committed&&this._recorder.clear(this._committedState())};this._tools=[S(this._toolDependencies),y(this._toolDependencies,r)],i.getUndoSystem().tip$.subscribe(this._refreshUndoTip)}chat$=this._chat;panel$=this._panel;annotationOverlay$=this._annotationOverlay;imageView$=this._imageView;composerAttachments$=this._composerAttachments.attachments$;hasFreeAttachmentSlot$=this._composerAttachments.hasFreeSlot$;undoTipToolCallId$=this._undoTipToolCallId;playback$=this._player.playback$;muted$=this._player.muted$;getSessionManifest=()=>this._context.getAssistantSetup().manifest;initialize=()=>{let{committed:e}=this._context.domainContextSelectors.getStoreSystem().stateSlices;this._recording??=e.pipe(o(1)).subscribe(e=>{this._recorder.record(e),"reset"===e.kind&&this._refreshWebMcp()}),this._recorder.reset(e.value.state),this._endChat(),this._patchPanel(k),this._releaseScreenshotUrls(),this._player.reset(),this._closeAnnotationOverlay(),this.closeImageView(),this.clearAttachments(),this._activation&&(this._startClient(),this._registerWebMcp())};activate=()=>{this._endChat();let e={};return this._activation=e,this._startClient(),this._registerWebMcp(),()=>{this._activation===e&&(this._activation=null,this._endChat(),this._player.stop(),this._unregisterWebMcp())}};send=async(e,t=[],{onSent:i,onUnsent:a,audio:s}={})=>{if(!this._chat.value.isContinuable&&!await this.resume())return;let n=this._current;if(!n)return;let r={changes:this._recorder.take(this._committedState()),locale:this._context.domainServicesSelectors.getI18n().locale},o=()=>this._recorder.reset(this._committedState()),l=t.map(({blob:e})=>e),h=s?{type:"audio",source:{type:"data",value:await j(s),mimeType:s.type}}:null,c=!1,u=(a,s)=>{c||(c=!0,i?.());let n=t.flatMap((e,t)=>{let i=s[t];return"image"===e.type||void 0===i?[]:[{imageId:i,pins:e.pins,source:e.source}]});return this._voiceReplyChat=h?a:null,this._sendOn(a,this._messageContent(h?"":e,s,h),0===n.length?r:{...r,annotations:n})},d=e=>{if(!h||!e.generation.active||e.client.getIsLoading())return;let t=e.client.getMessages(),{error:i,failedStatus:s}=this._chat.value,n=F(t);if(i&&void 0!==s&&-1!==n){e.client.setMessagesManually(t.slice(0,n)),o(),422!==s&&a?.();return}t.some(e=>"user"===e.role&&e.parts.some(e=>"audio"===e.type))&&this.reloadThread()};this._firstAttempt=n;try{let e=0===l.length?[]:await this._uploadImages(n,l);if(null===e||!n.generation.active)return void o();if("refused"!==e){await u(n,e);let t=this._findRefusedMessageIndex(n);if(-1===t)return void d(n);this._refused={chat:n,index:t}}}finally{this._firstAttempt===n&&(this._firstAttempt=null)}if(!await this.resume()){c||o(),this._current&&d(this._current);return}let _=this._current,g=_?await this._uploadSuccessorImages(_,l):null;if(!_||null===g||"refused"===g||!_.generation.active){_&&"refused"===g&&this._reportUploadFailure(_,this._chat.value.error),c&&a?.(),o();return}await u(_,g),d(_)};annotate=async e=>null!==this._annotationOverlay.value?null:l(e).with({type:"attachment"},e=>this._annotateAttachment(e)).with({type:"view"},()=>this._annotateIntoSlot("view",e=>this._annotateView(e))).with({type:"image"},e=>this._annotateIntoSlot("image",t=>this._annotateImage(t,e))).exhaustive();_annotateIntoSlot=async(e,t)=>{let i,a=this._composerAttachments.reserveSlot();if(!a)return null;try{i=await this._runAnnotation(t)}finally{a()}return i&&this._composerAttachments.attach({type:"annotation",blob:i.blob,pins:i.pins,source:e})};viewAnnotation=e=>{if(null!==this._annotationOverlay.value)return;let t={kind:"viewer",annotation:e,close:()=>{this._annotationOverlay.value===t&&this._setAnnotationOverlay(null)}};this._setAnnotationOverlay(t)};viewImage=e=>{this._imageView.next(e)};closeImageView=()=>{null!==this._imageView.value&&this._imageView.next(null)};attach=e=>this._composerAttachments.attach({type:"image",blob:e});reserveAttachmentSlot=()=>this._composerAttachments.reserveSlot();restoreAttachments=e=>this._composerAttachments.restore(e);removeAttachment=e=>this._composerAttachments.remove(e);clearAttachments=()=>this._composerAttachments.clear();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._compact(e).finally(()=>{this._resuming===t&&(this._resuming=null)});return this._resuming=t,t};loadScreenshotUrl=e=>{let t=this._screenshotUrls.get(e);if(t)return t;let i=this._current;if(!i)return Promise.reject(Error(`The screenshot ${e} cannot be read, because the assistant chat is not active. Open the assistant panel of the configuration first.`));let a=this._screenshotUrls,s=i.authorizedClient.getAssistantImage(i.configurationId,e).then(e=>URL.createObjectURL(e));return a.set(e,s),s.catch(()=>{a.get(e)===s&&a.delete(e)}),s};playReply=e=>{let t=this._current;t&&this._player.toggle({messageId:e,loadSpeech:()=>this._loadSpeech(t,e),isAutoplay:!1})};stopPlayback=()=>{this._player.stop()};setMuted=e=>{this._player.setMuted(e)};unlockPlayback=()=>{this._player.unlock()};loadEarlierThread=async()=>{let e=this._current,{earlierThreadId:t,isLoadingEarlierThread:i,hasOlderMessages:a}=this._chat.value;if(!e||null===t||i||a)return;let s=this._chain;this._chat.next({...this._chat.value,isLoadingEarlierThread:!0});try{let i=await e.authorizedClient.getAssistantEarlierThread(e.configurationId,t);if(this._chain!==s||this._chat.value.earlierThreadId!==t)return;let[a,...n]=this._chat.value.earlierThreads,r={threadId:t,messages:i.messages};this._chat.next({...this._chat.value,earlierThreads:a?.threadId===t?[r,...n]:[r,...this._chat.value.earlierThreads],earlierThreadId:i.previousThreadId})}catch(e){this._context.domainServicesSelectors.getLogger().warn("Could not load the earlier assistant conversation",{error:e})}finally{this._chain===s&&this._chat.next({...this._chat.value,isLoadingEarlierThread:!1})}};loadOlderMessages=async()=>{let e=this._current,{hasOlderMessages:t,isLoadingOlderMessages:i}=this._chat.value;if(e&&t&&!i){this._chat.next({...this._chat.value,isLoadingOlderMessages:!0});try{await e.client.loadOlderMessages()}catch(e){this._context.domainServicesSelectors.getLogger().warn("Could not load older assistant messages",{error:e})}finally{e===this._current&&this._chat.next({...this._chat.value,hasOlderMessages:e.client.getHasOlderMessages(),isLoadingOlderMessages:!1})}}};stop=async()=>{let e=this._current;if(!e)return;let t=e.client.getCurrentRunId();if(this._voiceReplyChat===e&&(this._voiceReplyChat=null),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=()=>{this._restartChat({regenerate:!1})};regenerate=()=>{this._restartChat({regenerate:!0})};_restartChat=({regenerate:e})=>{if(!this._activation)return;let t=this._retireChat();t?.client.stop(),t?.dispose(),this._recorder.reset(this._committedState()),this._startClient({regenerate:e})};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})};_setAnnotationOverlay=e=>{null!==e&&null===this._releaseInert&&(this._releaseInert=this._context.configuratorExtensionSelectors.getLayoutSystem().makeInert()),this._annotationOverlay.next(e),null===e&&(this._releaseInert?.(),this._releaseInert=null)};_annotateView=async e=>{let{getCameraControlSystem:t,getCanvasSystem:i}=this._context.configuratorExtensionSelectors,o=t(),l=i().r3fHandle$.value?.get().frameloop==="demand",h=()=>this._annotationRun===e;if(this._setAnnotationOverlay(R),await a(s(o.transitionState$.pipe(r(e=>"still"===e||"sleep"===e&&!l)),n(2e3))),!h())return this._setAnnotationOverlay(null),null;let c=()=>a(o.cameraOffsetSettled$.pipe(r(Boolean))),u=null;try{o.setCameraOffsetOverride(O),await c();let e=await this._context.configuratorExtensionSelectors.getImageRenderingSystem().captureView();h()&&(u=await this._edit(e))}catch(e){this._logAnnotationFailure("The configurator view could not be frozen for an annotation",e)}this._setAnnotationOverlay(R);try{o.setCameraOffsetOverride(null),await c()}finally{o.setCameraOffsetOverride(null),this._setAnnotationOverlay(null)}return u};_runAnnotation=async e=>{let t={},i=null;this._annotationRun=t;try{i=await e(t)}finally{this._annotationRun!==t?i=null:this._annotationRun=null}return i};_annotateAttachment=async({attachmentId:e,background:t})=>{let i=this._composerAttachments.attachments$.value.find(({id:t})=>t===e);if(!i||"annotation"===i.type)return null;let a=await this._runAnnotation(e=>this._annotateImage(e,{type:"image",image:i.blob,background:t}));return a&&this._composerAttachments.replace(e,{type:"annotation",blob:a.blob,pins:a.pins,source:"image"})};_annotationArea=()=>{let e=this._context.configuratorExtensionSelectors.getCanvasSystem().r3fHandle$.value?.get().gl.domElement,t=globalThis.devicePixelRatio||1;return e&&e.width>0&&e.height>0?{width:e.width,height:e.height}:{width:Math.max(1,Math.round(globalThis.innerWidth*t)),height:Math.max(1,Math.round(globalThis.innerHeight*t))}};_annotateImage=async(e,{image:t,background:i})=>{this._setAnnotationOverlay(R);try{let a=await C(t,i,this._annotationArea());return this._annotationRun===e?await this._edit(a):null}catch(e){return this._logAnnotationFailure("The image could not be drawn for an annotation",e),null}finally{this._setAnnotationOverlay(null)}};_edit=e=>{let{getCanvasSystem:t,getExportSystem:i}=this._context.configuratorExtensionSelectors,a=t().r3fHandle$.value,s=a?i().pauseFrameloop(a):()=>{};return new Promise(t=>{this._setAnnotationOverlay({kind:"editor",view:e,finish:t})}).finally(s)};_logAnnotationFailure=(e,t)=>{let i=t instanceof Error?t:Error(String(t));this._context.domainServicesSelectors.getLogger().error(e,{},i)};_closeAnnotationOverlay=()=>{let e=this._annotationOverlay.value;this._annotationRun=null,e?.kind==="editor"&&e.finish(null),e?.kind==="viewer"&&e.close()};_findRefusedMessageIndex=e=>{let{failedStatus:t,isContinuable:i}=this._chat.value;return this._firstAttempt===e&&e.generation.active&&409===t&&!i?F(e.client.getMessages()):-1};_messageContent=(e,t,i)=>0!==t.length||i?[...e?[{type:"text",content:e}]:[],...i?[i]:[],...t.map(e=>({type:"image",source:{type:"url",value:d(e)}}))]:e;_uploadImages=async(e,t)=>{if(0===t.length)return[];e.generation.active&&this._chat.next({...this._chat.value,error:void 0,failedStatus:void 0,runFailed:void 0});try{return(await Promise.all(t.map(t=>e.authorizedClient.uploadAssistantImage(e.configurationId,t)))).map(({imageId:e})=>e)}catch(i){let t=i instanceof Error?i:Error(String(i));if(t instanceof _&&t.threadNotContinuable)return e.generation.active&&this._chat.next({...this._chat.value,isContinuable:!1,error:t,failedStatus:t.status,runFailed:void 0}),"refused";return this._reportUploadFailure(e,t),null}};_uploadSuccessorImages=async(e,t)=>{if(0===t.length)return[];this._chat.next({...this._chat.value,isResuming:!0});try{return await this._uploadImages(e,t)}finally{e.generation.active&&this._chat.next({...this._chat.value,isResuming:!1})}};_reportUploadFailure=(e,t)=>{e.generation.active&&this._chat.next({...this._chat.value,error:t,failedStatus:t instanceof _?t.status:void 0,runFailed:void 0}),this._context.domainServicesSelectors.getLogger().error("The images of the assistant message could not be uploaded",{},t)};_sendOn=async(e,t,i)=>{let{client:a}=e;a.getIsLoading()||null===a.getResumeState()||a.stop();try{await a.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,runFailed:void 0}),this._context.domainServicesSelectors.getLogger().error("The assistant message could not be sent",{},t)}};_compact=async e=>{this._chat.next({...this._chat.value,isResuming:!0,error:void 0,failedStatus:void 0,runFailed:void 0});try{let{previousThreadId:t}=await e.authorizedClient.compactAssistantThread(e.configurationId);if(!e.generation.active)return!1;let{messages:i,earlierThreads:a,earlierThreadId:s,isLoadingEarlierThread:n}=this._chat.value,r=this._refused?.chat===e?i.slice(0,this._refused.index):i,o=e.client.getHasOlderMessages()?t:s;return e.generation.active=!1,this._current=null,e.client.stop(),e.dispose(),this._chat.next({...T,earlierThreads:[...a,{threadId:t,messages:r}],earlierThreadId:o,isLoadingEarlierThread:n}),this._startClient(),!0}catch(i){let t=i instanceof Error?i:Error(String(i));if(t instanceof _&&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 _?t.status:void 0,runFailed:void 0,...t instanceof _&&t.locked&&{isLocked:!0,isNetworkLocked:t.networkLocked}}),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)};_loadSpeech=(e,t)=>e.authorizedClient.getAssistantReplySpeech(e.configurationId,t);_readVoiceReply=e=>{if(this._player.muted$.value||!this._chat.value.isVoiceEnabled)return;let t=e.client.getMessages(),i=t.map(e=>e.role).lastIndexOf("user")+1,a=t.slice(i).reverse().find(e=>e.parts.some(e=>"text"===e.type&&""!==e.content.trim()));a&&A(a)&&this._player.play({messageId:a.id,loadSpeech:()=>this._loadSpeech(e,a.id),isAutoplay:!0})};_committedState=()=>this._context.domainContextSelectors.getStoreSystem().stateSlices.committed.value.state;_patchPanel=e=>{let t={...this._panel.value,...e};h(t,this._panel.value)||this._panel.next(t)};_takeOverThread=e=>{for(let t of this._finishing)t.configurationId===e&&(t.client.stop(),t.dispose())};_registerWebMcp=()=>{this._unregisterWebMcp();let e=this._context.getWebMcpHost(),t=this._context.getConfigurationId(),{modelContext:i}=e,{manifest:a}=this._context.getAssistantSetup();if(this._webMcpManifest=a,!i||!a||!1===a.webmcp)return void e.settleLoad({configurationId:t,tools:!1});let s=new AbortController;this._webMcpRegistration=s,I({modelContext:i,manifest:a,run:{query:e=>x(this._toolDependencies,e,{screenshots:"inline",surface:"webmcp"}),apply:e=>w(this._toolDependencies,e,{screenshots:"inline",surface:"webmcp"}),share:e=>M(this._toolDependencies,e)},signal:s.signal}).then(()=>{this._webMcpRegistration===s&&e.settleLoad({configurationId:t,tools:!0})},i=>{this._webMcpRegistration===s&&(this._unregisterWebMcp(),e.settleLoad({configurationId:t,tools:!1})),this._context.domainServicesSelectors.getLogger().warn("The WebMCP tools could not be registered",{},i instanceof Error?i:void 0)})};_unregisterWebMcp=()=>{this._webMcpRegistration?.abort(),this._webMcpRegistration=null};_refreshWebMcp=()=>{this._activation&&this._context.domainContextSelectors.getIsInitialized()&&this._context.getAssistantSetup().manifest!==this._webMcpManifest&&this._registerWebMcp()};_startClient=({regenerate:i=!1}={})=>{let a={active:!0},s=i,n=this._context.getConfigurationId();this._takeOverThread(n);let r=this._context.getAuthorizedClient(),o=()=>{if(a.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(n)},l=e=>{if(!a.active)return;let t={...this._chat.value,...e};h(t,this._chat.value)||this._chat.next(t)},d=async(e,t)=>{let i,a=await fetch(e,t).finally(()=>l({isLoaded:!0})),s=a.headers.get("x-assistant-thread-continuable"),n=a.headers.get("x-assistant-locked"),r="true"===n||"network"===n,o=null!=s&&a.ok,h=o&&0===this._chat.value.earlierThreads.length,c=h?a.headers.get("x-assistant-previous-thread"):null,u=a.headers.get("x-assistant-run-failed");return l({failedStatus:a.ok?void 0:a.status,retryAfterSeconds:a.ok?void 0:null!==(i=a.headers.get("retry-after"))&&/^\d+$/.test(i.trim())?Number(i):void 0,...o?{runFailed:"busy"===u?"busy":"true"===u?"other":void 0}:t?.method==="POST"&&{runFailed:void 0},...null!=s&&{isContinuable:"false"!==s},...(o||r)&&{isLocked:r,isNetworkLocked:"network"===n},...o&&{isVoiceEnabled:"true"===a.headers.get("x-assistant-voice")},...h&&{earlierThreadId:c,...null!==c&&{hasOlderMessages:await U(a)}}}),a},_=async()=>({headers:await o().headers(),fetchClient:d}),g=t(()=>o().url,_),p=t(()=>`${o().url}/runs`,_),m=this._tools.map(e=>({...e,execute:(t,i)=>{if(!a.active)return E;let{manifest:s,error:n}=this._context.getAssistantSetup();return n||!s?{error:n?.message??"The assistant is disabled for this session."}:e.execute?.(t,i)}})),f=new e({threadId:`assistant:${n}`,connection:{...g,joinRun:p.joinRun},persistence:!0,history:{pageSize:50},tools:m,onMessagesChange:e=>{l({messages:e,hasOlderMessages:f.getHasOlderMessages()}),s&&e.length>0&&(s=!1,queueMicrotask(()=>{a.active&&void 0!==this._chat.value.runFailed&&!f.getIsLoading()&&f.reload()}))},onLoadingChange:e=>{let t=a.active&&this._chat.value.isLoading;if(l({isLoading:e}),!e&&$(f)){if(!a.active)return void y();t&&!this._panel.value.open&&this._patchPanel({hasUnreadReply:!0}),this._voiceReplyChat===S&&(this._voiceReplyChat=null,f.getError()||this._readVoiceReply(S))}},onCustomEvent:(e,t)=>{let i=e===c?u.safeParse(t):null;if(!i?.success)return;let{messageId:a,transcript:s}=i.data;f.setMessagesManually(f.getMessages().map(e=>e.id===a?{...e,parts:e.parts.flatMap(e=>"audio"===e.type?[{type:"text",content:s}]:[e]),metadata:{...e.metadata,spoken:!0}}:e))},onErrorChange:e=>{a.active&&e!==this._chat.value.error&&(!e||-1===this._findRefusedMessageIndex(S))&&(l({error:e,...e&&{runFailed:(e=>{let t=e?.code;if("string"==typeof t)return"provider_busy"===t?"busy":"other"})(e)}}),e&&this._context.domainServicesSelectors.getLogger().error("The assistant request failed",{status:this._chat.value.failedStatus},e))}}),v=!1,y=()=>{v||(v=!0,this._finishing.delete(S),f.dispose())},S={client:f,configurationId:n,generation:a,authorizedClient:r,getConnection:o,dispose:y};this._current=S,f.attach()};_retireChat=()=>{let e=this._current;return this._current=null,e&&(e.generation.active=!1),this._chain={},this._resuming=null,this._refused=null,this._voiceReplyChat=null,this._chat.value!==T&&this._chat.next(T),e};_releaseScreenshotUrls=()=>{for(let e of this._screenshotUrls.values())e.then(URL.revokeObjectURL,()=>void 0);this._screenshotUrls=new Map};_endChat=()=>{let e=this._retireChat();if(e){if(!e.client.getIsLoading()&&$(e.client))return void e.dispose();this._finishing.add(e)}}}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ObservableWithLastValue } from '@salsita-ai/common/utils';
|
|
2
|
+
import type { AssistantAnnotation } from './assistant-annotation.js';
|
|
3
|
+
/** The most images one message can carry, annotations included. */
|
|
4
|
+
export declare const MAX_COMPOSER_ATTACHMENTS = 4;
|
|
5
|
+
/** What the user attaches to a message: an image, or an annotation of their configurator view or of an image. */
|
|
6
|
+
export type AssistantAttachment = {
|
|
7
|
+
readonly type: 'image';
|
|
8
|
+
readonly blob: Blob;
|
|
9
|
+
} | AssistantAnnotation;
|
|
10
|
+
/**
|
|
11
|
+
* An image or an annotation attached to the message being written, prepared for the upload; see
|
|
12
|
+
* {@link AssistantSystem.composerAttachments$}.
|
|
13
|
+
*/
|
|
14
|
+
export type AssistantDraftAttachment = AssistantAttachment & {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The attachments of the message being written, up to {@link MAX_COMPOSER_ATTACHMENTS}. A slot can
|
|
19
|
+
* be reserved while an image is prepared or an annotation made, so nothing attached meanwhile pushes
|
|
20
|
+
* the message over the limit once it is done.
|
|
21
|
+
*/
|
|
22
|
+
export declare class ComposerAttachments {
|
|
23
|
+
private readonly _attachments;
|
|
24
|
+
private readonly _hasFreeSlot;
|
|
25
|
+
/** Slots held for images being prepared and annotations being made. */
|
|
26
|
+
private _reserved;
|
|
27
|
+
/** Counts the clears, so a slot held across one knows its message is gone. */
|
|
28
|
+
private _generation;
|
|
29
|
+
/** The attachments, in their order. It never completes. */
|
|
30
|
+
readonly attachments$: ObservableWithLastValue<ReadonlyArray<AssistantDraftAttachment>>;
|
|
31
|
+
/** Whether one more attachment fits, counting the reserved slots. It never completes. */
|
|
32
|
+
readonly hasFreeSlot$: ObservableWithLastValue<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Holds a slot until the returned function is called, which frees it and returns whether the message
|
|
35
|
+
* it was held for is still being written: `false` once the attachments were cleared meanwhile, when
|
|
36
|
+
* what it was held for is not to be attached. Calling it again frees nothing. `null` when the message
|
|
37
|
+
* is full.
|
|
38
|
+
*/
|
|
39
|
+
reserveSlot: () => (() => boolean) | null;
|
|
40
|
+
/**
|
|
41
|
+
* Attaches an image or an annotation after the others, and returns its id; `null` when the message
|
|
42
|
+
* is full. The slot reserved for it, if any, is to be freed first.
|
|
43
|
+
*/
|
|
44
|
+
attach: (attachment: AssistantAttachment) => string | null;
|
|
45
|
+
/**
|
|
46
|
+
* Puts attachments that were taken off back in front of the others, as many as fit, the first ones
|
|
47
|
+
* first. Returns whether all of them fit.
|
|
48
|
+
*/
|
|
49
|
+
restore: (attachments: ReadonlyArray<AssistantDraftAttachment>) => boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Puts an annotation in place of the attachment `id`, at its position, and returns the annotation's
|
|
52
|
+
* id; `null`, and nothing changes, when `id` is no longer attached. It takes no other slot.
|
|
53
|
+
*/
|
|
54
|
+
replace: (id: string, annotation: AssistantAnnotation) => string | null;
|
|
55
|
+
/** Takes an attachment off; nothing happens when it is not attached. */
|
|
56
|
+
remove: (id: string) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Takes every attachment off: the message is gone. Reserved slots stay held until they are freed, and
|
|
59
|
+
* what they were held for is not attached.
|
|
60
|
+
*/
|
|
61
|
+
clear: () => void;
|
|
62
|
+
private _update;
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{BehaviorSubject as t}from"rxjs";export const MAX_COMPOSER_ATTACHMENTS=4;let e=0;export class ComposerAttachments{_attachments=new t([]);_hasFreeSlot=new t(!0);_reserved=0;_generation=0;attachments$=this._attachments;hasFreeSlot$=this._hasFreeSlot;reserveSlot=()=>{if(!this._hasFreeSlot.value)return null;let t=this._generation,e=!0;return this._reserved+=1,this._update(this._attachments.value),()=>(e&&(e=!1,this._reserved-=1,this._update(this._attachments.value)),t===this._generation)};attach=t=>{if(!this._hasFreeSlot.value)return null;let a=`attachment-${++e}`;return this._update([...this._attachments.value,{...t,id:a}]),a};restore=t=>{let e=this._attachments.value,a=t.slice(0,Math.max(0,4-e.length-this._reserved));return this._update([...a,...e]),a.length===t.length};replace=(t,a)=>{let s=this._attachments.value;if(!s.some(e=>e.id===t))return null;let h={...a,id:`attachment-${++e}`};return this._update(s.map(e=>e.id===t?h:e)),h.id};remove=t=>{let e=this._attachments.value,a=e.filter(e=>e.id!==t);a.length!==e.length&&this._update(a)};clear=()=>{this._generation+=1,this._attachments.value.length>0&&this._update([])};_update=t=>{t!==this._attachments.value&&this._attachments.next(t);let e=t.length+this._reserved<4;e!==this._hasFreeSlot.value&&this._hasFreeSlot.next(e)}}
|