@salsita-ai/sdk 0.50.0-develop.9241bcf09e → 0.50.0-develop.927e2414eb
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 +3 -3
- package/dist/admin/common/admin-interface.d.ts +11 -1
- 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 +16 -0
- package/dist/application-spec/errors/diagnostic-codes.js +1 -1
- package/dist/application-spec/errors/diagnostic-messages.d.ts +16 -0
- 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/standalone-app-files.d.ts +0 -12
- 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 -4
- package/dist/application-spec/generate-application/code/templates/application-types.js +5 -5
- package/dist/application-spec/generate-application/code/templates/configurator-config.js +6 -6
- 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 -0
- package/dist/application-spec/generate-application/code/templates/domain-spec.js +12 -12
- 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 -12
- package/dist/application-spec/generate-application/code/templates/globals.js +21 -12
- package/dist/application-spec/generate-application/code/templates/index.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/index.js +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.d.ts +2 -1
- 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 +2 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/application-states/presets.js +1 -1
- 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/{custom-layout/assistant.d.ts → assistant/panel.d.ts} +1 -1
- 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/{webhooks/assistant-setup.d.ts → assistant/session-setup.d.ts} +1 -1
- 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 +2 -2
- 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-model/actions.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/embedding.d.ts +2 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/embedding.js +1 -0
- package/dist/application-spec/generate-application/code/templates/skills/features/features.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/authentication.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/authentication.js +32 -26
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/entry-and-environment.js +1 -3
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/publishing.js +1 -1
- 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/webhooks.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/guide.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill-bundle.d.ts +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/phoenix-skill-bundle.js +3 -3
- 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 +2 -2
- package/dist/application-spec/generate-application/code/templates/skills/processes/first-draft/handoff.js +1 -1
- package/dist/application-spec/generate-application/code/templates/skills/processes/index.d.ts +2 -1
- 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 +1 -1
- 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/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/sdk-channel.d.ts +17 -0
- package/dist/application-spec/generate-application/code/templates/skills/sdk-channel.js +1 -0
- 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 +3 -2
- package/dist/application-spec/generate-application/code/templates/webhook-index.d.ts +1 -2
- package/dist/application-spec/generate-application/code/templates/webhook-index.js +3 -7
- 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/analyzed-file.js +1 -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 +16 -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 +29 -6
- 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 +11 -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/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 +6 -9
- 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/index.d.ts +0 -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 +3 -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 +39 -4
- package/dist/client/contract.js +1 -1
- package/dist/client/index.d.ts +3 -1
- package/dist/client/index.js +1 -1
- package/dist/client/phoenix-api.d.ts +7834 -2378
- package/dist/client/unauthenticated-client.d.ts +2 -1
- package/dist/client/unauthenticated-client.js +1 -1
- package/dist/client/version.d.ts +11 -0
- package/dist/client/version.js +1 -1
- package/dist/configurator/application-runtime/extensions/selectors.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/action-system/action.d.ts +16 -4
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.d.ts +25 -10
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/assistant-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/graphql-tools.d.ts +15 -5
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/index.d.ts +1 -0
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/index.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/register-webmcp-tools.d.ts +7 -3
- package/dist/configurator/application-runtime/extensions/systems/assistant-system/webmcp/register-webmcp-tools.js +6 -2
- 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/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 +4 -2
- 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 +9 -3
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/graphql-system.js +1 -1
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/read-offered-navigation.d.ts +6 -3
- package/dist/configurator/application-runtime/extensions/systems/graphql-system/read-offered-navigation.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/common/configurator-interface.d.ts +13 -1
- package/dist/configurator/common/configurator-interface.js +1 -1
- package/dist/configurator/scene/animations/Animations.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/AssistantComposer.js +1 -1
- package/dist/configurator/ui/assistant/AssistantPanel.js +1 -1
- package/dist/configurator/ui/assistant/annotation/editor/AnnotationComment.d.ts +6 -5
- package/dist/configurator/ui/assistant/annotation/editor/AnnotationComment.js +1 -1
- package/dist/configurator/ui/assistant/annotation/editor/AnnotationEditor.d.ts +4 -3
- 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/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 +2 -3
- package/dist/configurator/ui/assistant/drawing/AssistantDrawing.js +1 -1
- package/dist/configurator/ui/assistant/drawing/index.d.ts +1 -1
- package/dist/configurator/ui/assistant/drawing/index.js +1 -1
- package/dist/configurator/ui/assistant/drawing/use-drawing-url.d.ts +6 -12
- package/dist/configurator/ui/assistant/drawing/use-drawing-url.js +1 -1
- package/dist/configurator/ui/assistant/form/registry/create-assistant-form-element.d.ts +11 -7
- package/dist/configurator/ui/assistant/form-elements/FormTile.js +1 -1
- package/dist/configurator/ui/assistant/image-view/ImageView.js +1 -1
- package/dist/configurator/ui/assistant/panel/AssistantPanelHeader.js +1 -1
- package/dist/configurator/ui/assistant/use-assistant-composer.d.ts +5 -0
- package/dist/configurator/ui/assistant/use-assistant-composer.js +2 -2
- 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/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/MobileLayout.js +3 -3
- package/dist/configurator/ui/configurator-layout/universal/MobilePreview.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 +117 -2
- package/dist/docs/layouts/nested-view-controls.mdx +223 -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 +53 -56
- package/dist/docs/phoenix/admin.mdx +5 -40
- 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/clerk-sign-in.mdx +9 -5
- package/dist/docs/phoenix/configurator-interface.mdx +18 -33
- package/dist/docs/phoenix/csp.mdx +3 -1
- package/dist/docs/phoenix/data-sources.mdx +26 -30
- package/dist/docs/phoenix/deployments.mdx +3 -3
- package/dist/docs/phoenix/finalization.mdx +0 -1
- package/dist/docs/phoenix/integration/authentication-external.mdx +17 -15
- package/dist/docs/phoenix/integration/authentication-internal.mdx +1 -1
- package/dist/docs/phoenix/integration/finalization-internal.mdx +1 -4
- package/dist/docs/phoenix/integration/integration-modes-external.mdx +2 -2
- package/dist/docs/phoenix/integration/integration-modes-internal.mdx +9 -0
- package/dist/docs/phoenix/layout-slots.mdx +1 -1
- package/dist/docs/phoenix/migrations.mdx +1 -1
- package/dist/docs/phoenix/phoenix-cli.mdx +90 -57
- 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 +51 -34
- package/dist/docs/phoenix/sessions-and-access.mdx +171 -164
- package/dist/docs/phoenix/webhook-membership.mdx +4 -1
- package/dist/docs/phoenix/webhooks.mdx +93 -116
- package/dist/docs/ux-guidelines/interaction-modes.mdx +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 +36 -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/build-assistant-lenses.js +3 -3
- package/dist/domain/application/assistant/build-assistant-manifest.js +1 -1
- package/dist/domain/application/assistant/generate-assistant-prompt.d.ts +6 -2
- package/dist/domain/application/assistant/generate-assistant-prompt.js +1 -1
- package/dist/domain/application/assistant/index.d.ts +1 -0
- package/dist/domain/application/assistant/index.js +1 -1
- 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 +14 -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-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 +2 -0
- 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.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 +6 -0
- 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/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 +8 -0
- package/dist/domain/domain-runtime/domain-context/domain-context.js +1 -1
- package/dist/domain/domain-runtime/domain-context/selectors.d.ts +1 -0
- package/dist/domain/domain-runtime/domain-context/selectors.js +1 -1
- package/dist/domain/domain-runtime/domain-context/types.d.ts +8 -4
- package/dist/domain/domain-runtime/domain-runtime.d.ts +8 -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 +0 -1
- package/dist/domain/extensions/index.js +1 -1
- package/dist/domain/mocks/create-mock-domain-runtime.d.ts +4 -0
- package/dist/domain/spec/sections/actions.d.ts +3 -2
- package/dist/domain/spec/sections/app-metadata.d.ts +12 -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 +17 -6
- package/dist/domain/spec/sections/assistant/assistant-resolved-manifest.d.ts +28 -5
- package/dist/domain/spec/sections/assistant/index.d.ts +1 -0
- 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/domain-editors/use-implementation-files.js +1 -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 +14 -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 -2
- package/dist/extras/cognito/CognitoSignInPage.js +1 -1
- 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 +9 -0
- package/dist/extras/cognito/SignInNotice.js +1 -0
- package/dist/extras/cognito/index.d.ts +4 -0
- package/dist/extras/cognito/index.js +1 -1
- 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-spec/__generated/domain-schema.d.ts +12 -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/phoenix/application-spec/index.d.ts +1 -1
- package/dist/phoenix/application-spec/index.js +1 -1
- package/dist/phoenix/application-spec/resolve-deployment-data.d.ts +10 -3
- package/dist/phoenix/application-spec/resolve-deployment-data.js +2 -2
- package/dist/phoenix/cli.js +1 -1
- package/dist/phoenix/commands/account/whoami.d.ts +8 -2
- package/dist/phoenix/commands/account/whoami.js +4 -3
- 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/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/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 +1 -1
- package/dist/phoenix/commands/login.js +2 -2
- 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/services/cli-credentials.d.ts +13 -2
- 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 +25 -0
- package/dist/phoenix/services/cli-server/resolve-cli-server-url.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 +4 -2
- package/dist/phoenix/services/index.js +1 -1
- package/dist/phoenix/services/phoenix-regions.d.ts +15 -5
- 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.js +1 -1
- 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/variant-file-session.js +1 -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/selectors.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/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/runtime/create-application-runtime.d.ts +20 -6
- 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 +64 -2
- 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 +1 -0
- 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.js +1 -1
- 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/server-sign-in-support.d.ts +16 -0
- package/dist/react-sdk/session/server-sign-in-support.js +1 -0
- package/dist/react-sdk/session/sign-in-address.d.ts +18 -0
- package/dist/react-sdk/session/sign-in-address.js +1 -0
- package/dist/react-sdk/session/studio-frame.d.ts +14 -0
- package/dist/react-sdk/session/studio-frame.js +1 -0
- package/dist/react-sdk/session/use-sign-in.d.ts +51 -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/webhook/builders/auth-handler-builder.d.ts +21 -1
- package/dist/webhook/builders/auth-handler-builder.js +1 -1
- package/dist/webhook/builders/common.d.ts +9 -0
- package/dist/webhook/builders/webhook-builder.d.ts +18 -0
- package/dist/webhook/builders/webhook-builder.js +1 -1
- package/package.json +5 -4
- package/schema/domain-spec.json +224 -65
- package/dist/application-spec/generate-application/code/templates/skills/features/custom-layout/assistant.js +0 -43
- package/dist/application-spec/generate-application/code/templates/skills/features/webhooks/assistant-setup.js +0 -32
- package/dist/application-spec/generate-application/code/templates/skills/processes/beta.d.ts +0 -14
- package/dist/application-spec/generate-application/code/templates/skills/processes/beta.js +0 -4
- package/dist/domain/extensions/view-controls.d.ts +0 -25
- package/dist/domain/extensions/view-controls.js +0 -1
|
@@ -143,8 +143,43 @@ export interface ResourcesConfig {
|
|
|
143
143
|
* `authenticated` is 'error'. 'authorization-code-rejected' means the attempt consumed a supplied
|
|
144
144
|
* authorization code — sign-in pages must not automatically mint and retry a new one, otherwise a
|
|
145
145
|
* persistently failing auth webhook turns the silent sign-in into an unbounded retry loop.
|
|
146
|
+
* 'configurator-unavailable' means the server starts no session of this configurator now, for a reason
|
|
147
|
+
* the buyer is not told; the configurator shows its "unavailable" page instead of a sign-in.
|
|
146
148
|
*/
|
|
147
|
-
export type AuthenticationErrorCode = 'authorization-code-rejected' | 'authentication-failed';
|
|
149
|
+
export type AuthenticationErrorCode = 'authorization-code-rejected' | 'authentication-failed' | 'configurator-unavailable';
|
|
150
|
+
/** The Studio account a sign-in names. `name` is the account's display name, null when it has none. */
|
|
151
|
+
export interface SignInAccount {
|
|
152
|
+
readonly email: string;
|
|
153
|
+
readonly name: string | null;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Outcome of the latest Studio-account sign-in on this page, kept beside the session it led to:
|
|
157
|
+
*
|
|
158
|
+
* - `idle` — nothing to report: no sign-in started, or the last one completed.
|
|
159
|
+
* - `ended` — the sign-in ended while the page was signed in (a sign-out elsewhere, removed access or its 30 days), and
|
|
160
|
+
* the page continues as a visitor with what is on screen.
|
|
161
|
+
* - `signing-in` — the page is on its way to the sign-in form, or redeeming the code it came back with.
|
|
162
|
+
* - `refused` — the account is not invited, or the project's signed-in handler refused it. `account` is null only when
|
|
163
|
+
* the server did not name it.
|
|
164
|
+
* - `failed` — the sign-in did not finish: the code was already used or expired (`not-completed`), or the server could
|
|
165
|
+
* not complete it right now and trying again may help (`unavailable`). `message` is the technical detail.
|
|
166
|
+
*
|
|
167
|
+
* A refused or failed sign-in leaves the page a visitor where visitors may use the configurator.
|
|
168
|
+
*/
|
|
169
|
+
export type SignInOutcome = {
|
|
170
|
+
readonly state: 'idle';
|
|
171
|
+
} | {
|
|
172
|
+
readonly state: 'ended';
|
|
173
|
+
} | {
|
|
174
|
+
readonly state: 'signing-in';
|
|
175
|
+
} | {
|
|
176
|
+
readonly state: 'refused';
|
|
177
|
+
readonly account: SignInAccount | null;
|
|
178
|
+
} | {
|
|
179
|
+
readonly state: 'failed';
|
|
180
|
+
readonly reason: 'not-completed' | 'unavailable';
|
|
181
|
+
readonly message: string;
|
|
182
|
+
};
|
|
148
183
|
export interface Session<SESSION_DATA extends Record<string, unknown>> {
|
|
149
184
|
readonly rawSessionToken: string | null;
|
|
150
185
|
readonly rawAdminSessionToken: string | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AssistantManifest, AssistantResolvedManifest } from '../../spec/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The assistant object type that stands for every entity of a type the manifest does not expose:
|
|
4
|
+
* it implements only `AnyDomainEntity`, and its `type` field names the entity's real type.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ASSISTANT_OTHER_ENTITY = "OtherEntity";
|
|
7
|
+
/**
|
|
8
|
+
* The entity types the assistant schema gives their own object type, in model order: the root types,
|
|
9
|
+
* and every type an assistant section names, directly or through an alias. Naming `AnyDomainEntity`
|
|
10
|
+
* exposes every type. `names` are the keys of the `entities`, `writable`, `deletable`, `childRecipes`,
|
|
11
|
+
* `replaceRecipes`, `screenshots` and `navigation.select` sections. The resolver computes them from
|
|
12
|
+
* the spec and the session setup again from its narrowed sections.
|
|
13
|
+
*/
|
|
14
|
+
export declare const assistantExposedTypes: (names: Iterable<string>, { entityTypes, aliases }: Pick<AssistantResolvedManifest, 'entityTypes' | 'aliases'>) => readonly string[];
|
|
15
|
+
/**
|
|
16
|
+
* Whether the assistant sees an entity of this type in detail: its type has its own object type,
|
|
17
|
+
* which its entry in the manifest's field table says. Change results and the change record list
|
|
18
|
+
* only such entities.
|
|
19
|
+
*/
|
|
20
|
+
export declare const isAssistantVisible: ({ type }: {
|
|
21
|
+
readonly type: string;
|
|
22
|
+
}, { fields }: Pick<AssistantManifest, 'fields'>) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ASSISTANT_OTHER_ENTITY="OtherEntity";export const assistantExposedTypes=(t,{entityTypes:s,aliases:e})=>{let n=[...t,"RootEntity"];return s.filter(t=>n.some(s=>s===t||Object.entries(e).some(([e,n])=>e===s&&n.includes(t))))};export const isAssistantVisible=({type:t},{fields:s})=>Object.hasOwn(s,t);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{NoUnusedFragmentsRule as e,parse as t,specifiedRules as i,validate as n}from"graphql";let r="AnyDomainEntity",s=[{name:"RecipeGroup",description:"A recipe group with its recipes, without their dry-runs.",selections:["groupId","name","description","recipes { ...Recipe }"]},{name:"Recipe",description:"A recipe without its dry-run.",selections:["key","name","description","imageUrl"]},{name:"FieldOption",description:"A value a field accepts, without its dry-run.",selections:["value","name","description","imageUrl","color"]},{name:"DryRun",description:"What a dry-run would do, with the ids of the entities it would change instead of the entities.",selections:["ok","deletedEntityIds","sideEffects","warnings","errors","changedEntities { id }"]}],a=(e,t)=>0===t?e:`${e}__${t}`,
|
|
2
|
-
${p(e,n,`...${e}`)}`}),...$.map(({name:e,description:t,selections:i})=>`${
|
|
3
|
-
${
|
|
1
|
+
import{NoUnusedFragmentsRule as e,parse as t,specifiedRules as i,validate as n}from"graphql";let r="AnyDomainEntity",s=[{name:"RecipeGroup",description:"A recipe group with its recipes, without their dry-runs.",selections:["groupId","name","description","recipes { ...Recipe }"]},{name:"Recipe",description:"A recipe without its dry-run.",selections:["key","name","description","imageUrl"]},{name:"FieldOption",description:"A value a field accepts, without its dry-run.",selections:["value","name","description","imageUrl","color"]},{name:"DryRun",description:"What a dry-run would do, with the ids of the entities it would change instead of the entities.",selections:["ok","deletedEntityIds","sideEffects","warnings","errors","changedEntities { id }"]}],a=(e,t)=>0===t?e:`${e}__${t}`,o=e=>e.split("\n").map(e=>`# ${e}`.trimEnd()).join("\n"),l=(e,t,i)=>[`fragment ${e} on ${t} {`,...i.map(e=>` ${e}`),"}"].join("\n"),p=(e,t,i)=>{let n=e=>"edge"===e.type.kind?`${e.name} { ${i} }`:e.name;return l(e,r,["id",...t.flatMap(({typeName:e,fields:t})=>e===r?t.map(n):[`... on ${e} {`,...t.map(e=>` ${n(e)}`),"}"])])};export const buildAssistantLenses=(d,m)=>{let c=Object.entries(d.lenses).flatMap(([e,t])=>{let i=[r,...Object.keys(d.aliases).filter(e=>e!==r),...d.entityTypes].flatMap(t=>{let i=(d.fields[t]??[]).filter(t=>t.lenses?.includes(e));return i.length>0&&void 0!==m.getType(t)?[{typeName:t,fields:i}]:[]});return i.length>0?[{name:e,...t,conditions:i}]:[]}),$=s.filter(({name:e})=>void 0!==m.getType(e)),h=[...c.map(({name:e,description:t,maxDepth:i,conditions:n})=>{let r=n.some(({fields:e})=>e.some(e=>"edge"===e.type.kind));return`${o(r?`${t} ${`Nested relations carry the same selection up to ${i} ${1===i?"level":"levels"}, below that only \`id\`.`}`:t)}
|
|
2
|
+
${p(e,n,`...${e}`)}`}),...$.map(({name:e,description:t,selections:i})=>`${o(t)}
|
|
3
|
+
${l(e,e,i)}`)].join("\n\n"),u=[...c.flatMap(({name:e,maxDepth:t,conditions:i})=>Array.from({length:t+1},(n,r)=>p(a(e,r),i,r<t?`...${a(e,r+1)}`:"id"))),...$.map(({name:e,selections:t})=>l(e,e,t))].join("\n\n");if(""!==u){let r=c.length>0?`entities { ${c.map(({name:e})=>`...${e}`).join(" ")} }`:"__typename",s=n(m,t(`${u}
|
|
4
4
|
|
|
5
5
|
{ ${r} }`),i.filter(t=>t!==e));if(s.length>0)throw Error(`The lens fragments generated from "assistant.lenses" are not valid GraphQL: ${[...new Set(s.map(e=>e.message))].join(" ")}`)}return{declarations:h,definitions:u}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{GraphQLBoolean as e,GraphQLEnumType as t,GraphQLID as n,GraphQLInputObjectType as i,GraphQLInterfaceType as s,GraphQLList as o,GraphQLNonNull as a,GraphQLObjectType as r,GraphQLSchema as c,GraphQLString as l,printSchema as d,validateSchema as p}from"graphql";import{GraphQLJSON as h,createAssistantValueType as w}from"./assistant-value-type.js";import{buildAssistantLenses as y}from"./build-assistant-lenses.js";import{createAssistantExecutionSchema as g}from"./create-assistant-execution-schema.js";let u="AnyDomainEntity",m="RootEntity",f={section:"childRecipes",mutation:"addChild",typeSuffix:"ChildRecipes"},v={section:"replaceRecipes",mutation:"replaceEntity",typeSuffix:"ReplaceRecipes"},b=(e,t)=>Object.entries(e).find(([e])=>e===t)?.[1],S=({target:e,list:t,nullableItems:n,nullable:i},s)=>{let r=s(e),c=t?new o(n?r:new a(r)):r;return i?c:new a(c)},$=(e,t,i)=>{let s={id:{type:new a(n),description:i?`Unique id of the entity, assigned by the configurator, e.g. "${i}-1".`:void 0},type:{type:new a(l),description:i?`Entity type name, e.g. "${i}".`:void 0}};for(let n of e)s[n.name]={type:"edge"===n.type.kind?S(n.type,t):w(n.type.type),description:n.description};return s},j=e=>Object.fromEntries(e.map(({name:e,source:t,localized:n})=>[e,n?{source:t,localized:!0}:{source:t}])),O=(e,n)=>n.length>0?new t({name:e,values:Object.fromEntries(n.map(({name:e,description:t})=>[e,{description:t}]))}):void 0,E=e=>({type:new a(new o(new a(e)))}),R=new a(new o(new a(h))),k=' Each is { type, severity, entityId, message }: severity is "warning" or "notice", entityId the entity it is on or null, message the warning as the user would be told it or null.',T={sameForAllInstances:e=>`Same recipes for every ${e}.`,constantDuringSession:()=>"Fixed for the session."},I={sameForAllInstances:e=>`Same for every ${e}.`,constantDuringSession:()=>"Fixed for the session."},N=(e,t,n)=>e.map(e=>` ${t[e](n)}`).join(""),A=({section:e,typeSuffix:t},n,{entityType:i,purpose:s,recipeGroup:o})=>0===n.length?{}:{[e]:{type:new a(new r({name:`${i}${t}`,fields:Object.fromEntries(n.map(({groupId:e,description:t,dryRuns:n,hints:s})=>{let a;return[e,{type:o,description:`${!(a=t?.trim())?"":/[.!?]$/.test(a)?`${a} `:`${a}. `}Null while the configurator does not offer it on the entity.${n?"":" Cannot be dry-run."}${N(s,T,i)}`}]}))})),description:`The recipe groups for ${s} this ${i}, one field each.`}},M=({entityType:n,childRecipes:i,replaceRecipes:s,optionsEdges:c,screenshots:l,selectable:d,hasInvariants:p},{recipeGroup:w,fieldOption:y,screenshot:g})=>new r({name:`${n}Meta`,fields:Object.assign(A(f,i,{entityType:n,purpose:"adding children to",recipeGroup:w}),A(v,s,{entityType:n,purpose:"replacing",recipeGroup:w}),...c.map(({options:{edgeName:e,field:t,validate:i,dryRuns:s},hints:r})=>({[e]:{type:new o(new a(y)),args:{values:{type:new o(new a(h)),description:"Only the options with these values; values not listed are ignored."}},description:`Values "${t}" accepts on this ${n}. Null when there is no choice to make.${i?"":" Not checked on write."}${s?"":" Cannot be dry-run."}${N(r,I,n)}`}})),0===l.length?{}:{screenshot:{type:g,args:{view:{type:new a(new t({name:`${n}ScreenshotView`,values:Object.fromEntries(l.map(({view:e,description:t})=>[e,{description:t}]))}))}},description:"Renders this entity from a predefined view. The picture follows the tool result as an image labelled with `image`. Null when the view does not apply to this entity right now."}},d?{selectable:{type:new a(e),description:`Whether the user can select this ${n} right now, so select(id:) can select it.`}}:{},p?{warnings:{type:R,description:`The warnings and notices this ${n} has right now.${k}`}}:{})}),W=(e,t)=>t?e?"What can be done to this entity right now, and its warnings.":"The warnings of this entity right now.":"What can be done to this entity right now.",C=e=>Object.entries(e).map(([e,t])=>`${e} (${t.map(({groupId:e})=>e).join(", ")})`);export const buildAssistantManifest=t=>{var T;let I,N,A,x,D,F,{entityTypes:q,aliases:G,exampleType:U,fields:V,states:K,deletableTypes:P,writableTypes:z,actionFields:L,navigation:Q,optionsEdges:B,invariantTypes:H}=t,{childRecipes:J,replaceRecipes:X}=t,Y=new Map,Z=new Map,_=new Map,ee=e=>{let[t,...n]=Object.entries(G).find(([t])=>t===e)?.[1]??[];return(t&&0===n.length?Z.get(t):void 0)??_.get(e)??en},et=e=>Z.get(e)??ee(e),en=new s({name:u,description:"Every entity of the configuration.",fields:()=>$(V[u]??[],et,U)});for(let e of(_.set(u,en),Object.keys(G)))e!==u&&_.set(e,new s({name:e,interfaces:[en],fields:()=>$(V[e]??[],et)}));let ei={};for(let e of q){let t=[u,...Object.entries(G).filter(([t,n])=>t!==u&&n.includes(e)).map(([e])=>e)],n=V[e]??[];ei[e]=j(n),Z.set(e,new r({name:e,interfaces:t.flatMap(e=>_.get(e)??[]),fields:()=>{let t=Y.get(e);return{...$(n,et),...t?{meta:{type:new a(t.type),description:t.description}}:{}}}}))}let es=(I=()=>ee(_.has(m)?m:u),N=()=>ee(u),new r({name:"DryRun",description:"What using a recipe or writing an option would do, tried out on the configuration the query reads. Nothing is changed.",fields:()=>({ok:{type:new a(e),description:"Whether the change would succeed on the configuration the query reads."},root:{type:I(),description:"The root entity of the configuration as it would be after the change; null when ok is false. Everything selected under it reads that configuration."},changedEntities:{type:new a(new o(new a(N()))),description:"Entities the change would add or modify; empty when ok is false. One whose id is not in the configuration would be added, and its real id may differ. An entity written to is listed even when its values stay the same."},deletedEntityIds:{type:new a(new o(new a(n))),description:"The ids of the entities the change would remove; empty when ok is false."},sideEffects:{type:new a(new o(new a(l))),description:"The major or unexpected things the configurator would change along with it; empty when ok is false."},warnings:{type:R,description:`The warnings and notices the change would newly cause, which do not stop it; empty when ok is false.${k}`},errors:{type:R,description:"Why the change cannot be made; empty when ok is true. Each is { type, entityId, message, details? }: type the kind of problem, entityId the entity it is on or null, message the problem as the user would be told it, and details what this change in particular would do, only when it says more than message."}})})),eo={recipeGroup:(T=[...Object.keys(J).length>0?[f.mutation]:[],...Object.keys(X).length>0?[v.mutation]:[]],A=T.join(" or "),x=new r({name:"Recipe",description:`${T.includes("addChild")?"One thing that can be added to the entity (under childRecipes)":"One thing the entity can be replaced with (under replaceRecipes)"}${T.length>1?" or that it can be replaced with (under replaceRecipes)":""}.`,fields:{key:{type:new a(l),description:`Pass to ${A} as recipeKey, or to recipes(keys:) to read this recipe again.`},name:{type:new a(l),description:"Name shown to the user."},description:{type:l},imageUrl:{type:l,description:"Thumbnail shown to the user."},dryRun:{type:es,description:"What using this recipe would do. Null when it cannot be tried."}}}),new r({name:"RecipeGroup",description:"A group of recipes for this entity.",fields:{groupId:{type:new a(l),description:`Pass to ${A} as recipeGroupId.`},name:{type:new a(l),description:"Name shown to the user."},description:{type:l},recipes:{type:new a(new o(new a(x))),args:{keys:{type:new o(new a(l)),description:"Only the recipes with these keys; keys not in the group are ignored."}}}}})),fieldOption:new r({name:"FieldOption",description:"One value a field accepts. Writing a value outside the list is rejected unless the field description says it is not checked.",fields:{value:{type:new a(h),description:"The value to write to the field."},name:{type:l,description:"Name shown to the user."},description:{type:l},imageUrl:{type:l,description:"Image shown to the user."},color:{type:l,description:'Color shown to the user, as "#rrggbb".'},dryRun:{type:es,description:"What writing this value would do. Null when it cannot be tried."}}}),screenshot:new r({name:"Screenshot",description:"A screenshot of an entity. The picture itself follows the tool result.",fields:{image:{type:new a(n),description:"Label of the image that follows the tool result."}}})};for(let e of q){let n=b(J,e)??[],i=b(X,e)??[],s=b(B,e)??[],o=b(t.screenshots,e)??[],a=H.includes(e),r=t.select.some(t=>t.entityTypes.includes(e)),c=n.length>0||i.length>0||s.length>0||o.length>0||r;(c||a)&&Y.set(e,{description:W(c,a),type:M({entityType:e,childRecipes:n,replaceRecipes:i,optionsEdges:s,screenshots:o,selectable:r,hasInvariants:a},eo)})}let ea={navigationState:O("NavigationState",Q.navigationStates),viewState:O("ViewState",Q.viewStates),toolState:O("ToolState",Q.toolStates)},er=((e,t)=>{let n={...e.navigationStates.length>1?{navigationState:{type:new a(l),description:t.navigationState?"Active navigation state; it may be one `NavigationState` does not list.":"Active navigation state."}}:{},...e.viewStates.length>1?{viewState:{type:new a(l),description:t.viewState?"Active view state; it may be one `ViewState` does not list.":"Active view state."}}:{},...e.toolStates.length>1?{toolState:{type:new a(l),description:t.toolState?"Active tool state; it may be one `ToolState` does not list.":"Active tool state."}}:{},...(({navigationState:e,viewState:t,toolState:n})=>e||t||n?{available:{type:new a(new r({name:"AvailableNavigation",description:"The states the user can be moved to right now, besides the active ones.",fields:{...e?{navigationStates:E(e)}:{},...t?{viewStates:E(t)}:{},...n?{toolStates:E(n)}:{}}}))}}:{})(t)};if(0!==Object.keys(n).length)return new r({name:"Navigation",description:"The active UI states of the configurator.",fields:n})})(K,ea),ec=new c({query:(D=ee(_.has(m)?m:u),F=ee(u),new r({name:"Query",fields:{root:{type:new a(D),description:"The root entity of the configuration."},entities:{type:new a(new o(F)),args:{ids:{type:new o(new a(n))}},description:"Every entity, or the given ids in order with null for an unknown id."},selectedEntity:{type:new a(F),description:"The selected entity, or the root entity when nothing is selected."},...er?{navigation:{type:new a(er)}}:{},warnings:{type:R,description:`Every warning and notice of the configuration the query reads.${k}`}}})),mutation:(({deletableTypes:e,writableTypes:t,childRecipes:s,replaceRecipes:c,actionFields:d,navigationMutations:p,selectionMutations:h,objectTypes:y,anyDomainEntity:g,targetOutputType:u})=>{let m,f;if(0!==e.length||0!==t.length||0!==Object.keys(s).length||0!==Object.keys(c).length||0!==d.length||0!==Object.keys(p).length||0!==Object.keys(h).length)return new r({name:"Mutation",fields:Object.assign(0===e.length?{}:{deleteEntity:{type:new a(new o(new a(n))),args:{id:{type:new a(n)}},description:`Deletes the entity and everything composed into it. Deletable types: ${e.join(", ")}. Returns the ids removed, the given one first.`}},0===(m=C(s)).length?{}:{addChild:{type:new a(new o(new a(g))),args:{parentId:{type:new a(n)},recipeGroupId:{type:new a(l)},recipeKey:{type:new a(l)}},description:`Adds a child to the entity parentId from a recipe listed under its meta { childRecipes }. Types with child recipes: ${m.join("; ")}. Returns the entities added, the recipe's own first; empty when they were removed again.`}},0===(f=C(c)).length?{}:{replaceEntity:{type:new a(new o(new a(g))),args:{entityId:{type:new a(n)},recipeGroupId:{type:new a(l)},recipeKey:{type:new a(l)}},description:`Replaces the entity entityId from a recipe listed under its meta { replaceRecipes }. Types with replace recipes: ${f.join("; ")}. The replacement is a new entity: it has a new id and the field values of its recipe, and entityId no longer exists. Returns the entities added, the replacement first; empty when they were removed again.`}},...t.flatMap(e=>{let t=y.get(e.entityType);return t?[(({entityType:e,fields:t},s)=>{let o=Object.fromEntries(t.map(({name:e,type:t,description:n})=>[e,{type:w(t),description:n}]));return{[`modify${e}`]:{type:s,args:{id:{type:new a(n)},delta:{type:new a(new i({name:`${e}Delta`,fields:o}))}},description:`Sets the fields named in delta on one ${e}. Returns the entity after the change, or null when the change removed it.`}}})(e,t)]:[]}),Object.fromEntries(d.map(e=>{var t;return[e.fieldName,{type:new a(new r({name:(t=e.fieldName,`${t.charAt(0).toUpperCase()+t.slice(1)}Result`),description:`What ${e.fieldName} returns, read from the configuration after the change.`,fields:()=>Object.fromEntries(Object.entries(e.result).map(([e,t])=>[e,{type:"edge"===t.kind?S(t,u):w(t.type),description:t.description}]))})),args:Object.fromEntries(Object.entries(e.args).map(([e,t])=>[e,{type:w(t.type),description:t.description}])),description:e.description}]})),p,h)})})({deletableTypes:P,writableTypes:z,childRecipes:J,replaceRecipes:X,actionFields:L,navigationMutations:(({navigationState:e,viewState:t,toolState:n},i)=>i?{...e?{navigate:{type:new a(i),args:{to:{type:new a(e)}},description:"Switches the page the user is on to one listed under navigation { available { navigationStates } }; setting the active one changes nothing. Returns the navigation after the switch."}}:{},...t?{setView:{type:new a(i),args:{to:{type:new a(t)}},description:"Switches the view the user sees to one listed under navigation { available { viewStates } }; setting the active one changes nothing. Returns the navigation after the switch."}}:{},...n?{setTool:{type:new a(i),args:{to:{type:new a(n)}},description:"Switches the tool the user works with to one listed under navigation { available { toolStates } }; setting the active one changes nothing. Returns the navigation after the switch."}}:{}}:{})(ea,er),selectionMutations:((e,t)=>{if(0===e.length)return{};let i=e.map(({name:e,description:t})=>void 0===t?e:`${e}: ${t}`);return{select:{type:new a(t),args:{id:{type:new a(n)}},description:`Selects the entity id, as the user does by clicking it, when its meta { selectable } is true; selecting the selected entity changes nothing. Types that can be selected: ${i.join("; ")}. Returns the selected entity.`},deselect:{type:new a(t),description:"Clears the selection, so the root entity is selected. Returns the selected entity."}}})(t.select,ee(u)),objectTypes:Z,anyDomainEntity:ee(u),targetOutputType:et}),types:[..._.values(),...Z.values()]}),el=p(ec);if(el.length>0)throw Error(el.map(e=>e.message).join(" "));let ed=d(ec);return{sdl:ed,navigationFields:[...K.navigationStates.length>1?["navigationState"]:[],...K.viewStates.length>1?["viewState"]:[],...K.toolStates.length>1?["toolState"]:[]],navigation:Q,select:t.select,fields:ei,deletableTypes:P,writableFields:Object.fromEntries(z.map(({entityType:e,fields:t})=>[e,Object.fromEntries(t.map(({name:e,property:t})=>[e,t]))])),childRecipes:J,replaceRecipes:X,fieldOptions:Object.fromEntries(q.flatMap(e=>{let t=b(B,e);return t?[[e,t.map(({options:e})=>e)]]:[]})),screenshots:Object.fromEntries(q.flatMap(e=>{let n=b(t.screenshots,e);return n?[[e,n]]:[]})),actions:Object.fromEntries(L.map(({fieldName:e,actionName:t})=>[e,t])),lenses:y(t,g(ed)),formElements:t.formElements,...void 0!==t.instructions&&{instructions:t.instructions},...!1===t.webmcp&&{webmcp:!1}}};
|
|
1
|
+
import{GraphQLBoolean as e,GraphQLEnumType as t,GraphQLID as n,GraphQLInputObjectType as i,GraphQLInterfaceType as s,GraphQLList as o,GraphQLNonNull as a,GraphQLObjectType as r,GraphQLSchema as d,GraphQLString as h,printSchema as l,validateSchema as c}from"graphql";import{ASSISTANT_OTHER_ENTITY as p}from"./assistant-exposure.js";import{GraphQLJSON as y,createAssistantValueType as w}from"./assistant-value-type.js";import{buildAssistantLenses as g}from"./build-assistant-lenses.js";import{createAssistantExecutionSchema as u}from"./create-assistant-execution-schema.js";let f="AnyDomainEntity",m="RootEntity",v={section:"childRecipes",mutation:"addChild",typeSuffix:"ChildRecipes"},b={section:"replaceRecipes",mutation:"replaceEntity",typeSuffix:"ReplaceRecipes"},$=(e,t)=>Object.entries(e).find(([e])=>e===t)?.[1],S=({target:e,list:t,nullableItems:n,nullable:i},s)=>{let r=s(e),d=t?new o(n?r:new a(r)):r;return i?d:new a(d)},j=()=>void 0,O=(e,t)=>{if(void 0===t)return e;let n=`Accepts the values listed under meta { ${t} }.`;return e?`${e}${/[.!?]$/.test(e)?"":"."} ${n}`:n},E=(e,t)=>{let n=e.map(e=>$(t,e)??[]);return e=>{let[t,...i]=n.map(t=>t.find(t=>t.options.field===e)?.options.edgeName);return void 0!==t&&i.every(e=>e===t)?t:void 0}},R=(e,t,{exampleType:i,optionsEdgeOf:s=j}={})=>{let o={id:{type:new a(n),description:i?`Unique id of the entity, assigned by the configurator, e.g. "${i}-1".`:void 0},type:{type:new a(h),description:i?`Entity type name, e.g. "${i}".`:void 0}};for(let n of e)o[n.name]="edge"===n.type.kind?{type:S(n.type,t),description:n.description}:{type:w(n.type.type),description:O(n.description,s(n.name))};return o},k=e=>Object.fromEntries(e.map(({name:e,source:t,localized:n})=>[e,n?{source:t,localized:!0}:{source:t}])),T=(e,n)=>n.length>0?new t({name:e,values:Object.fromEntries(n.map(({name:e,description:t})=>[e,{description:t}]))}):void 0,A=e=>({type:new a(new o(new a(e)))}),I=new a(new o(new a(y))),N=' Each is { type, severity, entityId, message }: severity is "warning" or "notice", entityId the entity it is on or null, message the warning as the user would be told it or null.',M={sameForAllInstances:e=>`Same recipes for every ${e}.`,constantDuringSession:()=>"Fixed for the session."},x={sameForAllInstances:e=>`Same for every ${e}.`,constantDuringSession:()=>"Fixed for the session."},W=(e,t,n)=>e.map(e=>` ${t[e](n)}`).join(""),C=({section:e,typeSuffix:t},n,{entityType:i,purpose:s,recipeGroup:o})=>0===n.length?{}:{[e]:{type:new a(new r({name:`${i}${t}`,fields:Object.fromEntries(n.map(({groupId:e,description:t,dryRuns:n,hints:s})=>{let a;return[e,{type:o,description:`${!(a=t?.trim())?"":/[.!?]$/.test(a)?`${a} `:`${a}. `}Null while the configurator does not offer it on the entity.${n?"":" Cannot be dry-run."}${W(s,M,i)}`}]}))})),description:`The recipe groups for ${s} this ${i}, one field each.`}},D=({entityType:n,childRecipes:i,replaceRecipes:s,optionsEdges:d,screenshots:h,selectable:l,hasInvariants:c},{recipeGroup:p,fieldOption:w,screenshot:g})=>new r({name:`${n}Meta`,fields:Object.assign(C(v,i,{entityType:n,purpose:"adding children to",recipeGroup:p}),C(b,s,{entityType:n,purpose:"replacing",recipeGroup:p}),...d.map(({options:{edgeName:e,field:t,validate:i,dryRuns:s},hints:r})=>({[e]:{type:new o(new a(w)),args:{values:{type:new o(new a(y)),description:"Only the options with these values; values not listed are ignored."}},description:`Values "${t}" accepts on this ${n}. Null when there is no choice to make.${i?"":" Not checked on write."}${s?"":" Cannot be dry-run."}${W(r,x,n)}`}})),0===h.length?{}:{screenshot:{type:g,args:{view:{type:new a(new t({name:`${n}ScreenshotView`,values:Object.fromEntries(h.map(({view:e,description:t})=>[e,{description:t}]))}))}},description:"Renders this entity from a predefined view. The picture follows the tool result as an image labelled with `image`. Null when the view does not apply to this entity right now."}},l?{selectable:{type:new a(e),description:`Whether the user can select this ${n} right now, so select(id:) can select it.`}}:{},c?{warnings:{type:I,description:`The warnings and notices this ${n} has right now.${N}`}}:{})}),F=(e,t)=>t?e?"What can be done to this entity right now, and its warnings.":"The warnings of this entity right now.":"What can be done to this entity right now.",q=e=>Object.entries(e).map(([e,t])=>`${e} (${t.map(({groupId:e})=>e).join(", ")})`);export const buildAssistantManifest=t=>{var M;let x,W,C,U,V,K,{entityTypes:G,aliases:P,exampleType:z,fields:B,states:L,deletableTypes:Q,writableTypes:H,actionFields:J,navigation:X,optionsEdges:Y,invariantTypes:Z}=t,{childRecipes:_,replaceRecipes:ee}=t,et=t.exposedTypes??G,en=new Map,ei=new Map,es=new Map,eo=e=>{let[t,...n]=Object.entries(P).find(([t])=>t===e)?.[1]??[];return(t&&0===n.length?ei.get(t):void 0)??es.get(e)??er},ea=e=>ei.get(e)??eo(e),er=new s({name:f,description:"Every entity of the configuration.",fields:()=>R(B[f]??[],ea,{exampleType:z,optionsEdgeOf:et.length===G.length?E(G,Y):j})});for(let[e,t]of(es.set(f,er),Object.entries(P)))e!==f&&t.every(e=>et.includes(e))&&es.set(e,new s({name:e,interfaces:[er],fields:()=>R(B[e]??[],ea,{optionsEdgeOf:E(t,Y)})}));let ed={};for(let e of et){let t=[f,...Object.entries(P).filter(([t,n])=>t!==f&&n.includes(e)).map(([e])=>e)],n=B[e]??[];ed[e]=k(n),ei.set(e,new r({name:e,interfaces:t.flatMap(e=>es.get(e)??[]),fields:()=>{let t=en.get(e);return{...R(n,ea,{optionsEdgeOf:E([e],Y)}),...t?{meta:{type:new a(t.type),description:t.description}}:{}}}}))}let eh=et.length<G.length?new r({name:p,description:"An entity of a type this schema does not describe in detail: `type` names its type, and only the fields of AnyDomainEntity can be read.",interfaces:[er],fields:()=>R(B[f]??[],ea,{exampleType:z})}):void 0;eh&&(ed[p]=k(B[f]??[]));let el=(x=()=>eo(es.has(m)?m:f),W=()=>eo(f),new r({name:"DryRun",description:"What using a recipe or writing an option would do, tried out on the configuration the query reads. Nothing is changed.",fields:()=>({ok:{type:new a(e),description:"Whether the change would succeed on the configuration the query reads."},root:{type:x(),description:"The root entity of the configuration as it would be after the change; null when ok is false. Everything selected under it reads that configuration."},changedEntities:{type:new a(new o(new a(W()))),description:"Entities the change would add or modify: the ones it changes itself, whatever their type, and the others of the types this schema describes in detail; empty when ok is false. One whose id is not in the configuration would be added, and its real id may differ. An entity written to is listed even when its values stay the same."},deletedEntityIds:{type:new a(new o(new a(n))),description:"The ids of the entities the change would remove: the ones it removes itself, whatever their type, and the others of the types this schema describes in detail; empty when ok is false."},sideEffects:{type:new a(new o(new a(h))),description:"The major or unexpected things the configurator would change along with it; empty when ok is false."},warnings:{type:I,description:`The warnings and notices the change would newly cause, which do not stop it; empty when ok is false.${N}`},errors:{type:I,description:"Why the change cannot be made; empty when ok is true. Each is { type, entityId, message, details? }: type the kind of problem, entityId the entity it is on or null, message the problem as the user would be told it, and details what this change in particular would do, only when it says more than message."}})})),ec={recipeGroup:(M=[...Object.keys(_).length>0?[v.mutation]:[],...Object.keys(ee).length>0?[b.mutation]:[]],C=M.join(" or "),U=new r({name:"Recipe",description:`${M.includes("addChild")?"One thing that can be added to the entity (under childRecipes)":"One thing the entity can be replaced with (under replaceRecipes)"}${M.length>1?" or that it can be replaced with (under replaceRecipes)":""}.`,fields:{key:{type:new a(h),description:`Pass to ${C} as recipeKey, or to recipes(keys:) to read this recipe again.`},name:{type:new a(h),description:"Name shown to the user."},description:{type:h},imageUrl:{type:h,description:"Thumbnail shown to the user."},dryRun:{type:el,description:"What using this recipe would do. Null when it cannot be tried."}}}),new r({name:"RecipeGroup",description:"A group of recipes for this entity.",fields:{groupId:{type:new a(h),description:`Pass to ${C} as groupId.`},name:{type:new a(h),description:"Name shown to the user."},description:{type:h},recipes:{type:new a(new o(new a(U))),args:{keys:{type:new o(new a(h)),description:"Only the recipes with these keys; keys not in the group are ignored."}}}}})),fieldOption:new r({name:"FieldOption",description:"One value a field accepts. Writing a value outside the list is rejected unless the field description says it is not checked.",fields:{value:{type:new a(y),description:"The value to write to the field."},name:{type:h,description:"Name shown to the user."},description:{type:h},imageUrl:{type:h,description:"Image shown to the user."},color:{type:h,description:'Color shown to the user, as "#rrggbb".'},dryRun:{type:el,description:"What writing this value would do. Null when it cannot be tried."}}}),screenshot:new r({name:"Screenshot",description:"A screenshot of an entity. The picture itself follows the tool result.",fields:{image:{type:new a(n),description:"Label of the image that follows the tool result."}}})};for(let e of et){let n=$(_,e)??[],i=$(ee,e)??[],s=$(Y,e)??[],o=$(t.screenshots,e)??[],a=Z.includes(e),r=t.select.some(t=>t.entityTypes.includes(e)),d=n.length>0||i.length>0||s.length>0||o.length>0||r;(d||a)&&en.set(e,{description:F(d,a),type:D({entityType:e,childRecipes:n,replaceRecipes:i,optionsEdges:s,screenshots:o,selectable:r,hasInvariants:a},ec)})}let ep={navigationState:T("NavigationState",X.navigationStates),viewState:T("ViewState",X.viewStates),toolState:T("ToolState",X.toolStates)},ey=((e,t)=>{let n={...e.navigationStates.length>1?{navigationState:{type:new a(h),description:t.navigationState?"Active navigation state; it may be one `NavigationState` does not list.":"Active navigation state."}}:{},...e.viewStates.length>1?{viewState:{type:new a(h),description:t.viewState?"Active view state; it may be one `ViewState` does not list.":"Active view state."}}:{},...e.toolStates.length>1?{toolState:{type:new a(h),description:t.toolState?"Active tool state; it may be one `ToolState` does not list.":"Active tool state."}}:{},...(({navigationState:e,viewState:t,toolState:n})=>e||t||n?{available:{type:new a(new r({name:"AvailableNavigation",description:"The states the user can be moved to right now, besides the active ones.",fields:{...e?{navigationStates:A(e)}:{},...t?{viewStates:A(t)}:{},...n?{toolStates:A(n)}:{}}}))}}:{})(t)};if(0!==Object.keys(n).length)return new r({name:"Navigation",description:"The active UI states of the configurator.",fields:n})})(L,ep),ew=new d({query:(V=eo(es.has(m)?m:f),K=eo(f),new r({name:"Query",fields:{root:{type:new a(V),description:"The root entity of the configuration."},entities:{type:new a(new o(K)),args:{ids:{type:new o(new a(n))}},description:"Every entity, or the given ids in order with null for an unknown id."},selectedEntity:{type:new a(K),description:"The selected entity, or the root entity when nothing is selected."},...ey?{navigation:{type:new a(ey)}}:{},warnings:{type:I,description:`Every warning and notice of the configuration the query reads.${N}`}}})),mutation:(({deletableTypes:t,writableTypes:s,childRecipes:d,replaceRecipes:l,actionFields:c,navigationMutations:p,selectionMutations:y,objectTypes:g,optionsEdges:u,anyDomainEntity:f,targetOutputType:m})=>{let v,b;if(0!==t.length||0!==s.length||0!==Object.keys(d).length||0!==Object.keys(l).length||0!==c.length||0!==Object.keys(p).length||0!==Object.keys(y).length)return new r({name:"Mutation",fields:Object.assign(0===t.length?{}:{deleteEntity:{type:new a(new o(new a(n))),args:{id:{type:new a(n)}},description:`Deletes the entity and everything composed into it. Deletable types: ${t.join(", ")}. Returns the ids removed, the given one first, then the others of the types this schema describes in detail.`}},0===(v=q(d)).length?{}:{addChild:{type:new a(new o(new a(f))),args:{parentId:{type:new a(n)},groupId:{type:new a(h)},recipeKey:{type:new a(h)}},description:`Adds a child to the entity parentId from a recipe listed under its meta { childRecipes }. Types with child recipes: ${v.join("; ")}. Returns the entities added, the recipe's own first, then the others of the types this schema describes in detail; empty when they were removed again.`}},0===(b=q(l)).length?{}:{replaceEntity:{type:new a(new o(new a(f))),args:{entityId:{type:new a(n)},groupId:{type:new a(h)},recipeKey:{type:new a(h)}},description:`Replaces the entity entityId from a recipe listed under its meta { replaceRecipes }. Types with replace recipes: ${b.join("; ")}. The replacement is a new entity: it has a new id and the field values of its recipe, and entityId no longer exists. Returns the entities added, the replacement first, then the others of the types this schema describes in detail; empty when they were removed again.`}},...s.flatMap(e=>{let t=g.get(e.entityType);return t?[(({entityType:e,fields:t},s,o)=>{let r=Object.fromEntries(t.map(({name:e,type:t,description:n})=>[e,{type:w(t),description:O(n,o(e))}]));return{[`modify${e}`]:{type:s,args:{id:{type:new a(n)},delta:{type:new a(new i({name:`${e}Delta`,fields:r}))}},description:`Sets the fields named in delta on one ${e}. Returns the entity after the change, or null when the change removed it.`}}})(e,t,E([e.entityType],u))]:[]}),Object.fromEntries(c.map(t=>{var n,i;return[t.fieldName,{type:new a(t.result?(n=t.fieldName,i=t.result,new r({name:`${n.charAt(0).toUpperCase()+n.slice(1)}Result`,description:`What ${n} returns, read from the configuration after the change.`,fields:()=>Object.fromEntries(Object.entries(i).map(([e,t])=>[e,{type:"edge"===t.kind?S(t,m):w(t.type),description:t.description}]))})):e),args:Object.fromEntries(Object.entries(t.args).map(([e,t])=>[e,{type:w(t.type),description:t.description}])),description:t.result?t.description:[t.description,"Returns true once the change is applied."].filter(Boolean).join("\n\n")}]})),p,y)})})({deletableTypes:Q,writableTypes:H,childRecipes:_,replaceRecipes:ee,actionFields:J,navigationMutations:(({navigationState:e,viewState:t,toolState:n},i)=>i?{...e?{navigate:{type:new a(i),args:{to:{type:new a(e)}},description:"Switches the page the user is on to one listed under navigation { available { navigationStates } }; setting the active one changes nothing. Returns the navigation after the switch."}}:{},...t?{setView:{type:new a(i),args:{to:{type:new a(t)}},description:"Switches the view the user sees to one listed under navigation { available { viewStates } }; setting the active one changes nothing. Returns the navigation after the switch."}}:{},...n?{setTool:{type:new a(i),args:{to:{type:new a(n)}},description:"Switches the tool the user works with to one listed under navigation { available { toolStates } }; setting the active one changes nothing. Returns the navigation after the switch."}}:{}}:{})(ep,ey),selectionMutations:((e,t)=>{if(0===e.length)return{};let i=e.map(({name:e,description:t})=>void 0===t?e:`${e}: ${t}`);return{select:{type:new a(t),args:{id:{type:new a(n)}},description:`Selects the entity id, as the user does by clicking it, when its meta { selectable } is true; selecting the selected entity changes nothing. Types that can be selected: ${i.join("; ")}. Returns the selected entity.`},deselect:{type:new a(t),description:"Clears the selection, so the root entity is selected. Returns the selected entity."}}})(t.select,eo(f)),objectTypes:ei,optionsEdges:Y,anyDomainEntity:eo(f),targetOutputType:ea}),types:[...es.values(),...ei.values(),...eh?[eh]:[]]}),eg=c(ew);if(eg.length>0)throw Error(eg.map(e=>e.message).join(" "));let eu=l(ew);return{sdl:eu,navigationFields:[...L.navigationStates.length>1?["navigationState"]:[],...L.viewStates.length>1?["viewState"]:[],...L.toolStates.length>1?["toolState"]:[]],navigation:X,select:t.select,fields:ed,deletableTypes:Q,writableFields:Object.fromEntries(H.map(({entityType:e,fields:t})=>[e,Object.fromEntries(t.map(({name:e,property:t})=>[e,t]))])),childRecipes:_,replaceRecipes:ee,fieldOptions:Object.fromEntries(G.flatMap(e=>{let t=$(Y,e);return t?[[e,t.map(({options:e})=>e)]]:[]})),screenshots:Object.fromEntries(G.flatMap(e=>{let n=$(t.screenshots,e);return n?[[e,n]]:[]})),actions:Object.fromEntries(J.map(({fieldName:e,actionName:t})=>[e,t])),lenses:g(t,u(eu)),formElements:t.formElements,...void 0!==t.instructions&&{instructions:t.instructions},webmcp:!1!==t.webmcp,features:t.features}};
|
|
@@ -9,9 +9,13 @@ export declare const formElementSignature: ({ name, role, attributes, labelled }
|
|
|
9
9
|
* the WebMCP tools.
|
|
10
10
|
*/
|
|
11
11
|
export type AssistantPromptSurface = 'panel' | 'webmcp';
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* How {@link generateAssistantPrompt} writes the prompt. `voice` is the session's effective `ai.voice`, which the
|
|
14
|
+
* browser never sees: only with it does the panel prompt teach spoken messages.
|
|
15
|
+
*/
|
|
13
16
|
export interface AssistantPromptOptions {
|
|
14
17
|
readonly surface: AssistantPromptSurface;
|
|
18
|
+
readonly voice?: boolean;
|
|
15
19
|
}
|
|
16
20
|
/** SDK-version conventions for using the manifest's capabilities and reading their results. */
|
|
17
|
-
export declare const generateAssistantPrompt: (assistant: AssistantManifest, { surface }?: AssistantPromptOptions) => string;
|
|
21
|
+
export declare const generateAssistantPrompt: (assistant: AssistantManifest, { surface, voice }?: AssistantPromptOptions) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ASSISTANT_BUILT_IN_FORM_ELEMENTS as e}from"../../spec/index.js";let t=[["Containers",["group","choice","choices"]],["Options",["option"]],["Inputs",["input"]]];export const formElementSignature=({name:e,role:t,attributes:a,labelled:n})=>{let s=[...!1===n?[]:["label"],...Object.entries(a).map(([e,t])=>((e,{type:t,enum:a})=>a?`${e}="${a.join("|")}"`:"string"===t?e:`${e}="<${t}>"`)(e,t))];return"option"===t||"input"===t?`<${e} ${s.join(" ")} />`:`<${e} ${s.join(" ")}>…</${e}>`};export const generateAssistantPrompt=(a,{surface:n}={surface:"panel"})=>{let s,o="panel"===n,i=o?"`query`":"`configurator_query`",r=o?"`apply`":"`configurator_apply`",h=Object.values(a.childRecipes??{}).some(e=>e.length>0),l=Object.values(a.replaceRecipes??{}).some(e=>e.length>0),d=Object.values(a.fieldOptions??{}).some(e=>e.length>0),c=Object.keys(a.actions??{}).length>0,u=Object.values(a.screenshots??{}).some(e=>e.length>0),g=(a.deletableTypes?.length??0)>0||Object.values(a.writableFields??{}).some(e=>Object.keys(e).length>0)||h||l||c,w=[...(a.navigation?.navigationStates.length??0)>0?["`navigate`"]:[],...(a.navigation?.viewStates.length??0)>0?["`setView`"]:[],...(a.navigation?.toolStates.length??0)>0?["`setTool`"]:[]],m=w.length>0,p=(a.select?.length??0)>0,f=g||m||p,y=h||l||d,b=[...h?["`childRecipes` is what can be added to it"]:[],...l?["`replaceRecipes` what it can be replaced with"]:[],...d?["`<field>Options` the values a field accepts"]:[]],k=["`selected`",...(a.navigationFields??[]).map(e=>`\`${e}\``)].join(", ");return[["Tools","- Put related operations in one call and select only the fields you need.",`- Give every ${f?`${i} and ${r} call`:`${i} call`} a \`title\` of two to five words in the user's language that says what it does for them, e.g. ${g?'"Add two drawers"':'"Compare drawer prices"'}.`,...g?[`- Use a mutation inside ${i} to answer a what-if about a change ${y?"the lists under `meta` do not show":"before making it"}.`,`- Use ${r} only for what the user asked for.`,"- Every change can be undone and refined later. When the request is clear, make the change without asking. Ask only about what you cannot tell, all of it in one question, and offer to make the change in the same question. A yes to what you proposed is the go-ahead: apply it, do not ask again."]:["- Nothing in this configurator can be changed through you. Say so when the user asks for a change."],...m?[`- ${r} also runs ${w.join(", ")}: each switches what the user sees to one of the states \`navigation { available }\` lists. They change nothing in the configuration and run even while it is read-only.`]:[],...p?[`- ${r} also runs \`select\` and \`deselect\`: \`select\` selects an entity whose \`meta { selectable }\` is true, as the user does by clicking it, and \`deselect\` goes back to the root. They change nothing in the configuration and run even while it is read-only.`]:[],"- When an operation fails, its `errors` say why and what to send instead. A change the configuration does not allow fails with one error per reason, as the user would be told it.","- Warnings and notices never make anything fail. The root `warnings` field lists every current one, and `meta { warnings }` those of one entity, where its type has them."],...g?[["After a change","- The user sees each change in the configurator as soon as it is made. Say briefly what you changed and what needs their attention, not what it now looks like or what stayed the same.",`- A change is made only when the ${r} result has \`committed: true\`. Otherwise \`errors\` or \`message\` says what happened; without either, nothing changed. Never say a change was made when it was not.`,"- `sideEffects` names the major or unexpected things the configurator changed along with your change. Tell the user about them when committed; otherwise they describe what would happen. Smaller adjustments are not listed.","- `warnings` lists the warnings and notices your change newly causes. They do not block it: tell the user about them, and offer a fix when one is clear.","- A mutation returns the state after the change: use the ids and values it returned, not the ones you sent.",...c?["- When one mutation does the whole of what the user asked, use it instead of building the same change from several others."]:[]]]:[],...y?[["What can be done to an entity",`- \`meta\` lists what is possible right now: ${b.join(", ")}. Read the list before such a change and before telling the user what is available.`,`- You can select \`dryRun\` on ${[...h||l?["recipes"]:[],...d?["options"]:[]].join(" or ")} to look ahead and pick one that meets what the user asked for. It is optional before a change.`,`- Select only the ${[...h||l?["recipe groups"]:[],...d?["options edges"]:[]].join(" and ")} you need. To read again only the ones you are deciding between, pass ${[...h||l?["their `key` to `recipes(keys:)`"]:[],...d?["their `value` to `<field>Options(values:)`"]:[]].join(" or ")}.`,"- Read the lists again after a change, unless their descriptions say they stay the same."]]:[],...u?[["Seeing the design","- `meta { screenshot(view: …) { image } }` renders an entity from one of the views its `<Type>ScreenshotView` lists. The picture follows the tool result.","- Take one when the user asks how the design looks, or when you are not sure something is laid out right: what sits where, what overlaps or lines up. Otherwise rely on the data.","- Each one costs tokens and blocks the user's configurator while it renders."]]:[],["Images from the user","- The user may attach photos or reference images to a message, such as their room or a design they like.","- Sizes you estimate from a photo of a real space or object, such as their room, are estimates: tell the user the values you read and confirm them before you apply them.",...o?["- An image the message calls an annotation is marked up by the user: the red strokes are drawn by the user, and each numbered red pin marks the place its comment, listed by number before the message, is about.","- An annotation of the configurator view is the user's own current view of the configurator, not one of the screenshot views. An annotation of an image marks up an image, such as one of your drawings."]:[]],...o?[["The `[changes]` block","- Every user message starts with it: a glimpse of what the user did in the configurator since your last turn.",`- \`[changes: none]\`, or only ${k} lines: what you know still holds. Do not query it again.`,"- Other lines are a hint at what to read again: `A` added, `D` deleted, `M` modified with the fields. Text after `#` says what caused the line; `reset: undo/redo` says the user undid or redid changes.","- Read computed fields again when a listed change may affect them.","- `[changes: unavailable]` and `[changes: too many (n)]`: read again before relying on anything you read earlier.",...f?["- Your applied changes are not listed, except those waiting for user approval: they appear once approved."]:[]]]:[],["Reading the schema","- Take ids from results.",...(a.deletableTypes?.length??0)>0||l?["- The id of a deleted or replaced entity is gone and may later be given to another entity."]:[],`- A field whose name starts with \`_\` is computed: read it${g?", never write it":""}.`,"- Numbers are in the unit the field description names. Convert when the user uses another unit."],...o?[["Links","- You may link an entity of the current configuration when you speak about that very entity: `[the left burner](entity:CookingTop-1)`. It helps the user find it in the configurator.",...y?["- Whenever you name recipes or options you read from `meta`, in a list, a table or a sentence, link each one: `[Single gas burner](recipe:KitchenRange-1/top/gas_single)` or `[Oak](option:Cabinet-2/finishOptions/oak)`. The link shows the user its picture or color and its description, so never draw previews yourself. The target is the entity id, the recipe group id or the options field you read, and the key or value, each encoded as in a URL."]:[]],["Replies","- Write Markdown only, never HTML: the panel does not render it. Only a drawing holds markup.","- An image, ``, is shown only when its path is relative.","- To make a warning or a key note stand out, write a GitHub alert: a blockquote whose first line is only `[!WARNING]` or `[!NOTE]`. Use it sparingly."],["Drawings","- You can draw a schematic for the user: a fenced code block with the language `svg` that holds one SVG document. The panel shows it as a picture, and the user can open it larger beside the chat.","- Draw when a schematic explains better than words, such as a layout seen from above, dimensions or clearances, or a comparison of options, or when the user or the instructions of this configurator ask for one. Never draw what the product looks like or the result of a change you made: the user sees it in the configurator. Draw to plan or explain, before a change.","- At most one drawing per reply. A drawing costs much more than text: after the user corrects one, say in a sentence what changed instead of drawing it again, unless they ask for a new drawing.",'- The root is `<svg xmlns="http://www.w3.org/2000/svg" viewBox="…">`, and its first child is a `<title>` that says what the drawing shows.',"- Paint the background first with a `<rect>` that covers the whole `viewBox`, and give every fill and stroke an explicit colour, never `currentColor` or a CSS variable.","- The picture is as wide as the chat panel, about 360 px: keep text at least 14 px tall at that width, and use generic font families such as `sans-serif`.","- A drawing runs no script and loads nothing: no `<script>`, event attributes, `<foreignObject>`, external links or images.","- Keep it simple: a drawing that is not well-formed SVG, or is over 50 KB, is not shown.","- The user can annotate a drawing to give you feedback on it: their message then carries it as an annotation of an image."],["Forms","- To ask the user something they answer by picking or typing, end your reply with a form: a fenced code block with the language `form`. It holds only elements, written as lowercase tags with string attributes, without Markdown or text.",'- The user can always write in the chat instead of answering, so ask an open question in your reply, never with a form whose only element is a `text` or `number` input, and never add one for comments, corrections, details or "other". Use one only next to other questions, for a value with a clear form, such as a width or a name.',"- An element whose signature lists `label` takes the text the user sees; on a container or an input it also names the answer. An option or an input whose signature lists `value` takes it: an option sends it instead of its label, and an input starts with it.",'- A bare attribute in a signature takes any text, `name="<type>"` takes a value of that type written as text, such as `min="<number>"`, and `name="a|b"` takes one of the words listed.',"- Options can also stand on their own, outside a `choice` or `choices`.","- An element or attribute not listed here, or an element other than an option inside a `choice` or `choices`, makes the whole form fail.","- The answer is the user's next message. Each container or input gives a line `Label: value`, or the bare value without a label; the lines of a labelled container are indented by two spaces under it, a `choices` lists each picked option on its own line, and `—` marks what was left unanswered.",'- Example: `<choice label="Plinth"><reply label="Black" /><reply label="Oak" /></choice>` is answered with `Plinth: Oak`.',"- The chat shows the answer as the user's own message, so a `value` reads as natural words, never as an id, key or code. Give `value` only when the label alone would be unclear as an answer, and map the answer's labels back to ids yourself.",...y?["- To offer recipes or options you read from `meta`, give each a `tile`, never a `reply`: the panel shows its name and its picture, color or description, and picks how it looks. A `ref` that names nothing the configuration offers now makes the whole form fail. A tile answers with its name: map it back to its key or value yourself."]:[],...(s=[...e.filter(({name:e})=>y||"tile"!==e),...a.formElements??[]],t.flatMap(([e,t])=>{let a=s.filter(({role:e})=>t.includes(e));return 0===a.length?[]:[`- ${e}:`,...a.map(e=>` - \`${formElementSignature(e)}\`: ${(({description:e,required:t=[]})=>0===t.length?e:`${e} Requires ${t.map(e=>`\`${e}\``).join(", ")}.`)(e)}`)]}))],["Spoken messages","- A user message that starts with `(Spoken.)` is a speech-to-text transcript, and your reply to it is read aloud.","- Write the text of the reply to be heard: brief, in a few plain sentences, without lists, tables, inline code or Markdown formatting. Links are fine: only their text is read.",'- A drawing or a form is shown but not read aloud. Use one whenever it helps, especially a form when the user would otherwise have to dictate a choice, and say in the text that it is there, such as "pick one below".','- Write numbers and units the way they are said, such as "800 millimetres" rather than "800 mm", and avoid symbols.',"- A word may be misheard: read the message for what the user most likely meant in this conversation, and when a misheard word could change what you would apply, ask before applying it."]]:[],...a.lenses?.declarations?[["Built-in fragments","- These fragments are already defined for every operation. Spread one by name on a field of its type, as in `field { ...FragmentName }`, instead of listing its fields.","- A fragment is a starting selection: add the other fields you need next to the spread, by name from the schema.","- Never define a fragment with one of these names.","",a.lenses.declarations]]:[]].map(e=>e.join("\n")).join("\n\n")};
|
|
1
|
+
import{ASSISTANT_BUILT_IN_FORM_ELEMENTS as e}from"../../spec/index.js";let t=[["Containers",["group","choice","choices"]],["Options",["option"]],["Inputs",["input"]]];export const formElementSignature=({name:e,role:t,attributes:a,labelled:n})=>{let s=[...!1===n?[]:["label"],...Object.entries(a).map(([e,t])=>((e,{type:t,enum:a})=>a?`${e}="${a.join("|")}"`:"string"===t?e:`${e}="<${t}>"`)(e,t))];return"option"===t||"input"===t?`<${e} ${s.join(" ")} />`:`<${e} ${s.join(" ")}>…</${e}>`};export const generateAssistantPrompt=(a,{surface:n,voice:s}={surface:"panel"})=>{let o,i="panel"===n,{drawings:r,forms:h,images:l,annotations:d}=a.features,c=[...r?["a drawing"]:[],...h?["a form"]:[]].join(" or "),u=i?"`query`":"`configurator_query`",w=i?"`apply`":"`configurator_apply`",g=Object.values(a.childRecipes??{}).some(e=>e.length>0),p=Object.values(a.replaceRecipes??{}).some(e=>e.length>0),m=Object.values(a.fieldOptions??{}).some(e=>e.length>0),f=Object.keys(a.actions??{}).length>0,y=Object.values(a.screenshots??{}).some(e=>e.length>0),b=(a.deletableTypes?.length??0)>0||Object.values(a.writableFields??{}).some(e=>Object.keys(e).length>0)||g||p||f,k=[...(a.navigation?.navigationStates.length??0)>0?["`navigate`"]:[],...(a.navigation?.viewStates.length??0)>0?["`setView`"]:[],...(a.navigation?.toolStates.length??0)>0?["`setTool`"]:[]],v=k.length>0,$=(a.select?.length??0)>0,T=b||v||$,x=g||p||m,A=[...g?["`childRecipes` is what can be added to it"]:[],...p?["`replaceRecipes` what it can be replaced with"]:[],...m?["`<field>Options` the values a field accepts"]:[]],j=["`selected`",...(a.navigationFields??[]).map(e=>`\`${e}\``)].join(", ");return[["Tools","- Put related operations in one call and select only the fields you need.",`- Give every ${T?`${u} and ${w} call`:`${u} call`} a \`title\` of two to five words in the user's language that says what it does for them, e.g. ${b?'"Add two drawers"':'"Compare drawer prices"'}.`,...b?[`- Use a mutation inside ${u} to answer a what-if about a change ${x?"the lists under `meta` do not show":"before making it"}.`,`- Use ${w} only for what the user asked for.`,"- Every change can be undone and refined later. When the request is clear, make the change without asking. Ask only about what you cannot tell, all of it in one question, and offer to make the change in the same question. A yes to what you proposed is the go-ahead: apply it, do not ask again."]:["- Nothing in this configurator can be changed through you. Say so when the user asks for a change."],...v?[`- ${w} also runs ${k.join(", ")}: each switches what the user sees to one of the states \`navigation { available }\` lists. They change nothing in the configuration and run even while it is read-only.`]:[],...$?[`- ${w} also runs \`select\` and \`deselect\`: \`select\` selects an entity whose \`meta { selectable }\` is true, as the user does by clicking it, and \`deselect\` goes back to the root. They change nothing in the configuration and run even while it is read-only.`]:[],"- When an operation fails, its `errors` say why and what to send instead. A change the configuration does not allow fails with one error per reason, as the user would be told it.","- Warnings and notices never make anything fail. The root `warnings` field lists every current one, and `meta { warnings }` those of one entity, where its type has them."],...b?[["After a change","- The user sees each change in the configurator as soon as it is made. Say briefly what you changed and what needs their attention, not what it now looks like or what stayed the same.",`- A change is made only when the ${w} result has \`committed: true\`. Otherwise \`errors\` or \`message\` says what happened; without either, nothing changed. Never say a change was made when it was not.`,"- `sideEffects` names the major or unexpected things the configurator changed along with your change. Tell the user about them when committed; otherwise they describe what would happen. Smaller adjustments are not listed.","- `warnings` lists the warnings and notices your change newly causes. They do not block it: tell the user about them, and offer a fix when one is clear.","- A mutation returns the state after the change: use the ids and values it returned, not the ones you sent.",...f?["- When one mutation does the whole of what the user asked, use it instead of building the same change from several others."]:[]]]:[],...x?[["What can be done to an entity",`- \`meta\` lists what is possible right now: ${A.join(", ")}. Read the list before such a change and before telling the user what is available.`,`- You can select \`dryRun\` on ${[...g||p?["recipes"]:[],...m?["options"]:[]].join(" or ")} to look ahead and pick one that meets what the user asked for. It is optional before a change.`,`- Select only the ${[...g||p?["recipe groups"]:[],...m?["options edges"]:[]].join(" and ")} you need. To read again only the ones you are deciding between, pass ${[...g||p?["their `key` to `recipes(keys:)`"]:[],...m?["their `value` to `<field>Options(values:)`"]:[]].join(" or ")}.`,"- Read the lists again after a change, unless their descriptions say they stay the same."]]:[],...y?[["Seeing the design","- `meta { screenshot(view: …) { image } }` renders an entity from one of the views its `<Type>ScreenshotView` lists. The picture follows the tool result.","- Take one when the user asks how the design looks, or when you are not sure something is laid out right: what sits where, what overlaps or lines up. Otherwise rely on the data.","- Each one costs tokens and blocks the user's configurator while it renders."]]:[],...!i||l||d?[["Images from the user","- The user may attach photos or reference images to a message, such as their room or a design they like.","- Sizes you estimate from a photo of a real space or object, such as their room, are estimates: tell the user the values you read and confirm them before you apply them.",...i&&d?["- An image the message calls an annotation is marked up by the user: the red strokes are drawn by the user, and each numbered red pin marks the place its comment, listed by number before the message, is about.",`- An annotation of the configurator view is the user's own current view of the configurator, not one of the screenshot views. An annotation of an image marks up an image${r?", such as one of your drawings":""}.`]:[]]]:[],...i?[["The `[changes]` block","- Every user message starts with it: a glimpse of what the user did in the configurator since your last turn.",`- \`[changes: none]\`, or only ${j} lines: what you know still holds. Do not query it again.`,"- Other lines are a hint at what to read again: `A` added, `D` deleted, `M` modified with the fields. Text after `#` says what caused the line; `reset: undo/redo` says the user undid or redid changes.","- Read computed fields again when a listed change may affect them.","- `[changes: unavailable]` and `[changes: too many (n)]`: read again before relying on anything you read earlier.",...T?["- Your applied changes are not listed, except those waiting for user approval: they appear once approved."]:[]]]:[],["Reading the schema","- Take ids from results.",...(a.deletableTypes?.length??0)>0||p?["- The id of a deleted or replaced entity is gone and may later be given to another entity."]:[],`- A field whose name starts with \`_\` is computed: read it${b?", never write it":""}.`,"- Numbers are in the unit the field description names. Convert when the user uses another unit."],...i?[["Links","- You may link an entity of the current configuration when you speak about that very entity: `[the left burner](entity:CookingTop-1)`. It helps the user find it in the configurator.",...x?["- Whenever you name recipes or options you read from `meta`, in a list, a table or a sentence, link each one: `[Single gas burner](recipe:KitchenRange-1/top/gas_single)` or `[Oak](option:Cabinet-2/finishOptions/oak)`. The link shows the user its picture or color and its description, so never draw previews yourself. The target is the entity id, the recipe group id or the options field you read, and the key or value, each encoded as in a URL."]:[]],["Replies",`- Write Markdown only, never HTML: the panel does not render it.${r?" Only a drawing holds markup.":""}`,"- An image, ``, is shown only when its path is relative.","- To make a warning or a key note stand out, write a GitHub alert: a blockquote whose first line is only `[!WARNING]` or `[!NOTE]`. Use it sparingly."],...r?[["Drawings","- You can draw a schematic for the user: a fenced code block with the language `svg` that holds one SVG document. The panel shows it as a picture, and the user can open it larger beside the chat.","- Draw when a schematic explains better than words, such as a layout seen from above, dimensions or clearances, or a comparison of options, or when the user or the instructions of this configurator ask for one. Never draw what the product looks like or the result of a change you made: the user sees it in the configurator. Draw to plan or explain, before a change.","- At most one drawing per reply. A drawing costs much more than text: after the user corrects one, say in a sentence what changed instead of drawing it again, unless they ask for a new drawing.",'- The root is `<svg xmlns="http://www.w3.org/2000/svg" viewBox="…">`, and its first child is a `<title>` that says what the drawing shows.',"- Paint the background first with a `<rect>` that covers the whole `viewBox`, and give every fill and stroke an explicit colour, never `currentColor` or a CSS variable.","- The picture is as wide as the chat panel, about 360 px: keep text at least 14 px tall at that width, and use generic font families such as `sans-serif`.","- A drawing runs no script and loads nothing: no `<script>`, event attributes, `<foreignObject>`, external links or images.","- Keep it simple: a drawing that is not well-formed SVG, or is over 50 KB, is not shown.",...d?["- The user can annotate a drawing to give you feedback on it: their message then carries it as an annotation of an image."]:[]]]:[],...h?[["Forms","- To ask the user something they answer by picking or typing, end your reply with a form: a fenced code block with the language `form`. It holds only elements, written as lowercase tags with string attributes, without Markdown or text.",'- The user can always write in the chat instead of answering, so ask an open question in your reply, never with a form whose only element is a `text` or `number` input, and never add one for comments, corrections, details or "other". Use one only next to other questions, for a value with a clear form, such as a width or a name.',"- An element whose signature lists `label` takes the text the user sees; on a container or an input it also names the answer. An option or an input whose signature lists `value` takes it: an option sends it instead of its label, and an input starts with it.",'- A bare attribute in a signature takes any text, `name="<type>"` takes a value of that type written as text, such as `min="<number>"`, and `name="a|b"` takes one of the words listed.',"- Options can also stand on their own, outside a `choice` or `choices`.","- An element or attribute not listed here, or an element other than an option inside a `choice` or `choices`, makes the whole form fail.","- The answer is the user's next message. Each container or input gives a line `Label: value`, or the bare value without a label; the lines of a labelled container are indented by two spaces under it, a `choices` lists each picked option on its own line, and `—` marks what was left unanswered.",'- Example: `<choice label="Plinth"><reply label="Black" /><reply label="Oak" /></choice>` is answered with `Plinth: Oak`.',"- The chat shows the answer as the user's own message, so a `value` reads as natural words, never as an id, key or code. Give `value` only when the label alone would be unclear as an answer, and map the answer's labels back to ids yourself.",...x?["- To offer recipes or options you read from `meta`, give each a `tile`, never a `reply`: the panel shows its name and its picture, color or description, and picks how it looks. A `ref` that names nothing the configuration offers now makes the whole form fail. A tile answers with its name: map it back to its key or value yourself."]:[],...(o=[...e.filter(({name:e})=>x||"tile"!==e),...a.formElements??[]],t.flatMap(([e,t])=>{let a=o.filter(({role:e})=>t.includes(e));return 0===a.length?[]:[`- ${e}:`,...a.map(e=>` - \`${formElementSignature(e)}\`: ${(({description:e,required:t=[]})=>0===t.length?e:`${e} Requires ${t.map(e=>`\`${e}\``).join(", ")}.`)(e)}`)]}))]]:[],...!0===s?[["Spoken messages","- A user message that starts with `(Spoken.)` is a speech-to-text transcript, and your reply to it is read aloud. One that starts with `(Typed.)` was typed, and your reply to it is not read aloud.","- The thread starts typed, and a marker holds until the next one: a user message without one is spoken or typed like the user message before it.","- Write the text of the reply to be heard: brief, in a few plain sentences, without lists, tables, inline code or Markdown formatting. Links are fine: only their text is read.",...""!==c?[`- ${c.charAt(0).toUpperCase()}${c.slice(1)} is shown but not read aloud. Use one whenever it helps,${h?" especially a form when the user would otherwise have to dictate a choice,":""} and say in the text that it is there, such as "${h?"pick one below":"see the drawing below"}".`]:[],'- Write numbers and units the way they are said, such as "800 millimetres" rather than "800 mm", and avoid symbols.',"- A word may be misheard: read the message for what the user most likely meant in this conversation, and when a misheard word could change what you would apply, ask before applying it."]]:[]]:[],...a.lenses?.declarations?[["Built-in fragments","- These fragments are already defined for every operation. Spread one by name on a field of its type, as in `field { ...FragmentName }`, instead of listing its fields.","- A fragment is a starting selection: add the other fields you need next to the spread, by name from the schema.","- Never define a fragment with one of these names.","",a.lenses.declarations]]:[]].map(e=>e.join("\n")).join("\n\n")};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { ASSISTANT_OTHER_ENTITY, assistantExposedTypes, isAssistantVisible } from './assistant-exposure.js';
|
|
1
2
|
export { buildAssistantManifest } from './build-assistant-manifest.js';
|
|
2
3
|
export type { AssistantFieldExposure } from './create-assistant-execution-schema.js';
|
|
3
4
|
export { AssistantFieldClashError, createAssistantExecutionSchema } from './create-assistant-execution-schema.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{buildAssistantManifest}from"./build-assistant-manifest.js";export{AssistantFieldClashError,createAssistantExecutionSchema}from"./create-assistant-execution-schema.js";export{generateAssistantPrompt}from"./generate-assistant-prompt.js";export*from"./session-setup/index.js";export{describeAssistantValues,mergeAssistantFields,resolveAssistantField}from"./assistant-fields.js";export{prepareNavigateUpdates,prepareSetToolUpdates,prepareSetViewUpdates}from"./prepare-assistant-navigation-updates.js";export{readAssistantNavigation}from"./read-assistant-navigation.js";export{isAssistantSelectable,prepareDeselectUpdates,prepareSelectUpdates}from"./assistant-selection.js";
|
|
1
|
+
export{ASSISTANT_OTHER_ENTITY,assistantExposedTypes,isAssistantVisible}from"./assistant-exposure.js";export{buildAssistantManifest}from"./build-assistant-manifest.js";export{AssistantFieldClashError,createAssistantExecutionSchema}from"./create-assistant-execution-schema.js";export{generateAssistantPrompt}from"./generate-assistant-prompt.js";export*from"./session-setup/index.js";export{describeAssistantValues,mergeAssistantFields,resolveAssistantField}from"./assistant-fields.js";export{prepareNavigateUpdates,prepareSetToolUpdates,prepareSetViewUpdates}from"./prepare-assistant-navigation-updates.js";export{readAssistantNavigation}from"./read-assistant-navigation.js";export{isAssistantSelectable,prepareDeselectUpdates,prepareSelectUpdates}from"./assistant-selection.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ASSISTANT_AI_PROVIDERS as e,ASSISTANT_HOURLY_LIMIT_LEVELS as t,ASSISTANT_MODEL_TIERS as i,ASSISTANT_REASONING_LEVELS as s}from"@salsita-ai/contracts/assistant";import{describeAssistantValues as n,mergeAssistantFields as a,resolveAssistantField as o}from"../assistant-fields.js";import{projectAssistantSetupManifest as r}from"./assistant-setup-manifest.js";export class AssistantSetupError extends Error{constructor(e,t){super(`${e}: ${t}`),this.name="AssistantSetupError"}}let l=(e,t)=>{throw new AssistantSetupError(e,t)},c=(e,t,i)=>{for(let s of((null===t||"object"!=typeof t||Array.isArray(t))&&l(i,"expected an object; omit an entry to remove it"),Object.keys(t)))Object.hasOwn(e,s)||l(`${i}.${s}`,"not declared in the spec; remove this key")},p=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0,d=(e,t,i)=>(void 0!==e&&"string"!=typeof e&&l(`${i}.description`,"expected a string"),e??t),f=(e,t,i)=>(void 0!==e&&!1!==e&&l(`${i}.allowDryRuns`,"can only disable dry-runs; omit this flag or set false"),!1!==e&&t);export const applyAssistantSetup=(m,u,b)=>{if(null===b)return null;let v=r(m,u),y=m.declarations;c({entities:{},deletable:{},writable:{},childRecipes:{},replaceRecipes:{},screenshots:{},actions:{},navigation:{},instructions:"",webmcp:!1,ai:{}},b,"assistant"),c(v.entities,b.entities,"assistant.entities"),c(v.deletable,b.deletable,"assistant.deletable"),c(v.writable,b.writable,"assistant.writable"),c(v.actions,b.actions,"assistant.actions"),c(v.screenshots,b.screenshots,"assistant.screenshots"),c(v.navigation,b.navigation,"assistant.navigation");let g=Object.fromEntries(Object.entries(b.entities).map(([e,t])=>{let i=`assistant.entities.${e}`;c(v.entities[e],t,i);let s=y.entities[e];return[e,Object.entries(t).map(([e,t])=>{c({description:""},t,`${i}.${e}`);let a=s.find(t=>t.source===e),o=d(t.description,a.valueDescription,`${i}.${e}`);return{...a,valueDescription:o,description:n(o,a.enumValues),describedByManifest:void 0!==t.description||a.describedByManifest}})]})),w=(e,t,i)=>l(`assistant.entities.${e}`,`conflicting sources ${t} and ${i}`),h=a([],p(g,"AnyDomainEntity")??[],()=>void 0,w),$=new Map([["AnyDomainEntity",h]]);for(let e of Object.keys(m.aliases))"AnyDomainEntity"!==e&&$.set(e,a([h],p(g,e)??[],()=>void 0,w));for(let e of m.entityTypes){let t=Object.entries(m.aliases).filter(([t,i])=>"AnyDomainEntity"!==t&&i.includes(e));$.set(e,a([h,...t.map(([e])=>$.get(e)??[])],p(g,e)??[],t=>y.enumValues[e]?.[t],w))}let O=Object.fromEntries([...$].map(([e,t])=>[e,t.map(t=>o(t,p(g,e)??[]))])),j=new Map,T=new Map;for(let[e,t]of Object.entries(b.writable)){let i=`assistant.writable.${e}`;for(let[s,n]of(c(v.writable[e],t,i),Object.entries(t))){let t=`${i}.${s}`,a=y.writable[e][s];for(let[e,{field:i,options:o,exposedDescription:r}]of(c(Object.values(a.members).some(e=>e.options)?{options:{}}:{},n,t),void 0!==n.options&&(c({validate:!0,allowDryRuns:!1},n.options,`${t}.options`),void 0!==n.options.validate&&!0!==n.options.validate&&l(`${t}.options.validate`,"can only enable validation; omit this flag or set true"),f(n.options.allowDryRuns,!0,`${t}.options`)),Object.entries(a.members))){let c=p(g,e)?.find(e=>e.source===s)?.name??$.get(e)?.find(e=>e.source===s)?.name,d=c??s;void 0===c&&$.get(e)?.some(e=>e.name===s&&e.source!==s)&&l(t,`narrowing leaves ${e}.${s} bound to another read field; retain its original exposure or remove this writable property`);let m=j.get(e)??new Map;if([...m.values()].some(e=>e.name===d&&e.property!==s)&&l(t,`narrowing maps multiple writable properties to ${e}.${d}; retain their original exposures or remove the conflicting property`),m.has(s)||m.set(s,{...i,name:d,...void 0===c?{}:{description:r}}),j.set(e,m),o){let i=a.defaultOptionsName?`${d}Options`:o.options.edgeName;T.get(e)?.some(e=>e.options.edgeName===i||e.options.field===d)&&l(`${t}.options`,`narrowing duplicates options edge ${e}.${i}; retain the original field exposures or remove the conflicting writable declaration`),T.set(e,[...T.get(e)??[],{hints:o.hints,options:{...o.options,field:d,edgeName:i,validate:n.options?.validate??o.options.validate,dryRuns:f(n.options?.allowDryRuns,o.options.dryRuns,`${t}.options`)}}])}}}}for(let[e,t]of Object.entries(m.optionsEdges))for(let i of t){let t=m.writableTypes.find(t=>t.entityType===e)?.fields.find(e=>e.name===i.options.field)?.property;if(i.options.validate&&t&&j.get(e)?.has(t)&&!T.get(e)?.some(i=>i.options.field===j.get(e)?.get(t)?.name&&i.options.validate)){let i=Object.keys(b.writable).find(i=>Object.hasOwn(b.writable[i],t)&&y.writable[i]?.[t]?.members[e]);l(`assistant.writable.${i}.${t}`,`cannot remove declared validation while another declaration keeps ${e}.${t} writable; remove all writable declarations for it`)}}let x=e=>{c(v[e],b[e],`assistant.${e}`);let t=new Map;for(let[i,s]of Object.entries(b[e])){let n=`assistant.${e}.${i}`;c(v[e][i],s,n);let a=y[e][i],o=Object.entries(s).map(([e,t])=>{let i=`${n}.${e}`;c({description:"",allowDryRuns:!1},t,i);let s=a.find(t=>t.instanceName===e);return{...s,description:d(t.description,s.description,i),dryRuns:f(t.allowDryRuns,s.dryRuns,i)}});for(let e of m.entityTypes.includes(i)?[i]:m.aliases[i]??[])t.set(e,[...t.get(e)??[],...o])}return Object.fromEntries(m.entityTypes.flatMap(e=>{let i=t.get(e);return i?.length?[[e,i]]:[]}))},E=new Map;for(let[e,t]of Object.entries(b.screenshots)){let i=`assistant.screenshots.${e}`;c(v.screenshots[e],t,i);let s=m.entityTypes.includes(e)?[e]:m.aliases[e]??[];for(let[n,a]of Object.entries(t)){let t=`${i}.${n}`;c({description:""},a,t);let o=y.screenshots[e].find(e=>e.instanceName===n),r={...o,description:d(a.description,o.description,t)??o.description};for(let e of s)E.set(e,[...E.get(e)??[],r])}}for(let[e,t]of Object.entries(b.deletable))c({},t,`assistant.deletable.${e}`);let M=new Set(Object.keys(b.deletable).flatMap(e=>m.entityTypes.includes(e)?[e]:m.aliases[e]??[])),R=m.actionFields.flatMap(e=>{let t=p(b.actions,e.actionName);if(void 0===t)return[];let i=`assistant.actions.${e.actionName}`;return c({description:""},t,i),[{...e,description:d(t.description,e.description,i)}]}),S=e=>{let t=b.navigation[e];if(void 0===t)return[];let i=`assistant.navigation.${e}`;return c(v.navigation[e]??{},t,i),m.navigation[e].flatMap(e=>{let s=p(t,e.state);if(void 0===s)return[];let n=`${i}.${e.state}`;return c({description:""},s,n),[{...e,description:d(s.description,e.description,n)??e.description}]})},D=u;if(u){void 0!==b.ai&&c({...u.ai,maxThreadSize:void 0,hourlyLimits:void 0,voice:void 0},b.ai,"assistant.ai");let{hourlyLimits:n,...a}=b.ai??{},o={...u.ai.hourlyLimits};if(void 0!==n)for(let e of(c(Object.fromEntries(t.map(e=>[e,void 0])),n,"assistant.ai.hourlyLimits"),t)){let t=n[e];void 0!==t&&((!Number.isInteger(t)||t<=0)&&l(`assistant.ai.hourlyLimits.${e}`,"expected a positive whole number of weighted tokens"),o[e]=t)}let r={...u.ai,...Object.fromEntries(Object.entries(a).filter(([,e])=>void 0!==e)),...Object.keys(o).length>0&&{hourlyLimits:o}};e.includes(r.provider)&&i.includes(r.model)&&s.includes(r.reasoning)||l("assistant.ai","expected a supported provider, model and reasoning level"),void 0!==r.maxThreadSize&&(!Number.isInteger(r.maxThreadSize)||r.maxThreadSize<=0)&&l("assistant.ai.maxThreadSize","expected a positive whole number of input tokens"),void 0!==r.voice&&"boolean"!=typeof r.voice&&l("assistant.ai.voice","expected true or false"),D={ai:r}}void 0!==b.instructions&&"string"!=typeof b.instructions&&l("assistant.instructions","expected a string"),void 0!==b.webmcp&&!1!==b.webmcp&&l("assistant.webmcp","can only turn WebMCP off; omit this flag or set false");let{instructions:A,webmcp:k,...N}=m,z=""===b.instructions?void 0:b.instructions??A;return{resolved:{...N,fields:O,deletableTypes:m.entityTypes.filter(e=>M.has(e)),writableTypes:m.entityTypes.flatMap(e=>{let t=[...j.get(e)?.values()??[]];return t.length?[{entityType:e,fields:t}]:[]}),optionsEdges:Object.fromEntries(T),childRecipes:x("childRecipes"),replaceRecipes:x("replaceRecipes"),screenshots:Object.fromEntries(m.entityTypes.flatMap(e=>{let t=E.get(e);return t?[[e,t]]:[]})),actionFields:R,navigation:{navigationStates:S("navigationStates"),viewStates:S("viewStates"),toolStates:S("toolStates")},select:(()=>{let e=b.navigation.select;if(void 0===e)return[];let t="assistant.navigation.select";return c(v.navigation.select??{},e,t),m.select.flatMap(i=>{let s=p(e,i.name);if(void 0===s)return[];let n=`${t}.${i.name}`;c({description:""},s,n);let a=d(s.description,i.description,n);return[{name:i.name,entityTypes:i.entityTypes,...void 0===a?{}:{description:a}}]})})(),...void 0===z?{}:{instructions:z},...!1===b.webmcp||!1===k?{webmcp:!1}:{}},settings:D}};
|
|
1
|
+
import{ASSISTANT_AI_PROVIDERS as e,ASSISTANT_HOURLY_LIMIT_LEVELS as t,ASSISTANT_MODEL_TIERS as i,ASSISTANT_REASONING_LEVELS as s}from"@salsita-ai/contracts/assistant";import{assistantExposedTypes as n}from"../assistant-exposure.js";import{describeAssistantValues as a,mergeAssistantFields as o,resolveAssistantField as r}from"../assistant-fields.js";import{projectAssistantSetupManifest as l}from"./assistant-setup-manifest.js";export class AssistantSetupError extends Error{constructor(e,t){super(`${e}: ${t}`),this.name="AssistantSetupError"}}let c=(e,t)=>{throw new AssistantSetupError(e,t)},p=(e,t,i)=>{for(let s of((null===t||"object"!=typeof t||Array.isArray(t))&&c(i,"expected an object; omit an entry to remove it"),Object.keys(t)))Object.hasOwn(e,s)||c(`${i}.${s}`,"not declared in the spec; remove this key")},d=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0,f=(e,t,i)=>(void 0!==e&&"string"!=typeof e&&c(`${i}.description`,"expected a string"),e??t),m=(e,{name:t,property:i,enumValues:s},n,o)=>{let r=e?.find(e=>e.name===t&&e.source===i)?.valueDescription;return void 0===r?o:[a(r,s),n].filter(Boolean).join(" ")},u=(e,t,i)=>(void 0!==e&&!1!==e&&c(`${i}.allowDryRuns`,"can only disable dry-runs; omit this flag or set false"),!1!==e&&t);export const applyAssistantSetup=(v,b,y)=>{if(null===y)return null;let g=l(v,b),h=v.declarations;p({entities:{},deletable:{},writable:{},childRecipes:{},replaceRecipes:{},screenshots:{},actions:{},formElements:{},navigation:{},instructions:"",webmcp:!1,features:{},ai:{}},y,"assistant"),p(g.entities,y.entities,"assistant.entities"),p(g.deletable,y.deletable,"assistant.deletable"),p(g.writable,y.writable,"assistant.writable"),p(g.actions,y.actions,"assistant.actions"),p(g.formElements,y.formElements,"assistant.formElements"),p(g.screenshots,y.screenshots,"assistant.screenshots"),p(g.navigation,y.navigation,"assistant.navigation");let w=Object.fromEntries(Object.entries(y.entities).map(([e,t])=>{let i=`assistant.entities.${e}`;p(g.entities[e],t,i);let s=h.entities[e];return[e,Object.entries(t).map(([e,t])=>{p({description:""},t,`${i}.${e}`);let n=s.find(t=>t.source===e),o=f(t.description,n.valueDescription,`${i}.${e}`);return{...n,valueDescription:o,description:a(o,n.enumValues),describedByManifest:void 0!==t.description||n.describedByManifest}})]})),$=(e,t,i)=>c(`assistant.entities.${e}`,`conflicting sources ${t} and ${i}`),j=o([],d(w,"AnyDomainEntity")??[],()=>void 0,$),O=new Map([["AnyDomainEntity",j]]);for(let e of Object.keys(v.aliases))"AnyDomainEntity"!==e&&O.set(e,o([j],d(w,e)??[],()=>void 0,$));for(let e of v.entityTypes){let t=Object.entries(v.aliases).filter(([t,i])=>"AnyDomainEntity"!==t&&i.includes(e));O.set(e,o([j,...t.map(([e])=>O.get(e)??[])],d(w,e)??[],t=>h.enumValues[e]?.[t],$))}let x=Object.fromEntries([...O].map(([e,t])=>[e,t.map(t=>r(t,d(w,e)??[]))])),T=new Map,E=new Map;for(let[e,t]of Object.entries(y.writable)){let i=`assistant.writable.${e}`;for(let[s,n]of(p(g.writable[e],t,i),Object.entries(t))){let t=`${i}.${s}`,a=h.writable[e][s];for(let[e,{field:i,options:o,enumValues:r,exposedDescription:l,describedByManifest:f}]of(p(Object.values(a.members).some(e=>e.options)?{options:{}}:{},n,t),void 0!==n.options&&(p({validate:!0,allowDryRuns:!1},n.options,`${t}.options`),void 0!==n.options.validate&&!0!==n.options.validate&&c(`${t}.options.validate`,"can only enable validation; omit this flag or set true"),u(n.options.allowDryRuns,!0,`${t}.options`)),Object.entries(a.members))){let p=d(w,e)?.find(e=>e.source===s)?.name??O.get(e)?.find(e=>e.source===s)?.name,v=p??s;void 0===p&&O.get(e)?.some(e=>e.name===s&&e.source!==s)&&c(t,`narrowing leaves ${e}.${s} bound to another read field; retain its original exposure or remove this writable property`);let b=T.get(e)??new Map;if([...b.values()].some(e=>e.name===v&&e.property!==s)&&c(t,`narrowing maps multiple writable properties to ${e}.${v}; retain their original exposures or remove the conflicting property`),b.has(s)||b.set(s,{...i,name:v,...void 0===p||f?{}:{description:m(O.get(e),{name:v,property:s,enumValues:r},l,i.description)}}),T.set(e,b),o){let i=a.defaultOptionsName?`${v}Options`:o.options.edgeName;E.get(e)?.some(e=>e.options.edgeName===i||e.options.field===v)&&c(`${t}.options`,`narrowing duplicates options edge ${e}.${i}; retain the original field exposures or remove the conflicting writable declaration`),E.set(e,[...E.get(e)??[],{hints:o.hints,options:{...o.options,field:v,edgeName:i,validate:n.options?.validate??o.options.validate,dryRuns:u(n.options?.allowDryRuns,o.options.dryRuns,`${t}.options`)}}])}}}}for(let[e,t]of Object.entries(v.optionsEdges))for(let i of t){let t=v.writableTypes.find(t=>t.entityType===e)?.fields.find(e=>e.name===i.options.field)?.property;if(i.options.validate&&t&&T.get(e)?.has(t)&&!E.get(e)?.some(i=>i.options.field===T.get(e)?.get(t)?.name&&i.options.validate)){let i=Object.keys(y.writable).find(i=>Object.hasOwn(y.writable[i],t)&&h.writable[i]?.[t]?.members[e]);c(`assistant.writable.${i}.${t}`,`cannot remove declared validation while another declaration keeps ${e}.${t} writable; remove all writable declarations for it`)}}let M=e=>{p(g[e],y[e],`assistant.${e}`);let t=new Map;for(let[i,s]of Object.entries(y[e])){let n=`assistant.${e}.${i}`;p(g[e][i],s,n);let a=h[e][i],o=Object.entries(s).map(([e,t])=>{let i=`${n}.${e}`;p({description:"",allowDryRuns:!1},t,i);let s=a.find(t=>t.instanceName===e);return{...s,description:f(t.description,s.description,i),dryRuns:u(t.allowDryRuns,s.dryRuns,i)}});for(let e of v.entityTypes.includes(i)?[i]:v.aliases[i]??[])t.set(e,[...t.get(e)??[],...o])}return Object.fromEntries(v.entityTypes.flatMap(e=>{let i=t.get(e);return i?.length?[[e,i]]:[]}))},R=new Map;for(let[e,t]of Object.entries(y.screenshots)){let i=`assistant.screenshots.${e}`;p(g.screenshots[e],t,i);let s=v.entityTypes.includes(e)?[e]:v.aliases[e]??[];for(let[n,a]of Object.entries(t)){let t=`${i}.${n}`;p({description:""},a,t);let o=h.screenshots[e].find(e=>e.instanceName===n),r={...o,description:f(a.description,o.description,t)??o.description};for(let e of s)R.set(e,[...R.get(e)??[],r])}}for(let[e,t]of Object.entries(y.deletable))p({},t,`assistant.deletable.${e}`);let D=new Set(Object.keys(y.deletable).flatMap(e=>v.entityTypes.includes(e)?[e]:v.aliases[e]??[])),k=v.actionFields.flatMap(e=>{let t=d(y.actions,e.actionName);if(void 0===t)return[];let i=`assistant.actions.${e.actionName}`;return p({description:""},t,i),[{...e,description:f(t.description,e.description,i)}]}),S=v.formElements.flatMap(e=>{let t=d(y.formElements,e.name);if(void 0===t)return[];let i=`assistant.formElements.${e.name}`;return p({description:""},t,i),[{...e,description:f(t.description,e.description,i)??e.description}]}),N=e=>{let t=y.navigation[e];if(void 0===t)return[];let i=`assistant.navigation.${e}`;return p(g.navigation[e]??{},t,i),v.navigation[e].flatMap(e=>{let s=d(t,e.state);if(void 0===s)return[];let n=`${i}.${e.state}`;return p({description:""},s,n),[{...e,description:f(s.description,e.description,n)??e.description}]})},A=b;if(b){void 0!==y.ai&&p({...b.ai,maxThreadSize:void 0,maxToolCallsPerMessage:void 0,hourlyLimits:void 0,retentionDays:void 0,voice:void 0},y.ai,"assistant.ai"),y.ai?.voice===!0&&!0!==b.ai.voice&&c("assistant.ai.voice","can only turn voice off; declare ai.voice: true in the spec, then omit this key or set false to turn it off per session");let{hourlyLimits:n,...a}=y.ai??{},o={...b.ai.hourlyLimits};if(void 0!==n)for(let e of(p(Object.fromEntries(t.map(e=>[e,void 0])),n,"assistant.ai.hourlyLimits"),t)){let t=n[e];void 0!==t&&((!Number.isInteger(t)||t<=0)&&c(`assistant.ai.hourlyLimits.${e}`,"expected a positive whole number of credits"),o[e]=t)}let r={...b.ai,...Object.fromEntries(Object.entries(a).filter(([,e])=>void 0!==e)),...Object.keys(o).length>0&&{hourlyLimits:o}};e.includes(r.provider)&&i.includes(r.model)&&s.includes(r.reasoning)||c("assistant.ai","expected a supported provider, model and reasoning level"),void 0!==r.maxThreadSize&&(!Number.isInteger(r.maxThreadSize)||r.maxThreadSize<=0)&&c("assistant.ai.maxThreadSize","expected a positive whole number of input tokens"),void 0!==r.maxToolCallsPerMessage&&(!Number.isInteger(r.maxToolCallsPerMessage)||r.maxToolCallsPerMessage<=0)&&c("assistant.ai.maxToolCallsPerMessage","expected a positive whole number of tool calls"),void 0!==r.retentionDays&&(!Number.isInteger(r.retentionDays)||r.retentionDays<=0)&&c("assistant.ai.retentionDays","expected a positive whole number of days"),void 0!==r.voice&&"boolean"!=typeof r.voice&&c("assistant.ai.voice","expected true or false"),A={ai:r}}void 0!==y.instructions&&"string"!=typeof y.instructions&&c("assistant.instructions","expected a string"),void 0!==y.webmcp&&!1!==y.webmcp&&c("assistant.webmcp","can only turn WebMCP off; omit this flag or set false"),void 0!==y.features&&p(v.features,y.features,"assistant.features");let C=e=>{let t=y.features?.[e];return void 0!==t&&"boolean"!=typeof t&&c(`assistant.features.${e}`,"expected true or false"),!0!==t||v.features[e]||c(`assistant.features.${e}`,`can only turn ${e} off; the spec turns it off, so omit this flag or set false`),v.features[e]&&!1!==t},P={drawings:C("drawings"),forms:C("forms"),images:C("images"),annotations:C("annotations")},{instructions:z,webmcp:L,...I}=v,B=""===y.instructions?void 0:y.instructions??z;return{resolved:{...I,exposedTypes:n([...Object.keys(y.entities),...Object.keys(y.writable),...Object.keys(y.deletable),...Object.keys(y.childRecipes),...Object.keys(y.replaceRecipes),...Object.keys(y.screenshots),...Object.keys(y.navigation.select??{})],v),fields:x,deletableTypes:v.entityTypes.filter(e=>D.has(e)),writableTypes:v.entityTypes.flatMap(e=>{let t=[...T.get(e)?.values()??[]];return t.length?[{entityType:e,fields:t}]:[]}),optionsEdges:Object.fromEntries(E),childRecipes:M("childRecipes"),replaceRecipes:M("replaceRecipes"),screenshots:Object.fromEntries(v.entityTypes.flatMap(e=>{let t=R.get(e);return t?[[e,t]]:[]})),actionFields:k,formElements:S,navigation:{navigationStates:N("navigationStates"),viewStates:N("viewStates"),toolStates:N("toolStates")},select:(()=>{let e=y.navigation.select;if(void 0===e)return[];let t="assistant.navigation.select";return p(g.navigation.select??{},e,t),v.select.flatMap(i=>{let s=d(e,i.name);if(void 0===s)return[];let n=`${t}.${i.name}`;p({description:""},s,n);let a=f(s.description,i.description,n);return[{name:i.name,entityTypes:i.entityTypes,...void 0===a?{}:{description:a}}]})})(),...void 0===B?{}:{instructions:B},webmcp:!1!==y.webmcp&&!1!==L,features:P},settings:A}};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AssistantAiSettings } from '@salsita-ai/contracts/assistant';
|
|
2
2
|
import type { $DomainEntity, ActionTypes, DomainEntity } from '../../../core/index.js';
|
|
3
|
-
import type { AssistantResolvedManifest } from '../../../spec/index.js';
|
|
3
|
+
import type { AssistantFeature, AssistantResolvedManifest } from '../../../spec/index.js';
|
|
4
4
|
/** Declaration-shaped whitelist a project may narrow; bindings and hints stay internal. */
|
|
5
5
|
export interface AssistantSetupManifest<ENTITIES extends DomainEntity<string> = DomainEntity<string>, $MAP extends Record<keyof $MAP, $DomainEntity<ENTITIES>> = Record<string, $DomainEntity<ENTITIES>>, ACTIONS extends ActionTypes = ActionTypes> {
|
|
6
6
|
readonly entities: string extends keyof $MAP ? Readonly<Record<string, Readonly<Record<string, AssistantSetupField>>>> : {
|
|
@@ -17,13 +17,25 @@ export interface AssistantSetupManifest<ENTITIES extends DomainEntity<string> =
|
|
|
17
17
|
readonly actions: {
|
|
18
18
|
readonly [ACTION in keyof ACTIONS]?: AssistantSetupField;
|
|
19
19
|
};
|
|
20
|
+
/** The project's own form elements, keyed by name; built-in elements are not narrowable and never appear. */
|
|
21
|
+
readonly formElements: Readonly<Record<string, AssistantSetupField>>;
|
|
20
22
|
/** The UI states the agent may move the user to, per kind, keyed by the state as the spec declares it. */
|
|
21
23
|
readonly navigation: AssistantSetupNavigation;
|
|
22
24
|
/** The integrator's guidance for the assistant; an empty string clears it, an omitted one keeps the spec's. */
|
|
23
25
|
readonly instructions?: string;
|
|
24
26
|
/** `false` turns the WebMCP tools off for the session; WebMCP can only be turned off, never on. */
|
|
25
27
|
readonly webmcp?: false;
|
|
26
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* The parts of the assistant panel that are on, every flag shown. `false` turns one off for the session; a flag
|
|
30
|
+
* the spec has off cannot be turned on, and one left out keeps the spec's value.
|
|
31
|
+
*/
|
|
32
|
+
readonly features?: {
|
|
33
|
+
readonly [FEATURE in AssistantFeature]?: boolean;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The server's AI settings; absent in the browser run, which never sees them. `voice` can only be turned off: a
|
|
37
|
+
* session gets voice messages only when the spec declares `ai.voice: true`.
|
|
38
|
+
*/
|
|
27
39
|
readonly ai?: Partial<AssistantAiSettings>;
|
|
28
40
|
}
|
|
29
41
|
/** Optional description override; omission preserves the declaration's effective text. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const projectAssistantSetupManifest=(e,t)=>{let i=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Object.fromEntries(t.map(e=>[e.instanceName,{...void 0===e.description?{}:{description:e.description},...!e.dryRuns?{allowDryRuns:!1}:{}}]))])),s=e.declarations,{navigationStates:n,viewStates:r,toolStates:
|
|
1
|
+
export const projectAssistantSetupManifest=(e,t)=>{let i=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,Object.fromEntries(t.map(e=>[e.instanceName,{...void 0===e.description?{}:{description:e.description},...!e.dryRuns?{allowDryRuns:!1}:{}}]))])),s=e.declarations,{navigationStates:n,viewStates:r,toolStates:o}=e.navigation,c=e=>Object.fromEntries(e.map(({state:e,description:t})=>[e,{description:t}]));return{entities:Object.fromEntries(Object.entries(s.entities).map(([e,t])=>[e,Object.fromEntries(t.map(e=>[e.source,{...!e.describedByManifest||void 0===e.valueDescription?{}:{description:e.valueDescription}}]))])),deletable:Object.fromEntries(s.deletable.map(e=>[e,{}])),writable:Object.fromEntries(Object.entries(s.writable).map(([e,t])=>[e,Object.fromEntries(Object.entries(t).map(([e,t])=>{let i=Object.values(t.members).find(e=>e.options)?.options?.options;return[e,i?{options:{...i.validate?{validate:!0}:{},...!i.dryRuns?{allowDryRuns:!1}:{}}}:{}]}))])),childRecipes:i(s.childRecipes),replaceRecipes:i(s.replaceRecipes),screenshots:Object.fromEntries(Object.entries(s.screenshots).map(([e,t])=>[e,Object.fromEntries(t.map(({instanceName:e,description:t})=>[e,{description:t}]))])),actions:Object.fromEntries(e.actionFields.map(e=>[e.actionName,void 0===e.description?{}:{description:e.description}])),formElements:Object.fromEntries(e.formElements.map(({name:e,description:t})=>[e,{description:t}])),navigation:{...n.length>0?{navigationStates:c(n)}:{},...r.length>0?{viewStates:c(r)}:{},...o.length>0?{toolStates:c(o)}:{},...e.select.length>0?{select:Object.fromEntries(e.select.map(({name:e,description:t})=>[e,void 0===t?{}:{description:t}]))}:{}},...void 0===e.instructions?{}:{instructions:e.instructions},...!1===e.webmcp?{webmcp:!1}:{},features:{...e.features},...t?{ai:{...t.ai}}:{}}};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AssistantManifest } from '../../../spec/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Whether the session's assistant takes images: the user may attach them or annotate, or the assistant takes
|
|
4
|
+
* screenshots, which the browser uploads like attachments. Without any of them the setup tells the server
|
|
5
|
+
* `images: false`, and the server refuses image uploads and every run that carries an image.
|
|
6
|
+
*/
|
|
7
|
+
export declare const assistantTakesImages: ({ features, screenshots }: AssistantManifest) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const assistantTakesImages=({features:s,screenshots:a})=>s.images||s.annotations||Object.values(a??{}).some(s=>s.length>0);
|
|
@@ -2,3 +2,4 @@ export * from './assistant-setup-manifest.js';
|
|
|
2
2
|
export * from './AssistantSetupHandler.js';
|
|
3
3
|
export { applyAssistantSetup, AssistantSetupError } from './apply-assistant-setup.js';
|
|
4
4
|
export { createSessionAssistant, type SessionAssistantSetup } from './create-session-assistant.js';
|
|
5
|
+
export { assistantTakesImages } from './assistant-takes-images.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./assistant-setup-manifest.js";export*from"./AssistantSetupHandler.js";export{applyAssistantSetup,AssistantSetupError}from"./apply-assistant-setup.js";export{createSessionAssistant}from"./create-session-assistant.js";
|
|
1
|
+
export*from"./assistant-setup-manifest.js";export*from"./AssistantSetupHandler.js";export{applyAssistantSetup,AssistantSetupError}from"./apply-assistant-setup.js";export{createSessionAssistant}from"./create-session-assistant.js";export{assistantTakesImages}from"./assistant-takes-images.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e}from"zod";import{DomainEntityIdSchema as t,systemUpdateFactory as i}from"../core/index.js";import{findAssistantFieldOptions as n,readAssistantFieldOptions as a}from"./assistant-field-options.js";import{assistantAddedEntityIds as r,findAssistantRecipeGroups as o,prepareAssistantRecipeUpdates as s,readAssistantRecipeGroup as d}from"./assistant-recipe-groups.js";import{
|
|
1
|
+
import{z as e}from"zod";import{DomainEntityIdSchema as t,systemUpdateFactory as i}from"../core/index.js";import{findAssistantFieldOptions as n,readAssistantFieldOptions as a}from"./assistant-field-options.js";import{assistantAddedEntityIds as r,findAssistantRecipeGroups as o,prepareAssistantRecipeUpdates as s,readAssistantRecipeGroup as d}from"./assistant-recipe-groups.js";import{isAssistantVisible as l,prepareDeselectUpdates as p,prepareNavigateUpdates as h,prepareSelectUpdates as u,prepareSetToolUpdates as f,prepareSetViewUpdates as y,readAssistantNavigation as c}from"./assistant/index.js";export const deleteEntityUpdateTag="deleteEntity";export const modifyEntityUpdateTag="modifyEntity";let g=({systems:e,resolveLocalizable:t})=>({componentReader:e.componentReader,recipeCooker:e.recipeCooker,resolveLocalizable:t}),m=e.string().regex(new RegExp(t.pattern),'An entity id is the type name, a dash and a number, e.g. "Root-1". Query the current entities and use an id they return.'),$=e.object({id:m}),w=e.object({id:m,delta:e.record(e.unknown())}),v="modify",b=(e,t)=>Object.entries(e).find(([e])=>e===t)?.[1],E=e=>Array.isArray(e)?e.map(E):"object"!=typeof e||null===e||Array.isArray(e)?e:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,E(t)])),j=e.object({parentId:m,groupId:e.string(),recipeKey:e.string()}),S=e.object({entityId:m,groupId:e.string(),recipeKey:e.string()}),R=e=>e.map(e=>`"${e}"`).join(", "),I={navigationStates:[],viewStates:[],toolStates:[]},T=e.object({to:e.string()}),k=({systems:e,readOfferedNavigation:t})=>({navigationSystem:e.navigationSystem,readOfferedNavigation:t}),x={name:"navigate",navigation:!0,implementation:(e,t,i)=>{let{to:n}=T.parse(e),a=i.manifest.navigation??I;return{updates:h(n,t,k(i),a),readResult:e=>c(e.state,k(i),a)}}},O={name:"setView",navigation:!0,implementation:(e,t,i)=>{let{to:n}=T.parse(e),a=i.manifest.navigation??I;return{updates:y(n,t,k(i),a),readResult:e=>c(e.state,k(i),a)}}},A={name:"setTool",navigation:!0,implementation:(e,t,i)=>{let{to:n}=T.parse(e),a=i.manifest.navigation??I;return{updates:f(n,t,k(i),a),readResult:e=>c(e.state,k(i),a)}}},Q=({systems:e,isOfferedForSelection:t})=>({navigationSystem:e.navigationSystem,isOfferedForSelection:t}),N=e.object({id:m}),C={name:"select",navigation:!0,implementation:(e,t,i)=>{let{id:n}=N.parse(e);return{updates:u(n,t,Q(i),i.manifest.select??[]),readResult:e=>i.systems.domain.get$Entity(i.systems.navigationSystem.getActiveSelectionState(e.state),e.state)}}},D={name:"deselect",navigation:!0,implementation:(e,t,i)=>({updates:p(t,Q(i)),readResult:e=>i.systems.domain.get$Entity(i.systems.navigationSystem.getActiveSelectionState(e.state),e.state)})},M=[{name:"deleteEntity",implementation:(e,t,{manifest:n})=>{let{id:a}=$.parse(e),r=t.entities.find(e=>e.id===a);if(!r)throw Error(`Entity "${a}" does not exist, so it cannot be deleted. It may have been deleted by an earlier operation or field. Query the current entities and use an id they return.`);let o=n.deletableTypes??[];if(!o.includes(r.type))throw Error(`Entity "${a}" is a ${r.type}, which is not deletable. ${o.length>0?`Only entities of these types can be deleted: ${o.join(", ")}.`:"No entity type is deletable."} Delete an entity of a deletable type instead.`);return{updates:[i.EntityDeletion({entityId:r.id,updateTag:"deleteEntity"})],readResult:e=>[r.id,...(({previousState:e,state:t},i,n)=>{let a=new Set(t.entities.map(e=>e.id));return e.entities.filter(e=>e.id!==i&&!a.has(e.id)&&l(e,n)).map(e=>e.id)})(e,r.id,n)]}}},{name:"addChild",implementation:(e,t,i)=>{let{parentId:n,groupId:a,recipeKey:l}=j.parse(e),p=t.entities.find(e=>e.id===n);if(!p)throw Error(`Entity "${n}" does not exist, so nothing can be added to it. It may have been deleted by an earlier operation or field. Query the current entities and use an id they return.`);let h=o(i.manifest,"child",p.type),u=h.find(e=>e.groupId===a);if(!u)throw Error(`Entity "${n}" is a ${p.type}, which has no recipe group "${a}". ${h.length>0?`Its recipe groups are: ${R(h.map(e=>e.groupId))}.`:`Nothing can be added to a ${p.type}.`} Query the groups under "meta { childRecipes }" on the entity you want to add to and use a groupId they return.`);let f=g(i),y=d("child",u,p.id,t,f);if(!y)throw Error(`The recipe group "${a}" is not available on "${n}" right now, so nothing can be added from it. The configurator offers a group only in some states of the configuration. Query the groups under "meta { childRecipes }" on "${n}" to see the ones it offers now; a group it does not offer is null.`);let c=y.recipes.find(e=>e.key===l);if(!c)throw Error(`The recipe group "${a}" on "${n}" has no recipe with the key "${l}". Recipes and their keys change with the configuration and with the language. List the recipes of the group again and use a key it returns.`);let m=s(c,y,p.id,t,f);return{updates:m,readResult:e=>r(m,p.id,e,i.manifest).map(t=>i.systems.domain.get$Entity(t,e.state))}}},{name:"replaceEntity",implementation:(e,t,i)=>{let{entityId:n,groupId:a,recipeKey:l}=S.parse(e),p=t.entities.find(e=>e.id===n);if(!p)throw Error(`Entity "${n}" does not exist, so it cannot be replaced. It may have been deleted or replaced by an earlier operation or field; a replaced entity gets a new id. Query the current entities and use an id they return.`);let h=o(i.manifest,"replace",p.type),u=h.find(e=>e.groupId===a);if(!u)throw Error(`Entity "${n}" is a ${p.type}, which has no replace recipe group "${a}". ${h.length>0?`Its replace recipe groups are: ${R(h.map(e=>e.groupId))}.`:`A ${p.type} cannot be replaced.`} Query the groups under "meta { replaceRecipes }" on the entity you want to replace and use a groupId they return.`);let f=g(i),y=d("replace",u,p.id,t,f);if(!y)throw Error(`The recipe group "${a}" is not available on "${n}" right now, so it cannot be replaced from it. The configurator offers a group only in some states of the configuration. Query the groups under "meta { replaceRecipes }" on "${n}" to see the ones it offers now; a group it does not offer is null.`);let c=y.recipes.find(e=>e.key===l);if(!c)throw Error(`The recipe group "${a}" on "${n}" has no recipe with the key "${l}". Recipes and their keys change with the configuration and with the language. List the recipes of the group again and use a key it returns.`);let m=s(c,y,p.id,t,f);return{updates:m,readResult:e=>r(m,p.id,e,i.manifest).map(t=>i.systems.domain.get$Entity(t,e.state))}}}];export const findAssistantMutation=(e,t)=>{var r;let o,s,d=M.find(t=>t.name===e),l=(r=t.navigation,"navigate"===e&&(r?.navigationStates.length??0)>0?x:"setView"===e&&(r?.viewStates.length??0)>0?O:"setTool"===e&&(r?.toolStates.length??0)>0?A:void 0),p=(t.select?.length??0)>0;if(d)return d;if(l)return l;if("select"===e&&p)return C;if("deselect"===e&&p)return D;if(!e.startsWith(v))return;let h=e.slice(v.length),u=b(t.writableFields??{},h);return u&&(o=`${v}${h}`,s=Object.keys(u).join(", "),{name:o,implementation:(e,t,r)=>{let{manifest:d}=r,{domain:l}=r.systems,{id:p,delta:f}=w.parse(e),y=t.entities.find(e=>e.id===p);if(!y)throw Error(`Entity "${p}" does not exist, so it cannot be modified. It may have been deleted by an earlier operation or field. Query the current entities and use an id they return.`);if(y.type!==h)throw Error(`Entity "${p}" is a ${y.type}, but ${o} modifies only ${h} entities. ${b(d.writableFields??{},y.type)?`Use ${v}${y.type} for it instead.`:`${y.type} has no writable fields, so it cannot be modified; pass the id of a ${h}.`}`);let c=Object.entries(f).flatMap(([e,t])=>{let i=b(u,e);return void 0===i?[]:[{field:e,property:i,value:E(t)}]}),m=Object.fromEntries(c.map(({property:e,value:t})=>[e,t]));if(0===Object.keys(m).length)throw Error(`The delta of ${o} is empty, so there is nothing to change on "${p}". Set at least one of its fields: ${s}.`);let $=l.validateEntity({...y,...m});if(!$.success){let e=c.filter(({field:e,property:t})=>e!==t).map(({field:e,property:t})=>`${e} refers to ${t}`);throw Error(`The delta would make "${p}" an invalid ${h}: ${$.errors.join("; ")}. ${e.length>0?`The messages use these field names: ${e.join(", ")}. `:""}Nothing was changed. Send values that fit the types and the allowed values the schema describes for these fields.`)}let j=n(d,h);for(let{field:e,value:i}of c){let n=j.find(t=>t.field===e);if(!n?.validate||null===i)continue;let o=a(n,y.id,t,g(r));if(o&&!o.some(e=>e.value===i))throw Error(`${JSON.stringify(i)} is not a value "${e}" of "${p}" can take right now. ${o.length>0?`The configurator offers these values: ${o.map(e=>JSON.stringify(e.value)).join(", ")}.`:"The configurator offers no value for it in this state."} Nothing was changed. Send one of the offered values; "meta { ${n.edgeName} }" on the entity lists them with their names. When the values depend on another field of this delta, change that field in an earlier mutation field of the same operation.`)}return{updates:[i.DomainEntityModification({entityId:y.id,stateDelta:m,updateTag:"modifyEntity"})],readResult:({state:e})=>l.getEntity(y.id,e)?l.get$Entity(y.id,e):null}}})};
|
|
@@ -88,11 +88,12 @@ export declare const prepareAssistantRecipeUpdates: (recipe: AssistantRecipe, {
|
|
|
88
88
|
/**
|
|
89
89
|
* The ids of the entities a recipe put into the configuration: everything in `state` that was not in
|
|
90
90
|
* `previousState`, so what the transformers added in response is included. The recipe's own entities
|
|
91
|
-
* come first: the replacement and the ones added directly under `entityId`
|
|
92
|
-
* others in state order
|
|
91
|
+
* come first, whatever their type: the replacement and the ones added directly under `entityId`
|
|
92
|
+
* before the rest; then the others in state order, only those of the types the manifest exposes, so
|
|
93
|
+
* projected or other entities the assistant does not see are left out.
|
|
93
94
|
*/
|
|
94
95
|
export declare const assistantAddedEntityIds: (updates: readonly AnyRecipeUpdate[], entityId: DomainEntityId<string>, { previousState, state }: {
|
|
95
96
|
readonly previousState: AnyDomainState;
|
|
96
97
|
readonly state: AnyDomainState;
|
|
97
|
-
}) => ReadonlyArray<DomainEntityId<string>>;
|
|
98
|
+
}, manifest: Pick<AssistantManifest, 'fields'>) => ReadonlyArray<DomainEntityId<string>>;
|
|
98
99
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{childEntityRecipesComponent as e,isChildEntityRecipesSnapshot as t}from"../system-components/child-entity-recipes.js";import{isReplaceEntityRecipesSnapshot as
|
|
1
|
+
import{childEntityRecipesComponent as e,isChildEntityRecipesSnapshot as t}from"../system-components/child-entity-recipes.js";import{isReplaceEntityRecipesSnapshot as i,replaceEntityRecipesComponent as r}from"../system-components/replace-entity-recipes.js";import{isAssistantVisible as n}from"./assistant/index.js";export const findAssistantRecipeGroups=(e,t,i)=>Object.entries(("child"===t?e.childRecipes:e.replaceRecipes)??{}).find(([e])=>e===i)?.[1]??[];export const readAssistantRecipeGroup=(n,p,a,s,o)=>{var c;let l,d,f,m=((n,p,a,s,{componentReader:o})=>{if("child"===n){let i=o.readOneComponent({entityId:a,componentType:e,instanceName:p},s);if(!i||!t(i))return null;let{recipes:r,groupLabel:c,groupDescription:l,collection:d}=i.state;return{recipes:r,groupLabel:c,groupDescription:l,target:{kind:n,collection:d}}}let c=o.readOneComponent({entityId:a,componentType:r,instanceName:p},s);if(!c||!i(c))return null;let{recipes:l,groupLabel:d,groupDescription:f,keepChildren:m}=c.state;return{recipes:l,groupLabel:d,groupDescription:f,target:{kind:n,keepChildren:m}}})(n,p.instanceName,a,s,o);if(!m)return null;let u=m.recipes.filter(e=>e.recipes.length>0),h=(c=o.resolveLocalizable,l=new Set,d=new Map,f=(e,t)=>{let i=t;for(let e=2;l.has(i);e++)i=`${t} ${e}`;l.add(i),d.set(e,i)},u.forEach((e,t)=>{void 0!==e.key&&f(t,e.key)}),u.forEach((e,t)=>{void 0===e.key&&f(t,c(e.title))}),u.flatMap((e,t)=>d.get(t)??[]));return{group:p,label:m.groupLabel,description:m.groupDescription,target:m.target,recipes:u.flatMap((e,t)=>{let i=h[t];return void 0===i?[]:[{key:i,item:e}]})}};export const prepareAssistantRecipeUpdates=(e,{group:t,target:i},r,n,{recipeCooker:p})=>{if("child"===i.kind)return p.prepareCreateUpdates(e.item.recipes,n,r,i.collection);let a=p.cookRecipes(e.item.recipes,n).filter(e=>!e.parentId).length;if(1!==a)throw Error(`The recipe "${e.key}" of the recipe group "${t.groupId}" cannot replace "${r}": a replacement has to be exactly one entity, with anything else composed into it, but this recipe produces ${a} separate entities. The recipe is defined by the configurator and cannot be corrected from here. Use another recipe of the group, and tell the user this one is not available.`);return p.prepareReplaceUpdates(e.item.recipes,n,r,i.keepChildren)};export const assistantAddedEntityIds=(e,t,{previousState:i,state:r},p)=>{let a=new Set(i.entities.map(e=>e.id)),s=r.entities.filter(e=>!a.has(e.id)),o=s.map(e=>e.id),c=e.filter(e=>"replaceDomainEntity"===e.kind||e.parentId===t),l=[...c,...e.filter(e=>!c.includes(e))].map(e=>"replaceDomainEntity"===e.kind?e.replacementEntity.id:e.entityId).filter(e=>o.includes(e)),d=s.filter(e=>!l.includes(e.id)&&n(e,p)).map(e=>e.id);return[...l,...d]};
|
|
@@ -4,6 +4,7 @@ import type { z } from 'zod';
|
|
|
4
4
|
import type { FinalizeTaskResource } from '@salsita-ai/contracts/webhook';
|
|
5
5
|
import { type $DomainEntity, type ActionTypes, type DomainEntity, type DomainFactory, type EnumLike, type ProductPreset, type SchemaOfObject } from '../core/index.js';
|
|
6
6
|
import type { AssistantResolvedManifest, ElementRegistration, HandlerRegistration, ProjectModule } from '../spec/index.js';
|
|
7
|
+
import { type AccessHandlers } from './access/index.js';
|
|
7
8
|
import type { AclConfig, ApplicationConfig, DataSpec, DefaultEnvs, ResourcesConfig, SpecTransformer, TransformersConfig, UserInterfaceConfig } from './application-config.js';
|
|
8
9
|
interface ConfiguratorBuilderContext<ENTITIES extends DomainEntity<string> = never, ALLOWED_ROOT_ENTITIES extends ENTITIES = never, $MAP extends Record<ENTITIES['type'], $DomainEntity<ENTITIES>> = never, NAVIGATION_STATES extends string = never, VIEW_STATES extends string = never, TOOL_STATES extends string = never, EXPORT_STATES extends string = never, PUBLISHED_DATA extends Record<string, unknown> = never, SESSION_DATA extends Record<string, unknown> = never, FRONTEND_DATA extends Record<string, unknown> = never, ADMIN_ENTITIES extends DomainEntity<string> = never, ADMIN_ALLOWED_ROOT_ENTITIES extends ADMIN_ENTITIES = never, ADMIN_$MAP extends Record<ADMIN_ENTITIES['type'], $DomainEntity<ADMIN_ENTITIES>> = never, ADMIN_NAVIGATION_STATES extends string = never, ADMIN_VIEW_STATES extends string = never, FINALIZE_DATA extends Record<string, unknown> = never, PREFETCHED_FINALIZE_DATA extends Record<string, unknown> = never, FINALIZE_RESULT extends Record<string, unknown> = never, CALLBACK_DATA extends Record<string, unknown> = never, RESOURCE extends string = never> {
|
|
9
10
|
version?: string;
|
|
@@ -130,6 +131,7 @@ export declare class ConfiguratorBuilder<ENTITIES extends DomainEntity<string> =
|
|
|
130
131
|
mapPublishedChunkedData: ((props: import("./index.js").MapPublishedChunkedDataHandlerProps<ADMIN_ENTITIES, ADMIN_ALLOWED_ROOT_ENTITIES, ADMIN_$MAP>) => import("./index.js").ChunkedPublishedData) | undefined;
|
|
131
132
|
dataRowValidator: ((props: import("./index.js").DataRowValidatorProps) => import("./index.js").DataRowValidatorResult) | undefined;
|
|
132
133
|
sheetValidator: ((props: import("./index.js").SheetValidatorProps) => import("./index.js").SheetValidatorResult) | undefined;
|
|
134
|
+
accessHandlers: AccessHandlers<SESSION_DATA>;
|
|
133
135
|
};
|
|
134
136
|
}
|
|
135
137
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{initConsoleLogger as t}from"@salsita-ai/common/utils";import{defaultI18n as e}from"#package/i18n";import{extendedSchemaValidator as i}from"../core/index.js";import{NoopAnalyticsSystem as
|
|
1
|
+
import{initConsoleLogger as t}from"@salsita-ai/common/utils";import{defaultI18n as e}from"#package/i18n";import{extendedSchemaValidator as i}from"../core/index.js";import{NoopAnalyticsSystem as n}from"../domain-context/index.js";import{createDomainRuntime as r}from"../domain-runtime/index.js";import{isGetApplicationWrapperHandler as o}from"./GetApplicationWrapperHandler.js";import{isGetWebComponentOptionsHandler as a}from"./GetWebComponentOptions.js";import{isAnonymousHandler as s,isChunkScopesHandler as h,isCodeHandler as l,isRefreshHandler as d,isSignedInHandler as u,isVisitorHandler as c}from"./access/index.js";import{isAssistantSetupHandler as f}from"./assistant/index.js";import{createInitialPublishedData as m}from"./create-initial-published-data.js";import{isDataRowValidatorHandler as x}from"./published-data/DataRowValidatorHandler.js";import{isFilterPublishedChunksHandler as w}from"./published-data/FilterPublishedChunksHandler.js";import{isMapPublishedChunkedDataHandler as _}from"./published-data/MapPublishedChunkedDataHandler.js";import{isMapPublishedRevisionDataHandler as p}from"./published-data/MapPublishedRevisionDataHandler.js";import{isSheetValidatorHandler as g}from"./published-data/SheetValidatorHandler.js";let C=[[f,"createAssistantSetupHandler"],[w,"createFilterPublishedChunksHandler"],[x,"createDataRowValidatorHandler"],[g,"createSheetValidatorHandler"]];export const checkSingleInstanceHandlers=t=>{for(let[e,i]of C)if(t.filter(t=>e(t)).length>1)throw Error(`Multiple ${i} handlers found. Only one handler is allowed.`)};export class ConfiguratorBuilder{_context;constructor(t){this._context=t}withDefaultEnvs(t){return new ConfiguratorBuilder({...this._context,defaultEnvs:t})}withVersion(t){return new ConfiguratorBuilder({...this._context,version:t})}withTextLanguages(t){return new ConfiguratorBuilder({...this._context,textLanguages:t})}withAcl(t){return new ConfiguratorBuilder({...this._context,acl:t})}withAdminRelease(t){return new ConfiguratorBuilder({...this._context,enableAdminRelease:t})}withUi(t){return new ConfiguratorBuilder({...this._context,ui:t})}withResourcesConfig(t){return new ConfiguratorBuilder({...this._context,resourcesConfig:t})}withChunks(t){return new ConfiguratorBuilder({...this._context,chunks:t})}withPublishedDataHash(t){return new ConfiguratorBuilder({...this._context,publishedDataHash:t})}withAssistant(t){return new ConfiguratorBuilder({...this._context,assistant:t})}withTheme(t){return new ConfiguratorBuilder({...this._context,theme:t})}withDomainFactory(t){return new ConfiguratorBuilder({...this._context,domainFactory:t})}withAdminDomainFactory(t){return new ConfiguratorBuilder({...this._context,adminDomainFactory:t})}withI18n=t=>new ConfiguratorBuilder({...this._context,i18n:t});withPrefetchedFinalizeData(t){return new ConfiguratorBuilder({...this._context,prefetchedFinalizeData:t})}withFinalizeData(t){return new ConfiguratorBuilder({...this._context,finalizeData:t})}withFinalizeResult(t){return new ConfiguratorBuilder({...this._context,finalizeResult:t})}withCallbackData(t){return new ConfiguratorBuilder({...this._context,callbackData:t})}withNavigationState(t){return new ConfiguratorBuilder({...this._context,navigationState:t})}withViewState(t){return new ConfiguratorBuilder({...this._context,viewState:t})}withToolState(t){return new ConfiguratorBuilder({...this._context,toolState:t})}withExportState(t){return new ConfiguratorBuilder({...this._context,exportState:t})}withAdminNavigationState(t){return new ConfiguratorBuilder({...this._context,adminNavigationState:t})}withAdminViewState(t){return new ConfiguratorBuilder({...this._context,adminViewState:t})}withPresets(t){return new ConfiguratorBuilder({...this._context,presets:t})}withAdminPresets(t){return new ConfiguratorBuilder({...this._context,adminPresets:t})}withComponentOptics(t){return new ConfiguratorBuilder({...this._context,componentOptics:[...this._context.componentOptics,...t]})}withAdminComponentOptics(t){return new ConfiguratorBuilder({...this._context,adminComponentOptics:[...this._context.adminComponentOptics??[],...t]})}withHandlers(t){return new ConfiguratorBuilder({...this._context,handlers:t})}withActionModules(t){return new ConfiguratorBuilder({...this._context,actions:t})}withElements(t){return new ConfiguratorBuilder({...this._context,elements:t})}withDefaultElements(t){return new ConfiguratorBuilder({...this._context,defaultElements:t})}withResources(t){return new ConfiguratorBuilder({...this._context,resources:t})}withWebComponentTag(t){return new ConfiguratorBuilder({...this._context,tagName:t})}withTransformers(t,e){return new ConfiguratorBuilder({...this._context,transformers:{importedTransformers:t,specTransformers:e}})}withInterface(t){return this}withDataSpec=t=>new ConfiguratorBuilder({...this._context,dataSpec:t});_computeInitialPublishedData(t,e,i){if(!this._context.adminDomainFactory)throw Error("adminDomainFactory is required!");return m({adminDomainFactory:this._context.adminDomainFactory,domainRuntime:e,adminPresets:this._context.adminPresets??[],handlers:i,dataSpec:this._context.dataSpec,chunks:this._context.chunks,logger:t})}buildConfig(){return this._buildConfigWithHandlers().config}_buildConfigWithHandlers(){if(!this._context.domainFactory)throw Error("Can not create application config, domainFactory is required! Is it registered with the ConfiguratorBuilder?");if(!this._context.presets)throw Error("Can not create application config, presets are required! Is it registered with the ConfiguratorBuilder?");if(!this._context.adminDomainFactory)throw Error("Can not create application config, adminDomainFactory is required! Is it registered with the ConfiguratorBuilder?");if(!this._context.adminPresets)throw Error("Can not create application config, adminPresets are required! Is it registered with the ConfiguratorBuilder?");if(!this._context.version)throw Error("Can not create application config, version is required!");let i=this._context.tagName??"salsita-configurator",s={defaultEnvs:this._context.defaultEnvs,services:{i18n:this._context.i18n},version:this._context.version,initialPublishedData:{},domain:{textLanguages:this._context.textLanguages,componentOptics:this._context.componentOptics,presets:this._context.presets,domainFactory:this._context.domainFactory},navigation:{navigationStates:this._context.navigationState?.values(),viewStates:this._context.viewState?.values(),toolStates:this._context.toolState?.values(),exportStates:this._context.exportState?.values()},adminNavigation:{navigationStates:this._context.adminNavigationState?.values(),viewStates:this._context.adminViewState?.values()},adminDomain:{textLanguages:this._context.textLanguages,componentOptics:this._context.adminComponentOptics??[],presets:this._context.adminPresets,domainFactory:this._context.adminDomainFactory},mount:{tag:i,options:{}},handlers:this._context.handlers??[],actions:this._context.actions??[],elements:this._context.elements??[],defaultElements:this._context.defaultElements??[],transformers:this._context.transformers,features:{acl:this._context.acl,enableAdminRelease:this._context.enableAdminRelease},ui:{preview:this._context.ui?.preview,alwaysExpand:this._context.ui?.alwaysExpand,theme:this._context.theme},resources:this._context.resourcesConfig,chunks:this._context.chunks,publishedDataHash:this._context.publishedDataHash,assistant:this._context.assistant,dataSpec:this._context.dataSpec},h=t(),l=r({config:s,services:{analyticsService:new n,i18n:e,logger:h}}),d=l.getState().spec.configurator.handlers;checkSingleInstanceHandlers(d);let u=d.find(o)?.handler().handler,c=d.find(a)?.handler().handler(void 0),f=this._computeInitialPublishedData(h,l,d);return{config:{...s,mount:{tag:i,options:c??{},Application:u},initialPublishedData:f},handlers:d}}buildWebhookContext(){if(!this._context.domainFactory)throw Error("domainFactory is required!");if(!this._context.adminDomainFactory)throw Error("adminDomainFactory is required!");if(!this._context.adminPresets)throw Error("adminPresets are required!");let{config:t,handlers:e}=this._buildConfigWithHandlers(),n=t=>{if(null==this._context.finalizeData)return{};let e=i.compile(this._context.finalizeData);if(!e(t))throw console.error("Finalize data validation errors:",e.errors),Error("Invalid finalize data!");return t},r=t=>{if(null==this._context.finalizeResult)return{};let e=i.compile(this._context.finalizeResult);if(!e(t))throw console.error("Finalize result validation errors:",e.errors),Error("Invalid finalize result!");return t},o=t=>{if(null==this._context.callbackData)return{};let e=i.compile(this._context.callbackData);if(!e(t))throw console.error("Callback data validation errors:",e.errors),Error("Invalid callback data!");return t},a=e.find(p)?.handler().handler,f=e.find(_)?.handler().handler,m=e.find(x)?.handler().handler,w=e.find(g)?.handler().handler,C={chunkScopes:e.find(h)?.handler().handler,visitor:e.find(c)?.handler().handler,signedIn:e.find(u)?.handler().handler,code:e.find(l)?.handler().handler,refresh:e.find(d)?.handler().handler,anonymous:e.find(s)?.handler().handler};return{config:t,parseFinalizeData:n,parseFinalizeResult:r,resources:this._context.resources??[],parseCallbackData:o,mapPublishedRevisionData:a,mapPublishedChunkedData:f,dataRowValidator:m,sheetValidator:w,accessHandlers:C}}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { type DomainConfig, type NavigationConfig, type ISessionService, type Session, type ResourcesConfig, type ApplicationConfig, type UserInterfaceConfig, type MountConfig, type WebComponentOptions, type SessionState, type AuthenticationErrorCode, type DataSpec, type DataSpecEntry, type SwatchSpecEntry, type ChunksSpec, type ImportedTransformer, type SpecTransformer, type TransformersConfig, type AdminPagesSpec, type AnyApplicationConfig, type DefaultEnvs, } from './application-config.js';
|
|
1
|
+
export { type DomainConfig, type NavigationConfig, type ISessionService, type Session, type ResourcesConfig, type ApplicationConfig, type UserInterfaceConfig, type MountConfig, type WebComponentOptions, type SessionState, type AuthenticationErrorCode, type SignInAccount, type SignInOutcome, type DataSpec, type DataSpecEntry, type SwatchSpecEntry, type ChunksSpec, type ImportedTransformer, type SpecTransformer, type TransformersConfig, type AdminPagesSpec, type AnyApplicationConfig, type DefaultEnvs, } from './application-config.js';
|
|
2
2
|
export { type AssistantFieldOption, findAssistantFieldOptions, readAssistantFieldOptions, } from './assistant-field-options.js';
|
|
3
3
|
export { deleteEntityUpdateTag, findAssistantMutation, modifyEntityUpdateTag } from './assistant-mutations.js';
|
|
4
4
|
export { type AssistantRecipe, type AssistantRecipeContext, type AssistantRecipeGroupSnapshot, type AssistantRecipeKind, findAssistantRecipeGroups, prepareAssistantRecipeUpdates, readAssistantRecipeGroup, } from './assistant-recipe-groups.js';
|
|
@@ -25,3 +25,4 @@ export { createSheetValidatorHandler, SheetValidatorHandlerName, isSheetValidato
|
|
|
25
25
|
export { createMapPublishedRevisionDataHandler, createMapPublishedRevisionDataHandlerFactory, isMapPublishedRevisionDataHandler, type CreateMapPublishedRevisionDataHandler, type TypedCreateMapPublishedRevisionDataHandler, } from './published-data/MapPublishedRevisionDataHandler.js';
|
|
26
26
|
export { createMapPublishedChunkedDataHandler, createMapPublishedChunkedDataHandlerFactory, isMapPublishedChunkedDataHandler, type CreateMapPublishedChunkedDataHandler, type MapPublishedChunkedDataHandlerProps, type MapPublishedChunkedDataResult, type TypedCreateMapPublishedChunkedDataHandler, } from './published-data/MapPublishedChunkedDataHandler.js';
|
|
27
27
|
export * from './assistant/index.js';
|
|
28
|
+
export * from './access/index.js';
|