@mgamadeus/ddd-agents 0.0.1-stage → 0.1.0-alpha.21
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 +11 -3
- package/dist/chat.js +5263 -0
- package/dist/chat.js.map +1 -0
- package/dist/chunks/AgentsConversationClientContext-C4T7g_Qk.js +22 -0
- package/dist/chunks/AgentsConversationClientContext-C4T7g_Qk.js.map +1 -0
- package/dist/chunks/ConversationMarkdown-W7NHglmL.js +399 -0
- package/dist/chunks/ConversationMarkdown-W7NHglmL.js.map +1 -0
- package/dist/chunks/WebSearchResultsConversationWidget-BvnLWHyi.js +5059 -0
- package/dist/chunks/WebSearchResultsConversationWidget-BvnLWHyi.js.map +1 -0
- package/dist/chunks/canvas-behaviours-BRFR1ALE.js +45 -0
- package/dist/chunks/canvas-behaviours-BRFR1ALE.js.map +1 -0
- package/dist/chunks/canvas-feature-flags-BmmxC3bz.js +11 -0
- package/dist/chunks/canvas-feature-flags-BmmxC3bz.js.map +1 -0
- package/dist/chunks/canvasBodies-9SuF6NAB.js +289 -0
- package/dist/chunks/canvasBodies-9SuF6NAB.js.map +1 -0
- package/dist/chunks/d3-7.6.1.min.js-DTmPafrl.js +6 -0
- package/dist/chunks/d3-7.6.1.min.js-DTmPafrl.js.map +1 -0
- package/dist/chunks/decide-canvas-open-Ct-wnNEJ.js +20 -0
- package/dist/chunks/decide-canvas-open-Ct-wnNEJ.js.map +1 -0
- package/dist/chunks/widget-image-readiness-signal-DeOuL89j.js +25 -0
- package/dist/chunks/widget-image-readiness-signal-DeOuL89j.js.map +1 -0
- package/dist/chunks/widget-name-resolver-DyIY6Zu4.js +9736 -0
- package/dist/chunks/widget-name-resolver-DyIY6Zu4.js.map +1 -0
- package/dist/chunks/withPollingChangeSubscription-BLDAWF-o.js +251 -0
- package/dist/chunks/withPollingChangeSubscription-BLDAWF-o.js.map +1 -0
- package/dist/client-testing.js +346 -0
- package/dist/client-testing.js.map +1 -0
- package/dist/client.js +16 -0
- package/dist/client.js.map +1 -0
- package/dist/contract.js +31 -0
- package/dist/contract.js.map +1 -0
- package/dist/image-render.js +334 -0
- package/dist/image-render.js.map +1 -0
- package/dist/index.js +80 -0
- package/dist/index.js.map +1 -0
- package/dist/kit.js +13 -0
- package/dist/kit.js.map +1 -0
- package/dist/preview.js +733 -0
- package/dist/preview.js.map +1 -0
- package/dist/renderer.js +115 -0
- package/dist/renderer.js.map +1 -0
- package/dist/styles.css +6768 -0
- package/dist/types/chat/AgentChat/AgentChat.d.ts +37 -0
- package/dist/types/chat/AgentChatActivityHistory/AgentChatActivityHistory.d.ts +6 -0
- package/dist/types/chat/AgentChatActivityIndicator/AgentChatActivityIndicator.d.ts +8 -0
- package/dist/types/chat/CanvasPane/CanvasPane.d.ts +15 -0
- package/dist/types/chat/CanvasResizeHandle/CanvasResizeHandle.d.ts +10 -0
- package/dist/types/chat/CanvasResizeHandle/use-canvas-resize.d.ts +43 -0
- package/dist/types/chat/ConversationClosedBar/ConversationClosedBar.d.ts +10 -0
- package/dist/types/chat/ConversationErrorCard/ConversationErrorCard.d.ts +13 -0
- package/dist/types/chat/ConversationIntroCard/ConversationIntroCard.d.ts +10 -0
- package/dist/types/chat/ConversationLoadingStates.d.ts +2 -0
- package/dist/types/chat/ConversationMessage/ConversationCallMarkerChip/ConversationCallMarkerChip.d.ts +14 -0
- package/dist/types/chat/ConversationMessage/ConversationCallMarkerChip/VoiceBarsIcon/VoiceBarsIcon.d.ts +8 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageSystem/ConversationMessageSystem.d.ts +8 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageSystem/ConversationMessageSystemHeader/ConversationMessageSystemHeader.d.ts +9 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageUser/ConversationMessageUser.d.ts +7 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageUser/ConversationMessageUserWidgets.d.ts +14 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/ConversationMessageHeader/ConversationMessageHeader.d.ts +7 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/ConversationMessageThinking/ConversationMessageThinking.d.ts +7 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/ConversationMessageWidgets.d.ts +29 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/copyRichToClipboard.d.ts +1 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/hooks/useFreshMessageBlockReveal.d.ts +14 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/hooks/useStreamingText.d.ts +8 -0
- package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/hooks/useTypewriter.d.ts +12 -0
- package/dist/types/chat/ConversationMessage/ConversationTaskInstructionDisclosure/ConversationTaskInstructionDisclosure.d.ts +12 -0
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInput.d.ts +111 -0
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInputAttachments/ConversationMessageInputAttachmentPreviewCard.d.ts +34 -0
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInputAttachments/ConversationMessageInputAttachmentsErrorBox.d.ts +22 -0
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInputAttachments/ConversationMessageInputAttachmentsPreviewStrip.d.ts +12 -0
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInputAttachments/convert-bytes-to-size-string.d.ts +2 -0
- package/dist/types/chat/ConversationMessageInput/ConversationMessageInputComposerWidgets/ConversationMessageInputComposerWidgets.d.ts +12 -0
- package/dist/types/chat/ConversationMessageList/ConversationMessageList.d.ts +75 -0
- package/dist/types/chat/ConversationScrollToLatestMessageButton/ConversationScrollToLatestMessageButton.d.ts +6 -0
- package/dist/types/chat/ConversationSuggestionCard/ConversationSuggestionCard.d.ts +7 -0
- package/dist/types/chat/ConversationView.d.ts +216 -0
- package/dist/types/chat/ConversationViewBody/ConversationViewBody.d.ts +214 -0
- package/dist/types/chat/ConversationViewBody/hooks/useIsMessagesBottomOutOfView.d.ts +2 -0
- package/dist/types/chat/ConversationViewBody/hooks/usePinQuestionOnSend.d.ts +24 -0
- package/dist/types/chat/assistant-message-has-renderable-markdown.d.ts +13 -0
- package/dist/types/chat/chat-assistant-identity.d.ts +24 -0
- package/dist/types/chat/chat-message.d.ts +11 -0
- package/dist/types/chat/controller/AgentChatController.d.ts +97 -0
- package/dist/types/chat/controller/activity-ticker.d.ts +120 -0
- package/dist/types/chat/controller/changed-messages-request.d.ts +12 -0
- package/dist/types/chat/controller/chat-scroll-target.d.ts +10 -0
- package/dist/types/chat/controller/conversation-change-signal-rules.d.ts +64 -0
- package/dist/types/chat/controller/derive-agent-activity.d.ts +31 -0
- package/dist/types/chat/controller/merge-activity-elements.d.ts +25 -0
- package/dist/types/chat/controller/pending-start-request.d.ts +38 -0
- package/dist/types/chat/controller/use-activity-ticker.d.ts +60 -0
- package/dist/types/chat/controller/use-conversation-activity.d.ts +38 -0
- package/dist/types/chat/controller/use-conversation-live-updates.d.ts +30 -0
- package/dist/types/chat/controller/use-conversation-message-pages.d.ts +24 -0
- package/dist/types/chat/controller/use-conversation-scroll-jump.d.ts +47 -0
- package/dist/types/chat/controller/use-conversation-search.d.ts +31 -0
- package/dist/types/chat/controller/use-conversation-signals.d.ts +44 -0
- package/dist/types/chat/controller/use-debounced-semantic-search.d.ts +15 -0
- package/dist/types/chat/conversation-send-message.d.ts +43 -0
- package/dist/types/chat/last-wire-message-is-unanswered-user-message.d.ts +22 -0
- package/dist/types/chat/normalize-server-message-to-markdown.d.ts +23 -0
- package/dist/types/chat/store/agents-chat-state.d.ts +132 -0
- package/dist/types/chat/store/conversation-error-type.d.ts +32 -0
- package/dist/types/chat/store/create-agents-chat-store.d.ts +23 -0
- package/dist/types/chat/store/index.d.ts +5 -0
- package/dist/types/chat/store/merge-chat-messages.d.ts +20 -0
- package/dist/types/chat/store/reduce-agents-chat-state.d.ts +7 -0
- package/dist/types/chat/store/use-agents-chat-store.d.ts +22 -0
- package/dist/types/chat/strip-pre-call-message-marker.d.ts +12 -0
- package/dist/types/chat/use-canvas-shell-transitions.d.ts +25 -0
- package/dist/types/client/AgentsConversationClient.d.ts +93 -0
- package/dist/types/client/AgentsConversationClientContext.d.ts +17 -0
- package/dist/types/client/polling/createPollingConversationChangeSubscription.d.ts +62 -0
- package/dist/types/client/polling/withPollingChangeSubscription.d.ts +11 -0
- package/dist/types/client/testing/createInMemoryAgentsConversationClient.d.ts +139 -0
- package/dist/types/contract/conversation.d.ts +370 -0
- package/dist/types/entries/chat.d.ts +21 -0
- package/dist/types/entries/client-testing.d.ts +1 -0
- package/dist/types/entries/client.d.ts +4 -0
- package/dist/types/entries/contract.d.ts +1 -0
- package/dist/types/entries/image-render.d.ts +9 -0
- package/dist/types/entries/index.d.ts +9 -0
- package/dist/types/entries/kit.d.ts +4 -0
- package/dist/types/entries/preview.d.ts +8 -0
- package/dist/types/entries/renderer.d.ts +15 -0
- package/dist/types/entries/widgets.d.ts +16 -0
- package/dist/types/image-render/ComposedViewEmailDataTimes/ComposedViewEmailDataTimes.d.ts +15 -0
- package/dist/types/image-render/WidgetImageRender.d.ts +55 -0
- package/dist/types/image-render/WidgetImageRenderContext.d.ts +14 -0
- package/dist/types/image-render/composed-view-data-times.d.ts +20 -0
- package/dist/types/image-render/frozen-widget-requests.d.ts +2 -0
- package/dist/types/image-render/live-widget-requests.d.ts +4 -0
- package/dist/types/image-render/widget-image-google-map.d.ts +7 -0
- package/dist/types/image-render/widget-image-readiness-signal.d.ts +16 -0
- package/dist/types/image-render/widget-image-readiness.d.ts +9 -0
- package/dist/types/image-render/widget-image-render.types.d.ts +47 -0
- package/dist/types/kit/ComposedViewConversationWidget.d.ts +14 -0
- package/dist/types/kit/ComposedViewDataSourceLoader.d.ts +20 -0
- package/dist/types/kit/ComposedViewRenderer.d.ts +30 -0
- package/dist/types/kit/ComposedViewSlotErrorBoundary.d.ts +23 -0
- package/dist/types/kit/ModelText/ModelText.d.ts +12 -0
- package/dist/types/kit/components/embedding/EmbeddedConversationWidget.d.ts +26 -0
- package/dist/types/kit/components/map/map-full-screen-instance.d.ts +26 -0
- package/dist/types/kit/components/map/map-presentation-context.d.ts +8 -0
- package/dist/types/kit/components/text/shared/text-node-values.d.ts +39 -0
- package/dist/types/kit/composed-view-component-types.d.ts +61 -0
- package/dist/types/kit/composed-view-components.d.ts +7 -0
- package/dist/types/kit/composed-view-tones.d.ts +20 -0
- package/dist/types/kit/entity-detail/EntityDetailCanvasBody.d.ts +9 -0
- package/dist/types/kit/entity-detail/entity-detail-bodies.d.ts +32 -0
- package/dist/types/kit/entity-detail/entity-detail-name.d.ts +9 -0
- package/dist/types/kit/hooks/use-debounced-value.d.ts +2 -0
- package/dist/types/kit/map-full-screen/MapFullScreenCanvasBody.d.ts +11 -0
- package/dist/types/preview/WidgetPreviewHost.d.ts +20 -0
- package/dist/types/preview/preview-stub-components.d.ts +3 -0
- package/dist/types/preview/widget-preview-fixtures.d.ts +17 -0
- package/dist/types/preview/widget-preview-hydration.d.ts +10 -0
- package/dist/types/preview/widget-preview-readiness.d.ts +27 -0
- package/dist/types/preview/widget-preview-requests.d.ts +16 -0
- package/dist/types/preview/widget-preview-signal.d.ts +10 -0
- package/dist/types/preview/widget-preview.types.d.ts +134 -0
- package/dist/types/provider/AgentsProvider.d.ts +33 -0
- package/dist/types/provider/class-names.d.ts +7 -0
- package/dist/types/provider/components/default-components.d.ts +3 -0
- package/dist/types/provider/components/icon-names.d.ts +9 -0
- package/dist/types/provider/components/index.d.ts +39 -0
- package/dist/types/provider/components/types.d.ts +463 -0
- package/dist/types/provider/environment.d.ts +262 -0
- package/dist/types/provider/index.d.ts +4 -0
- package/dist/types/renderer/ConversationDeepLinkedWidget.d.ts +18 -0
- package/dist/types/renderer/ConversationMarkdown.d.ts +21 -0
- package/dist/types/renderer/ConversationWidgetActions/ConversationWidgetActions.d.ts +7 -0
- package/dist/types/renderer/ConversationWidgetCallbacksContext.d.ts +234 -0
- package/dist/types/renderer/ConversationWidgetContext.d.ts +32 -0
- package/dist/types/renderer/ConversationWidgetErrorBoundary.d.ts +25 -0
- package/dist/types/renderer/ConversationWidgetHost.d.ts +36 -0
- package/dist/types/renderer/ConversationWidgetRenderContext.d.ts +3 -0
- package/dist/types/renderer/MarkdownLink.d.ts +6 -0
- package/dist/types/renderer/WindowedWidget/WindowedWidget.d.ts +16 -0
- package/dist/types/renderer/_access/ConversationWidgetFeatureGate.d.ts +21 -0
- package/dist/types/renderer/_agent-space/ConversationWidgetAgentSpaceFrame.d.ts +12 -0
- package/dist/types/renderer/_agent-space/ConversationWidgetAgentSpaceHeader.d.ts +15 -0
- package/dist/types/renderer/_agent-space/agent-space-name.hydrator.d.ts +7 -0
- package/dist/types/renderer/_agent-space/declared-agent-space-key-field-name.d.ts +8 -0
- package/dist/types/renderer/_agent-space/use-resolved-conversation-widget-agent-space-key.d.ts +16 -0
- package/dist/types/renderer/_agent-space/widget-agent-space-key-attribute.d.ts +13 -0
- package/dist/types/renderer/balanced-json-object.d.ts +12 -0
- package/dist/types/renderer/canvas/CanvasRestoreOnMount.d.ts +19 -0
- package/dist/types/renderer/canvas/canvas-behaviours.d.ts +84 -0
- package/dist/types/renderer/canvas/canvas-body-props.d.ts +18 -0
- package/dist/types/renderer/canvas/canvas-feature-flags.d.ts +11 -0
- package/dist/types/renderer/canvas/canvas-reducers.d.ts +46 -0
- package/dist/types/renderer/canvas/canvas-state.d.ts +107 -0
- package/dist/types/renderer/canvas/canvasBodies.d.ts +19 -0
- package/dist/types/renderer/canvas/canvasStorage.d.ts +25 -0
- package/dist/types/renderer/canvas/decide-canvas-open.d.ts +32 -0
- package/dist/types/renderer/canvas/entity-detail-instance.d.ts +27 -0
- package/dist/types/renderer/canvas/find-widget-fences-in-markdown.d.ts +32 -0
- package/dist/types/renderer/canvas/use-anchor-widget-payload.d.ts +8 -0
- package/dist/types/renderer/composer-widget-fence.d.ts +30 -0
- package/dist/types/renderer/conversation-composer-widget.d.ts +13 -0
- package/dist/types/renderer/conversation-widget-props.d.ts +54 -0
- package/dist/types/renderer/conversation-widget-state-partition.d.ts +31 -0
- package/dist/types/renderer/conversationWidgetAstPlugin.d.ts +11 -0
- package/dist/types/renderer/conversationWidgetRegistry.d.ts +74 -0
- package/dist/types/renderer/detect-unrendered-widgets.d.ts +42 -0
- package/dist/types/renderer/markdown-contains-widget.d.ts +13 -0
- package/dist/types/renderer/reference-naked-widget-json.d.ts +1 -0
- package/dist/types/renderer/remarkWidgetFencePlugin.d.ts +22 -0
- package/dist/types/renderer/render-report/widget-render-report-collector.d.ts +57 -0
- package/dist/types/renderer/render-report/widget-render-report.d.ts +29 -0
- package/dist/types/renderer/repair-malformed-widget-fences.d.ts +11 -0
- package/dist/types/renderer/resolve-deep-linkable-widget.d.ts +25 -0
- package/dist/types/renderer/restoreTextDirectivesPlugin.d.ts +12 -0
- package/dist/types/renderer/widget-click-signal-sources.d.ts +15 -0
- package/dist/types/renderer/widget-fence-json.d.ts +16 -0
- package/dist/types/renderer/widget-fence-syntax.d.ts +25 -0
- package/dist/types/renderer/widget-hydration/index.d.ts +8 -0
- package/dist/types/renderer/widget-hydration/section-hydration.d.ts +41 -0
- package/dist/types/renderer/widget-hydration/use-widget-hydration.d.ts +27 -0
- package/dist/types/renderer/widget-hydration/widget-hydration-state-store.d.ts +27 -0
- package/dist/types/renderer/widget-hydration/widget-hydration.reducer.d.ts +39 -0
- package/dist/types/renderer/widget-hydration/widget-hydration.registry.d.ts +7 -0
- package/dist/types/renderer/widget-hydration/widget-hydration.slice.d.ts +8 -0
- package/dist/types/renderer/widget-hydration/widget-hydration.types.d.ts +27 -0
- package/dist/types/renderer/widget-name-resolver.d.ts +22 -0
- package/dist/types/renderer/widget-tree/bounded-json.d.ts +23 -0
- package/dist/types/renderer/widget-tree/composed-node-schema.d.ts +143 -0
- package/dist/types/renderer/widget-tree/composed-view-data-sources.d.ts +41 -0
- package/dist/types/renderer/widget-tree/composed-view-tree.d.ts +111 -0
- package/dist/types/renderer/widget-tree/expression/evaluate-expression.d.ts +65 -0
- package/dist/types/renderer/widget-tree/expression/parse-expression.d.ts +71 -0
- package/dist/types/renderer/widget-tree/resolve-composed-view-values.d.ts +49 -0
- package/dist/types/renderer/widget-tree/use-composed-view-state.d.ts +16 -0
- package/dist/types/renderer/widget-windowing.d.ts +25 -0
- package/dist/types/widgets/CanvasWidgetCard/CanvasWidgetCard.d.ts +79 -0
- package/dist/types/widgets/CanvasWidgetCard/CanvasWidgetSwitch.d.ts +61 -0
- package/dist/types/widgets/CanvasWidgetCard/canvas-for-message-widget.d.ts +8 -0
- package/dist/types/widgets/CanvasWidgetCard/use-canvas-viable.d.ts +15 -0
- package/dist/types/widgets/ClockConversationWidget/ClockConversationWidget.d.ts +11 -0
- package/dist/types/widgets/ClockConversationWidget/ClockWidget/AnalogClockFace.d.ts +12 -0
- package/dist/types/widgets/ClockConversationWidget/ClockWidget/ClockRow.d.ts +23 -0
- package/dist/types/widgets/ClockConversationWidget/ClockWidget/ClockWidget.d.ts +21 -0
- package/dist/types/widgets/ClockConversationWidget/ClockWidget/DayNightGlyph.d.ts +8 -0
- package/dist/types/widgets/ClockConversationWidget/shared/clock-time.d.ts +52 -0
- package/dist/types/widgets/ClockConversationWidget/shared/clock-widget-payload.d.ts +23 -0
- package/dist/types/widgets/ClockConversationWidget/shared/use-clock-settings.d.ts +18 -0
- package/dist/types/widgets/ConceptExplainerConversationWidget/ConceptExplainerConversationWidget.d.ts +14 -0
- package/dist/types/widgets/ConceptExplainerConversationWidget/ConceptExplainerWidget/ConceptExplainerWidget.d.ts +27 -0
- package/dist/types/widgets/ConceptExplainerConversationWidget/shared/ConceptExplainerTextView.d.ts +11 -0
- package/dist/types/widgets/ConceptExplainerConversationWidget/shared/concept-explainer-type.d.ts +89 -0
- package/dist/types/widgets/ConceptExplainerConversationWidget/shared/concept-explainer-types.d.ts +17 -0
- package/dist/types/widgets/ConceptExplainerConversationWidget/shared/concept-explainer-widget-payload.d.ts +25 -0
- package/dist/types/widgets/ConceptExplainerConversationWidget/shared/use-concept-explainer-language.d.ts +8 -0
- package/dist/types/widgets/ConversationSearchResultsConversationWidget/ConversationSearchResultsCanvas.d.ts +9 -0
- package/dist/types/widgets/ConversationSearchResultsConversationWidget/ConversationSearchResultsCanvasBody.d.ts +7 -0
- package/dist/types/widgets/ConversationSearchResultsConversationWidget/ConversationSearchResultsConversationWidget.d.ts +15 -0
- package/dist/types/widgets/ConversationSearchResultsConversationWidget/shared/conversation-search-results-widget-payload.d.ts +42 -0
- package/dist/types/widgets/ConversationSearchResultsConversationWidget/shared/search-hit-excerpt.d.ts +1 -0
- package/dist/types/widgets/CurrencyConverterConversationWidget/CurrencyConverterConversationWidget.d.ts +8 -0
- package/dist/types/widgets/CurrencyConverterConversationWidget/CurrencyConverterWidget/CurrencyConverterWidget.d.ts +17 -0
- package/dist/types/widgets/CurrencyConverterConversationWidget/CurrencyConverterWidget/CurrencyLabel/CurrencyLabel.d.ts +9 -0
- package/dist/types/widgets/CurrencyConverterConversationWidget/shared/currency-converter-widget-payload.d.ts +22 -0
- package/dist/types/widgets/CurrencyConverterConversationWidget/shared/currency-display.d.ts +30 -0
- package/dist/types/widgets/CustomVisualizationConversationWidget/CustomVisualizationConversationWidget.d.ts +11 -0
- package/dist/types/widgets/CustomVisualizationConversationWidget/CustomVisualizationWidget/CustomVisualizationFrame.d.ts +14 -0
- package/dist/types/widgets/CustomVisualizationConversationWidget/CustomVisualizationWidget/CustomVisualizationWidget.d.ts +15 -0
- package/dist/types/widgets/CustomVisualizationConversationWidget/shared/custom-visualization-frame-protocol.d.ts +77 -0
- package/dist/types/widgets/CustomVisualizationConversationWidget/shared/custom-visualization-libraries.d.ts +25 -0
- package/dist/types/widgets/CustomVisualizationConversationWidget/shared/custom-visualization-sandbox-config.d.ts +21 -0
- package/dist/types/widgets/CustomVisualizationConversationWidget/shared/custom-visualization-widget-payload.d.ts +55 -0
- package/dist/types/widgets/CustomVisualizationConversationWidget/shared/read-custom-visualization-theme.d.ts +5 -0
- package/dist/types/widgets/EntityMentionConversationWidget/EntityMentionAskButton/EntityMentionAskButton.d.ts +13 -0
- package/dist/types/widgets/EntityMentionConversationWidget/EntityMentionCard/EntityMentionCard.d.ts +11 -0
- package/dist/types/widgets/EntityMentionConversationWidget/EntityMentionConversationWidget.d.ts +9 -0
- package/dist/types/widgets/EntityMentionConversationWidget/shared/entity-mention-presentation.d.ts +4 -0
- package/dist/types/widgets/EntityMentionConversationWidget/shared/entity-mention.d.ts +33 -0
- package/dist/types/widgets/EntityMentionConversationWidget/shared/use-entity-mention-composer.d.ts +17 -0
- package/dist/types/widgets/MultiChoiceConversationWidget/MultiChoiceConversationWidget.d.ts +2 -0
- package/dist/types/widgets/MultiChoiceConversationWidget/shared/multi-choice-widget-payload.d.ts +16 -0
- package/dist/types/widgets/QuickRepliesConversationWidget/QuickRepliesConversationWidget.d.ts +38 -0
- package/dist/types/widgets/QuickRepliesConversationWidget/shared/quick-replies-widget-payload.d.ts +20 -0
- package/dist/types/widgets/SuggestedActions/SuggestedActions.d.ts +10 -0
- package/dist/types/widgets/ToolTraceConversationWidget/ToolTraceConversationWidget.d.ts +8 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/SourceFavicon.d.ts +10 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchAnswer.d.ts +6 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchReferences.d.ts +12 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchResultsCanvas.d.ts +10 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchResultsCanvasBody.d.ts +7 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchResultsConversationWidget.d.ts +14 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchSourcesList.d.ts +10 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/shared/display-hostname.d.ts +9 -0
- package/dist/types/widgets/WebSearchResultsConversationWidget/shared/web-search-results-widget-payload.d.ts +30 -0
- package/dist/types/widgets/WritingDraftConversationWidget/WritingDraftConversationWidget.d.ts +14 -0
- package/dist/types/widgets/WritingDraftConversationWidget/WritingDraftWidget/WritingDraftBody.d.ts +9 -0
- package/dist/types/widgets/WritingDraftConversationWidget/WritingDraftWidget/WritingDraftWidget.d.ts +44 -0
- package/dist/types/widgets/WritingDraftConversationWidget/shared/draft-mail-link.d.ts +17 -0
- package/dist/types/widgets/WritingDraftConversationWidget/shared/draft-plain-text.d.ts +7 -0
- package/dist/types/widgets/WritingDraftConversationWidget/shared/remark-draft-line-breaks.d.ts +13 -0
- package/dist/types/widgets/WritingDraftConversationWidget/shared/writing-draft-widget-payload.d.ts +23 -0
- package/dist/types/widgets/_shared/ConversationWidgetButton.d.ts +4 -0
- package/dist/types/widgets/_shared/DonePill.d.ts +14 -0
- package/dist/types/widgets/_shared/modern/WidgetKpiValue.d.ts +24 -0
- package/dist/types/widgets/_shared/modern/WidgetListRow.d.ts +14 -0
- package/dist/types/widgets/_shared/modern/WidgetStatusChip.d.ts +8 -0
- package/dist/types/widgets/_shared/modern/WidgetSurface.d.ts +13 -0
- package/dist/types/widgets/_shared/modern/WidgetSurfaceSkeleton.d.ts +11 -0
- package/dist/types/widgets/_shared/modern/index.d.ts +16 -0
- package/dist/types/widgets/_shared/skeleton-primitives.d.ts +20 -0
- package/dist/types/widgets/_shared/use-stack-when-wrapped.d.ts +6 -0
- package/dist/types/widgets/_shared/widget-payload-validation.d.ts +22 -0
- package/dist/widgets.js +84 -0
- package/dist/widgets.js.map +1 -0
- package/package.json +120 -3
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A widget instance living in the chat input BEFORE the message is sent — the composer-side twin of a rendered
|
|
3
|
+
* widget: same wire name, same fields, structured (never raw text) until send assembles the fence
|
|
4
|
+
* (`buildMessageTextWithComposerWidgets`, `composer-widget-fence.ts`).
|
|
5
|
+
*/
|
|
6
|
+
export interface ConversationComposerWidget {
|
|
7
|
+
/** Client-only identity of this composer instance (`crypto.randomUUID()`); never sent. */
|
|
8
|
+
composerWidgetId: string;
|
|
9
|
+
/** The canonical wire name — becomes the fence `type`. */
|
|
10
|
+
widgetName: string;
|
|
11
|
+
/** The fence's non-`type` fields, structured. After the round-trip this is what the widget receives as `payload`. */
|
|
12
|
+
fields: Record<string, unknown>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common props injected into every widget component by ConversationMarkdown.
|
|
3
|
+
*
|
|
4
|
+
* Markdown attributes (the `key='value'` pairs inside `::Name{...}`) are spread as props by react-markdown.
|
|
5
|
+
* ConversationMarkdown additionally injects two flags derived from the host message, answering two
|
|
6
|
+
* separate questions:
|
|
7
|
+
* - `interactive` → the widget's controls may be used (buttons, forms, hydration refresh). True for a message
|
|
8
|
+
* delivered live in this session AND for the newest assistant reply after a reload, so a
|
|
9
|
+
* customer who reloads mid-setup still sees the question's buttons.
|
|
10
|
+
* - `justDelivered` → the message was delivered live in this session, right now. NEVER true after a reload or on
|
|
11
|
+
* history replay. The ONLY gate for one-shot side effects: opening a canvas, creating a draft,
|
|
12
|
+
* generating a campaign, charging budget.
|
|
13
|
+
*
|
|
14
|
+
* `fresh` is kept as a deprecated alias of `interactive` so existing widgets keep working; a widget that opens a
|
|
15
|
+
* canvas or mutates anything on mount must read `justDelivered`.
|
|
16
|
+
*/
|
|
17
|
+
export interface BaseConversationWidgetProps {
|
|
18
|
+
/** @deprecated alias of `interactive` — read `interactive` (controls usable) or `justDelivered` (one-shot side effects). */
|
|
19
|
+
fresh?: boolean;
|
|
20
|
+
/** The widget's controls may be used; see the interface docblock. */
|
|
21
|
+
interactive?: boolean;
|
|
22
|
+
/** The host message was delivered live right now; the only gate for one-shot side effects. */
|
|
23
|
+
justDelivered?: boolean;
|
|
24
|
+
/** Id of the host message (undefined while it streams / for a composer echo). Identifies a canvas opened from it. */
|
|
25
|
+
messageId?: string | number;
|
|
26
|
+
/**
|
|
27
|
+
* The widget was mounted by a PAGE hand-over (`openAgentWithWidget` / `?agentWidget=`), not by a message. A canvas
|
|
28
|
+
* it opens has origin `openedByPage` and a page anchor (the agent space), and never runs creation side effects.
|
|
29
|
+
*/
|
|
30
|
+
openedByPage?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Standard widget shape: a JSON-string payload + the framework-injected `fresh`.
|
|
34
|
+
* Use this for any widget whose markdown carries a single `payload='...'` attribute.
|
|
35
|
+
*/
|
|
36
|
+
export interface PayloadConversationWidgetProps extends BaseConversationWidgetProps {
|
|
37
|
+
payload: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Props injected into a widget's `composerComponent` — the same widget rendered INSIDE the chat input, before send,
|
|
41
|
+
* editable instead of read-only. See `ConversationComposerWidget` and `ConversationWidgetEntry.composerComponent`
|
|
42
|
+
* (`conversationWidgetRegistry.ts`).
|
|
43
|
+
*/
|
|
44
|
+
export interface ComposerConversationWidgetProps {
|
|
45
|
+
/** Client-only identity of this composer instance; stable across `replaceFields` calls. */
|
|
46
|
+
composerWidgetId: string;
|
|
47
|
+
/** The widget's own fields (never includes `type`). */
|
|
48
|
+
fields: Record<string, unknown>;
|
|
49
|
+
/** Replace the fields (e.g. drop one element out of several). */
|
|
50
|
+
replaceFields: (nextFields: Record<string, unknown>) => void;
|
|
51
|
+
/** Remove the whole widget from the composer. */
|
|
52
|
+
remove: () => void;
|
|
53
|
+
testId?: string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AgentsStateAction } from "../provider/environment";
|
|
2
|
+
import type { CanvasCreatedEntity } from "./canvas/canvas-reducers";
|
|
3
|
+
import type { CanvasOpenRequest, CanvasState, LastClosedCanvas } from "./canvas/canvas-state";
|
|
4
|
+
import type { ConversationWidgetTranscriptMessage } from "./ConversationWidgetCallbacksContext";
|
|
5
|
+
/** What the widget provider reads from a partition of an app's own chat state. */
|
|
6
|
+
export interface ConversationWidgetPartitionState {
|
|
7
|
+
canvas: CanvasState | null;
|
|
8
|
+
lastClosedCanvas: LastClosedCanvas | null;
|
|
9
|
+
aiThinking: boolean;
|
|
10
|
+
conversation: {
|
|
11
|
+
runState?: string | null;
|
|
12
|
+
} | null;
|
|
13
|
+
messages: ConversationWidgetTranscriptMessage[] | null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A partition of an app's own chat state in its state store — an app's older chat that is not on the package chat
|
|
17
|
+
* store yet (host application: the AI-Extensions chat's slice partition). The widget provider reads it through the
|
|
18
|
+
* environment's `stateStore` and dispatches the canvas transitions as the partition's actions.
|
|
19
|
+
*/
|
|
20
|
+
export interface ConversationWidgetStatePartition {
|
|
21
|
+
actions: {
|
|
22
|
+
openCanvas: (request: CanvasOpenRequest) => AgentsStateAction;
|
|
23
|
+
closeCanvas: (payload: {
|
|
24
|
+
byCustomer: boolean;
|
|
25
|
+
}) => AgentsStateAction;
|
|
26
|
+
resetCanvasForNewTurn: () => AgentsStateAction;
|
|
27
|
+
clearCanvas: () => AgentsStateAction;
|
|
28
|
+
setCanvasCreatedEntityId: (created: CanvasCreatedEntity) => AgentsStateAction;
|
|
29
|
+
};
|
|
30
|
+
selectState: (state: any) => ConversationWidgetPartitionState;
|
|
31
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps the `::Name` nodes a message carries onto the registered components by rewriting `data.hName` to the CANONICAL
|
|
3
|
+
* registry name — which is what `ConversationMarkdown` keys its component map by.
|
|
4
|
+
*
|
|
5
|
+
* The name on the node is whatever the message contains, so a stored conversation delivers the legacy
|
|
6
|
+
* `::ExampleWidgetDirective{payload='…'}` form (and stored server `component` parts carry `"name":"<Canonical>Directive"`,
|
|
7
|
+
* which `normalize-server-message-to-markdown` turns into exactly that). Resolution therefore goes
|
|
8
|
+
* through `resolveCanonicalWidgetName` — the one legacy rule — never a direct set lookup, or every old message would
|
|
9
|
+
* degrade to the `:name` plain-text fallback.
|
|
10
|
+
*/
|
|
11
|
+
export default function conversationWidgetAstPlugin(): (tree: any) => void;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ConversationWidgetUpsellProps } from "./_access/ConversationWidgetFeatureGate";
|
|
3
|
+
import type { CanvasId } from "./canvas/canvas-behaviours";
|
|
4
|
+
import type { ComposerConversationWidgetProps } from "./conversation-widget-props";
|
|
5
|
+
export interface ConversationWidgetEntry {
|
|
6
|
+
/**
|
|
7
|
+
* The CANONICAL wire name — short, never ending in `Directive` (that suffix is reserved as the legacy marker; see
|
|
8
|
+
* `widget-name-resolver.ts`). Stored messages that carry the old `<Name>Directive` form resolve onto this one.
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
component: React.ComponentType<any>;
|
|
12
|
+
/**
|
|
13
|
+
* The app's requirement name (a feature flag) that gates this widget — opaque to the package, checked by the app's
|
|
14
|
+
* `WidgetFeatureGate`. Omit to render unconditionally (default).
|
|
15
|
+
*/
|
|
16
|
+
featureFlag?: string;
|
|
17
|
+
/**
|
|
18
|
+
* May this widget be mounted by NAME from outside a conversation — the `?agentWidget=<name>` deep-link a page uses to
|
|
19
|
+
* open the chat with this widget's canvas already up, and the restore of a pinned canvas after a reload
|
|
20
|
+
* (`resolve-deep-linkable-widget.ts`). Opt-in per widget because a URL is untrusted input: everything else is mounted
|
|
21
|
+
* only from a message the agent wrote. Default false.
|
|
22
|
+
*/
|
|
23
|
+
deepLinkable?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The canvases (by canvas id, `canvas/canvas-behaviours.ts`) this widget may open. Documentation and the restore's
|
|
26
|
+
* validation: a stored canvas pointer is re-opened only when its anchor message carries a widget that lists the
|
|
27
|
+
* canvas. `_registry-wire-names.spec.ts` asserts every listed id is a declared canvas.
|
|
28
|
+
*/
|
|
29
|
+
opensCanvases?: readonly CanvasId[];
|
|
30
|
+
/** Optional custom upgrade offer for the gated widget; defaults to the app gate's own. */
|
|
31
|
+
upsellTrigger?: React.ComponentType<ConversationWidgetUpsellProps>;
|
|
32
|
+
/**
|
|
33
|
+
* Renders this widget INSIDE the chat input (editable: per-part ✕ etc.). Present = the widget may be composed by
|
|
34
|
+
* the customer (see `ConversationComposerWidget`). An entry declaring this MUST also declare `component` (asserted
|
|
35
|
+
* in `_registry-wire-names.spec.ts`) — the message rendering.
|
|
36
|
+
*/
|
|
37
|
+
composerComponent?: React.ComponentType<ComposerConversationWidgetProps>;
|
|
38
|
+
/**
|
|
39
|
+
* Backspace on an empty input removes the LAST removable part of the last composer widget. Returns the fields
|
|
40
|
+
* without that part, or `null` when nothing is left (the widget is then removed entirely). Omitted → Backspace
|
|
41
|
+
* removes the whole widget.
|
|
42
|
+
*/
|
|
43
|
+
removeLastPartFromComposerWidgetFields?: (fields: Record<string, unknown>) => Record<string, unknown> | null;
|
|
44
|
+
}
|
|
45
|
+
/** The entries of a set of registration modules (`*.widget-registration.ts` files an app or the package globbed). */
|
|
46
|
+
export declare const readConversationWidgetRegistrations: (registrationModules: Record<string, {
|
|
47
|
+
conversationWidgetRegistration?: ConversationWidgetEntry;
|
|
48
|
+
}>) => ConversationWidgetEntry[];
|
|
49
|
+
/** The package's own widgets registered by file. */
|
|
50
|
+
export declare const readFolderRegisteredConversationWidgets: () => ConversationWidgetEntry[];
|
|
51
|
+
/** Throws on a wire name registered twice — the written list and the registration files together. */
|
|
52
|
+
export declare const assertUniqueConversationWidgetNames: (widgets: readonly ConversationWidgetEntry[]) => void;
|
|
53
|
+
/** The package's own widgets: the written entries and every package widget registered by file. */
|
|
54
|
+
export declare const packageConversationWidgets: readonly ConversationWidgetEntry[];
|
|
55
|
+
/**
|
|
56
|
+
* ONE list — every registered widget, in no particular order. There are no kinds of widget here: inline vs canvas vs
|
|
57
|
+
* mount-time is the component's own choice, not a registry bucket. A widget that opens a canvas lists the canvas ids
|
|
58
|
+
* (`opensCanvases`); the canvas's behaviour lives in `canvas/canvas-behaviours.ts`, its body in `canvas/canvasBodies.tsx`.
|
|
59
|
+
* It starts with the package's own widgets; an app adds its widgets with `registerConversationWidgets` before the
|
|
60
|
+
* first render (outside React). The array is filled in place, so a reader that holds it sees every registration.
|
|
61
|
+
*/
|
|
62
|
+
export declare const conversationWidgetRegistry: {
|
|
63
|
+
widgets: ConversationWidgetEntry[];
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Counts the registrations: a reader that caches something derived from the registry (a name set, a component map)
|
|
67
|
+
* rebuilds it when the revision moved.
|
|
68
|
+
*/
|
|
69
|
+
export declare const getConversationWidgetRegistryRevision: () => number;
|
|
70
|
+
/**
|
|
71
|
+
* Adds an app's widgets to the registry. Runs outside React, before the first render; throws when a wire name is
|
|
72
|
+
* registered twice (with the package's own or an earlier registration).
|
|
73
|
+
*/
|
|
74
|
+
export declare const registerConversationWidgets: (widgets: readonly ConversationWidgetEntry[]) => void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The signal provenance for the widget-render-failure corrective signal — distinct from a widget CLICK. Mirrors the
|
|
3
|
+
* backend {@link AIConversationMessage::SIGNAL_SOURCE_FRONTEND_WIDGET_INVALID}; the admin inspector shows it as the
|
|
4
|
+
* signal source and the agent loop treats it as model-visible feedback.
|
|
5
|
+
*/
|
|
6
|
+
export declare const WIDGET_INVALID_SIGNAL_SOURCE = "FRONTEND_WIDGET_INVALID";
|
|
7
|
+
export interface UnrenderedWidget {
|
|
8
|
+
/** The `type` the model wrote. */
|
|
9
|
+
type: string;
|
|
10
|
+
/**
|
|
11
|
+
* What went wrong:
|
|
12
|
+
* - `unknownType`: a widget block (fenced or bare `widget { … }` line) whose type is not a registered widget →
|
|
13
|
+
* dropped, the customer sees NOTHING.
|
|
14
|
+
* - `missingFence`: widget JSON emitted as PLAIN TEXT (no ```widget fence, no `widget` prefix) → the customer sees
|
|
15
|
+
* raw JSON prose.
|
|
16
|
+
*/
|
|
17
|
+
kind: "unknownType" | "missingFence";
|
|
18
|
+
/** The closest valid widget names (deterministic similarity) for a "did you mean" — may be empty. */
|
|
19
|
+
suggestions: string[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Find widget-emission failures in an assistant message — the cases where the customer does NOT get the intended
|
|
23
|
+
* widget. Uses the SAME resolveWidgetName as the render plugin, so "valid" means exactly "would have rendered".
|
|
24
|
+
* Three scan surfaces, two failure classes:
|
|
25
|
+
*
|
|
26
|
+
* 1. `unknownType` — a ```widget fence OR a bare `widget { … }` line (both forms remarkWidgetFencePlugin renders)
|
|
27
|
+
* whose `type` is not a registered widget: the plugin silently DROPS it, the customer sees nothing and the model
|
|
28
|
+
* gets no feedback (a model wrote `type: "example"` instead of `ExampleWidget`). A malformed-JSON
|
|
29
|
+
* block is skipped (the plugin drops it too).
|
|
30
|
+
* 2. `missingFence` — widget JSON emitted as PLAIN prose (no fence, no `widget` prefix): nothing intercepts it, so
|
|
31
|
+
* the customer sees raw JSON text (found live: `{ "type": "ExampleWidget", … }` as a paragraph of the final answer).
|
|
32
|
+
* Reported when the naked JSON's `type` resolves to a VALID widget (the model clearly meant a widget) or is CLOSE
|
|
33
|
+
* to one (similarity shortlist non-empty) — arbitrary JSON without a widget-like `type` is never flagged (no false
|
|
34
|
+
* positives on legitimate JSON content).
|
|
35
|
+
*/
|
|
36
|
+
export declare const detectUnrenderedWidgets: (messageText: string) => UnrenderedWidget[];
|
|
37
|
+
/**
|
|
38
|
+
* The user-INVISIBLE corrective SIGNAL text for one or more widget-emission failures — tells the model exactly what
|
|
39
|
+
* the customer experienced (nothing rendered / raw JSON prose) and how to fix it. Kept terse; the model already holds
|
|
40
|
+
* the full widget catalog in its instructions.
|
|
41
|
+
*/
|
|
42
|
+
export declare const buildUnrenderedWidgetSignal: (widgets: UnrenderedWidget[]) => string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* True when the markdown contains at least one widget — either a `::Name` / `:::Name` node OR a closed ```widget
|
|
3
|
+
* fence whose `type` resolves to a registered widget. BOTH forms go through `resolveCanonicalWidgetName`, so a stored
|
|
4
|
+
* message written as `::ExampleWidgetDirective{…}` or `{"type":"ExampleWidgetDirective"}` counts exactly like the
|
|
5
|
+
* canonical `::ExampleWidget` — the drawer resets for old conversations too.
|
|
6
|
+
*/
|
|
7
|
+
export declare const markdownContainsWidget: (markdown: string) => boolean;
|
|
8
|
+
/**
|
|
9
|
+
* The CANONICAL names of every registered widget the markdown carries, in order of appearance, one entry per
|
|
10
|
+
* occurrence (both syntaxes, legacy `…Directive` spellings resolved). The message list reads it to tell a superseded
|
|
11
|
+
* widget from the live one: a later message carrying a widget of the SAME name retires the earlier one's controls.
|
|
12
|
+
*/
|
|
13
|
+
export declare const widgetNamesInMarkdown: (markdown: string) => string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const referenceNakedWidgetJson: (text: string) => string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render a widget the agent emitted in either form:
|
|
3
|
+
*
|
|
4
|
+
* 1. a ```widget fenced code block (the base-prompt convention):
|
|
5
|
+
* ```widget
|
|
6
|
+
* { "type": "<WidgetName>", ...fields }
|
|
7
|
+
* ```
|
|
8
|
+
* 2. a bare `widget { "type": "<WidgetName>", ...fields }` line (no fence) — the same intent when the model
|
|
9
|
+
* drops the backticks, which happens in practice. Markdown parses this as a plain `paragraph`, so it never
|
|
10
|
+
* reached the fence path and leaked as raw JSON to the customer (the block shown verbatim).
|
|
11
|
+
*
|
|
12
|
+
* Both are rewritten into the SAME `leafDirective` node that `::WidgetName{payload='…'}` produces, so the existing
|
|
13
|
+
* pipeline (conversationWidgetAstPlugin → ConversationWidgetHost → feature-gate → hydration) renders it unchanged —
|
|
14
|
+
* the non-`type` fields become the node's `payload` (a JSON string), exactly what the widgets parse.
|
|
15
|
+
*
|
|
16
|
+
* MUST run BEFORE conversationWidgetAstPlugin. The `type` is resolved through the ONE legacy rule
|
|
17
|
+
* (`resolveWidgetName`): the canonical `ExampleWidget` matches exactly, the legacy `ExampleWidgetDirective` resolves
|
|
18
|
+
* onto it. A block whose JSON decodes only without surplus trailing `}` / `]` renders like the backend reads it
|
|
19
|
+
* (`widget-fence-json.ts`). A malformed JSON block or an unknown widget name is dropped (renders nothing) — the kill switch; never leak
|
|
20
|
+
* raw JSON or a `:name` fallback to the user.
|
|
21
|
+
*/
|
|
22
|
+
export default function remarkWidgetFencePlugin(): (tree: any) => void;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { WidgetRenderReporter, WidgetRenderReportEntry } from "./widget-render-report";
|
|
2
|
+
/**
|
|
3
|
+
* The render reports of the widget blocks of live messages, collected per message. The chat host
|
|
4
|
+
* (`AgentChat`) owns one collector and hands it down; `ConversationWidgetHost` registers every block of a JUST-DELIVERED
|
|
5
|
+
* message (never a replayed one) and gives the widget a reporter for it. A block that reports nothing counts as
|
|
6
|
+
* `mounted`. Once a message's blocks have settled — none `pending` for `settleMs`, or `maxWaitMs` after the first block
|
|
7
|
+
* at the latest — the collector calls `onSettled` ONCE for that message with its blocks in document order; the host
|
|
8
|
+
* sends the signal only when a block is not `mounted` or rendered with a note (a `mounted` entry with a code: figures
|
|
9
|
+
* without a source), so a clean render costs nothing.
|
|
10
|
+
*/
|
|
11
|
+
export interface WidgetRenderBlockReport {
|
|
12
|
+
widgetName: string;
|
|
13
|
+
/** The block's offset in the message's markdown — document order, and the block's identity in the message. */
|
|
14
|
+
sourceOffset: number;
|
|
15
|
+
entry: WidgetRenderReportEntry;
|
|
16
|
+
}
|
|
17
|
+
export interface WidgetRenderReportCollector {
|
|
18
|
+
/** Counts one block of one live message as `mounted` unless it already reported (a child reports before its host mounts). */
|
|
19
|
+
registerBlock: (messageId: string | number, widgetName: string, sourceOffset: number) => void;
|
|
20
|
+
/** The reporter of one block of one live message. */
|
|
21
|
+
reporterForBlock: (messageId: string | number, widgetName: string, sourceOffset: number) => WidgetRenderReporter;
|
|
22
|
+
/** Forget every pending timer (the host unmounts or the conversation switches). */
|
|
23
|
+
dispose: () => void;
|
|
24
|
+
}
|
|
25
|
+
export interface WidgetRenderReportCollectorOptions {
|
|
26
|
+
onSettled: (messageId: string, blocks: WidgetRenderBlockReport[]) => void;
|
|
27
|
+
settleMs?: number;
|
|
28
|
+
maxWaitMs?: number;
|
|
29
|
+
}
|
|
30
|
+
export declare const createWidgetRenderReportCollector: (options: WidgetRenderReportCollectorOptions) => WidgetRenderReportCollector;
|
|
31
|
+
/** The collector of the chat the widget lives in; absent = nobody listens (another host, a story, the e-mail capture). */
|
|
32
|
+
export declare const WidgetRenderReportCollectorContext: import("react").Context<WidgetRenderReportCollector | null>;
|
|
33
|
+
/** The stored prefix of a render-report signal — the inspector and the tests read it; never reworded. */
|
|
34
|
+
export declare const WIDGET_RENDER_REPORT_SIGNAL_PREFIX = "Widget render report for message";
|
|
35
|
+
/** The signal source (backend `AIConversationSignalSource::FRONTEND_WIDGET_RENDER_REPORT`). */
|
|
36
|
+
export declare const WIDGET_RENDER_REPORT_SIGNAL_SOURCE = "FRONTEND_WIDGET_RENDER_REPORT";
|
|
37
|
+
/**
|
|
38
|
+
* The model-visible signal for a settled message — null when every block mounted cleanly (nothing to tell). One line
|
|
39
|
+
* per block that is not `mounted`, or that mounted with a note (a code: `INLINE_VALUE_WITHOUT_SOURCE`): its position
|
|
40
|
+
* among the message's widgets, its name and its occurrence among widgets of that name, its status and code, the
|
|
41
|
+
* detail. The closing sentence asks for the honest answer about a block the owner did not see, and for
|
|
42
|
+
* a note that the next widget fixes it.
|
|
43
|
+
*/
|
|
44
|
+
export declare const buildWidgetRenderReportSignal: (messageId: string, blocks: WidgetRenderBlockReport[]) => string | null;
|
|
45
|
+
export interface ParsedWidgetRenderReport {
|
|
46
|
+
messageId: string;
|
|
47
|
+
blocks: Array<{
|
|
48
|
+
position: number;
|
|
49
|
+
widgetName: string;
|
|
50
|
+
occurrence: number;
|
|
51
|
+
status: string;
|
|
52
|
+
code: string | null;
|
|
53
|
+
detail: string | null;
|
|
54
|
+
}>;
|
|
55
|
+
}
|
|
56
|
+
/** The report a stored signal text carries, or null for another text — the admin inspector's reader. */
|
|
57
|
+
export declare const parseWidgetRenderReportSignal: (signalText: string) => ParsedWidgetRenderReport | null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The render report of one widget block: after mount every block says whether it showed what it should —
|
|
3
|
+
* `mounted`, `empty` (hydrated, nothing to show), `failed` (error boundary, hydration error, invalid tree) or `pending`
|
|
4
|
+
* (still waiting for data; never a final answer). The chat host collects the statuses per message and tells the model
|
|
5
|
+
* about the blocks that are not `mounted` (the `FRONTEND_WIDGET_RENDER_REPORT` signal). A widget reports
|
|
6
|
+
* through {@link useReportWidgetRenderStatus}; a widget that reports nothing counts as `mounted` once it rendered
|
|
7
|
+
* without throwing.
|
|
8
|
+
*/
|
|
9
|
+
export type WidgetRenderStatus = "mounted" | "empty" | "failed" | "pending";
|
|
10
|
+
/**
|
|
11
|
+
* Why a block is not `mounted`. The tree codes are the backend's (`ComposedViewValidationFinding`); the runtime codes
|
|
12
|
+
* name what went wrong in the browser.
|
|
13
|
+
*/
|
|
14
|
+
export type WidgetRenderReportCode = "INVALID_NODE" | "INVALID_PROP" | "UNKNOWN_BINDING" | "INVALID_EXPRESSION" | "INVALID_STATE" | "INVALID_ACTION" | "BUDGET_EXCEEDED" | "INLINE_VALUE_WITHOUT_SOURCE" | "INVALID_INITIAL_CHOICE" | "UNREAD_STATE" | "UNKNOWN_ITEM_KEY" | "INVALID_SLOT_NODE_COUNT" | "WIDGET_LIFTED" | "UNRESOLVED_BINDING" | "UNRESOLVED_REF" | "HYDRATION_FAILED" | "RENDER_FAILED" | "NO_DATA";
|
|
15
|
+
export interface WidgetRenderReportEntry {
|
|
16
|
+
status: WidgetRenderStatus;
|
|
17
|
+
code?: WidgetRenderReportCode;
|
|
18
|
+
/** One short English sentence for the model (what was dropped / what failed); never customer data beyond names. */
|
|
19
|
+
detail?: string;
|
|
20
|
+
}
|
|
21
|
+
/** What a block reports into — provided by the chat host per block; absent = nobody listens (a story, a test). */
|
|
22
|
+
export interface WidgetRenderReporter {
|
|
23
|
+
report: (entry: WidgetRenderReportEntry) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const WidgetRenderReportContext: import("react").Context<WidgetRenderReporter | null>;
|
|
26
|
+
/** Reports the block's status whenever it changes; a no-op without a reporter. */
|
|
27
|
+
export declare const useReportWidgetRenderStatus: (status: WidgetRenderStatus, code?: WidgetRenderReportCode, detail?: string) => void;
|
|
28
|
+
/** The reporter itself, for a widget that reports from an event (a failed action) rather than from a render. */
|
|
29
|
+
export declare const useWidgetRenderReporter: () => WidgetRenderReporter | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `[start, end)` ranges of every REAL fenced code block in `text` — ``` or ~~~, CommonMark's own rules (up to
|
|
3
|
+
* 3 spaces of indent, a closer using the same character with a run at least as long as the opener's, a backtick
|
|
4
|
+
* opener's info string never containing a backtick). An unclosed opener runs to end-of-text. The GENERAL-PURPOSE
|
|
5
|
+
* counterpart of this file's widget-fence-only scanning, built on the same {@link readLine} line walk — used by
|
|
6
|
+
* `referenceNakedWidgetJson` to skip content genuinely inside a fence: a `~~~widget` fence (no tilde support
|
|
7
|
+
* existed before), and content that follows a line which LOOKS like a backtick fence opener but isn't one per the
|
|
8
|
+
* info-string rule above (that line never opens anything, so it can no longer swallow the real fence after it).
|
|
9
|
+
*/
|
|
10
|
+
export declare const findFencedBlockRanges: (text: string) => Array<[number, number]>;
|
|
11
|
+
export declare const repairMalformedWidgetFences: (text: string) => string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CanvasId } from "./canvas/canvas-behaviours";
|
|
2
|
+
import { ConversationWidgetEntry } from "./conversationWidgetRegistry";
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the widget a `?agentWidget=<name>` deep-link (or a restored pinned canvas) may mount, by its CANONICAL
|
|
5
|
+
* registry wire name.
|
|
6
|
+
*
|
|
7
|
+
* A URL is untrusted input, so this is an allow-list rather than a registry lookup: only an entry that declares
|
|
8
|
+
* `deepLinkable: true` can be opened this way. Every other widget is emitted by the agent inside a message, where the
|
|
9
|
+
* conversation itself is the authorisation — a link must not be able to mount an arbitrary widget (some carry
|
|
10
|
+
* mount-time side effects) just because its name was typed into the address bar.
|
|
11
|
+
*
|
|
12
|
+
* Returns the entry (the caller renders its `component`, applying the feature gate the entry declares) or null when the
|
|
13
|
+
* name is empty, unknown, or not deep-linkable.
|
|
14
|
+
*/
|
|
15
|
+
export declare const resolveDeepLinkableWidget: (widgetName?: string | null) => ConversationWidgetEntry | null;
|
|
16
|
+
/**
|
|
17
|
+
* The reverse direction: which deep-linkable widget re-opens THIS canvas. The open canvas of the agent chat is
|
|
18
|
+
* mirrored into `?agentWidget=` (AgentTrigger) so a reload brings the customer back to the surface they were working
|
|
19
|
+
* on — an editor a cold chat opened has no conversation id yet, so the canvas model's own pointer storage
|
|
20
|
+
* has nothing to restore from.
|
|
21
|
+
*
|
|
22
|
+
* Null for every canvas no deep-linkable widget declares: it is the agent's to open inside a message, and a URL must
|
|
23
|
+
* not be able to mount it (the allow-list above).
|
|
24
|
+
*/
|
|
25
|
+
export declare const deepLinkableWidgetNameForCanvas: (canvasId: CanvasId | null | undefined) => string | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* remark-directive parses EVERY `:name` run as a text directive — including the `:00` / `:30` inside a time such as
|
|
3
|
+
* `08:00–16:30` (digits are valid directive names). Text directives are not part of our widget vocabulary (widgets
|
|
4
|
+
* travel as leaf directives only, see `conversationWidgetAstPlugin`), so a text directive is always prose that the
|
|
5
|
+
* parser misread: without this pass the customer chat rendered "Montag: 08:00–16:30" as "08" / "–16" (the `:00`
|
|
6
|
+
* and `:30` swallowed, the unknown nodes rendered as breaks) while the admin inspector, which does not load
|
|
7
|
+
* remark-directive, showed the line intact.
|
|
8
|
+
*
|
|
9
|
+
* Restores every text directive to the exact source slice it was parsed from, merging it into the neighbouring text
|
|
10
|
+
* nodes so the paragraph reads as one run again.
|
|
11
|
+
*/
|
|
12
|
+
export default function restoreTextDirectivesPlugin(): (tree: any, file: any) => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `signalSource`s a widget CLICK posts into the conversation (`injectSignal`): the generic widget click and the
|
|
3
|
+
* dedicated source the former owner-action consent widget sent (no component posts it any more; stored rows keep it),
|
|
4
|
+
* plus the further sources an app's own widgets post (`AgentsEnvironment.furtherWidgetClickSignalSources`, e.g. a form
|
|
5
|
+
* submit that starts its own owner turn). The message list reads them to tell an answered widget from an open one after
|
|
6
|
+
* a reload — a widget the owner already clicked must never come back interactive (a consent widget re-armed is a second
|
|
7
|
+
* confirmation for a destructive tool). Add a source here when a widget of the package starts posting a new one.
|
|
8
|
+
*/
|
|
9
|
+
export declare const FRONTEND_WIDGET_CLICK_SIGNAL_SOURCE = "FRONTEND_WIDGET_CLICK";
|
|
10
|
+
export declare const OWNER_ACTION_CONFIRM_SIGNAL_SOURCE = "OWNER_ACTION_CONFIRM";
|
|
11
|
+
/** The package's own widget click sources (the backend's sources of the package that carry an owner statement). */
|
|
12
|
+
export declare const PACKAGE_WIDGET_CLICK_SIGNAL_SOURCES: readonly string[];
|
|
13
|
+
/** Every widget click source: the package's own and the app's further ones. */
|
|
14
|
+
export declare const getWidgetClickSignalSources: () => readonly string[];
|
|
15
|
+
export declare const isWidgetClickSignalSource: (signalSource: string | undefined | null) => boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The JSON of a widget block as every frontend reader decodes it — the twin of the backend's
|
|
3
|
+
* `WidgetBlocks::buildWidgetJsonWithoutSurplusClosers()`: a block whose JSON does not decode is read
|
|
4
|
+
* once more without the surplus closing brackets a model wrote at its end (one `}` too many after a correct tree), up to
|
|
5
|
+
* {@link MAX_SURPLUS_CLOSERS} trailing `}` / `]` dropped one by one. The parity fixture `composed-view-parity.json`
|
|
6
|
+
* (`surplusCloserCases`) holds both readers equal.
|
|
7
|
+
*/
|
|
8
|
+
/** The most trailing `}` / `]` a block read drops to decode a block (the backend's `WidgetBlocks::MAX_SURPLUS_CLOSERS`). */
|
|
9
|
+
export declare const MAX_SURPLUS_CLOSERS = 3;
|
|
10
|
+
/**
|
|
11
|
+
* The block JSON without its surplus trailing closers, or null when it decodes as written or when no shortened text
|
|
12
|
+
* decodes to a JSON object — exactly the backend's answer.
|
|
13
|
+
*/
|
|
14
|
+
export declare const readWidgetJsonWithoutSurplusClosers: (widgetJson: string) => string | null;
|
|
15
|
+
/** The block's JSON object — as written, or without its surplus trailing closers; undefined for a malformed block. */
|
|
16
|
+
export declare const parseWidgetJsonObject: (widgetJson: string) => Record<string, unknown> | undefined;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WIRE SYNTAX — the ```widget fence and bare `widget { … }` forms, as import-free constants.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately a leaf module (no imports): `widget-name-resolver.ts` reads the registry at module scope, and the
|
|
5
|
+
* registry pulls in every widget → AgentChat → the unrendered-widget detector, which builds a RegExp from
|
|
6
|
+
* WIDGET_FENCE_LANG at ITS module scope. When a story loads a widget before anything has evaluated the resolver, that
|
|
7
|
+
* chain reaches the detector while the resolver is still in its temporal dead zone ("Cannot access 'WIDGET_FENCE_LANG'
|
|
8
|
+
* before initialization"). Keeping the syntax here, outside the registry cycle, makes evaluation order irrelevant.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* The ```widget fence's info-string language — the ONE definition every fence regex in the pipeline (the render
|
|
12
|
+
* plugin's `node.lang` check, the malformed-fence repairer, the drawer-reset scan, the unrendered-widget detector)
|
|
13
|
+
* is built from, so "``` widget" (a space before the lang — remark accepts it, the model sometimes writes it) is
|
|
14
|
+
* recognized identically everywhere.
|
|
15
|
+
*/
|
|
16
|
+
export declare const WIDGET_FENCE_LANG = "widget";
|
|
17
|
+
/**
|
|
18
|
+
* A bare `widget { …json… }` line (no ```widget fence) that IS the whole paragraph — the fallback form the model
|
|
19
|
+
* emits when it drops the backticks. Capture group 1 is the JSON object. Anchored to the whole paragraph text so a
|
|
20
|
+
* prose mention ("the widget shows…") never matches. Shared by the render plugin (rewrites it) so there is one
|
|
21
|
+
* definition of the bare form. The detector uses {@link BARE_WIDGET_LINE_GLOBAL} to scan a raw message the same way.
|
|
22
|
+
*/
|
|
23
|
+
export declare const BARE_WIDGET_PARAGRAPH: RegExp;
|
|
24
|
+
/** The bare `widget { … }` form scanned line-by-line across a raw message string (detector side of {@link BARE_WIDGET_PARAGRAPH}). */
|
|
25
|
+
export declare const BARE_WIDGET_LINE_GLOBAL: RegExp;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { WidgetHydrationReducer, WidgetHydrationSlice, useWidgetMemory } from "./widget-hydration.slice";
|
|
2
|
+
export { AgentsWidgetHydrationStateContainer, createAgentsWidgetHydrationStateStore, getDefaultAgentsStateStore, type AgentsWidgetHydrationState, } from "./widget-hydration-state-store";
|
|
3
|
+
export { registerWidgetHydrator, getWidgetHydrator, hasWidgetHydrator } from "./widget-hydration.registry";
|
|
4
|
+
export { useWidgetHydration } from "./use-widget-hydration";
|
|
5
|
+
export type { WidgetHydrator, WidgetHydratorContext, WidgetHydratorOptions, WidgetHydrationStatus, WidgetMemory, WidgetHydrationSliceState, } from "./widget-hydration.types";
|
|
6
|
+
export type { UseWidgetHydrationResult, UseWidgetHydrationOptions } from "./use-widget-hydration";
|
|
7
|
+
export { pickSection, isSectionLoading, mergeSection, mergeSectionValues, isSectionIncomplete, sectionCoversKeys, } from "./section-hydration";
|
|
8
|
+
export type { SectionHydrationResult, SectionHydrator } from "./section-hydration";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface SectionHydrationResult<T> {
|
|
2
|
+
data: T | null;
|
|
3
|
+
isLoading: boolean;
|
|
4
|
+
error?: string | null;
|
|
5
|
+
}
|
|
6
|
+
export type SectionHydrator<T> = () => SectionHydrationResult<T>;
|
|
7
|
+
/**
|
|
8
|
+
* Prefer payload-provided value; fall back to a hydrator result; undefined otherwise.
|
|
9
|
+
* Callers should call the fallback hook unconditionally (React hook rules) and pass
|
|
10
|
+
* its result here.
|
|
11
|
+
*/
|
|
12
|
+
export declare const pickSection: <T>(payloadValue: T | undefined, fallback: SectionHydrationResult<T>) => T | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* True when payload is missing the value AND the fallback is still loading.
|
|
15
|
+
*/
|
|
16
|
+
export declare const isSectionLoading: <T>(payloadValue: T | undefined, fallback: SectionHydrationResult<T>) => boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Field-level merge of two section values. Payload fields (when defined) win
|
|
19
|
+
* over hydrated fields; undefined payload fields are filled from the hydrated
|
|
20
|
+
* value. Use when the agent sends partial section data (e.g. only a CTA) and
|
|
21
|
+
* the client hydrates the remaining fields.
|
|
22
|
+
*/
|
|
23
|
+
export declare const mergeSectionValues: <T extends object>(payloadValue: T | undefined, hydratedValue: T | undefined) => T | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Field-level merge for object sections. Payload fields (when defined) win over
|
|
26
|
+
* fallback fields. Undefined payload fields are filled from the fallback. Use
|
|
27
|
+
* this when the agent sends partial section data (e.g. only a CTA) and the
|
|
28
|
+
* client needs to hydrate the remaining fields from app state.
|
|
29
|
+
*/
|
|
30
|
+
export declare const mergeSection: <T extends object>(payloadValue: T | undefined, fallback: SectionHydrationResult<T>) => T | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* True when the payload provides every field in `requiredKeys` — the section
|
|
33
|
+
* can render straight from the agent payload without waiting for hydration.
|
|
34
|
+
*/
|
|
35
|
+
export declare const sectionCoversKeys: <T extends object>(payloadValue: T | undefined, requiredKeys: ReadonlyArray<keyof T>) => boolean;
|
|
36
|
+
/**
|
|
37
|
+
* True when the fallback is still loading AND the payload has not provided
|
|
38
|
+
* every expected field (listed in `requiredKeys`). Use together with
|
|
39
|
+
* `mergeSection` to decide whether to show a skeleton for the section.
|
|
40
|
+
*/
|
|
41
|
+
export declare const isSectionIncomplete: <T extends object>(payloadValue: T | undefined, fallback: SectionHydrationResult<T>, requiredKeys: ReadonlyArray<keyof T>) => boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { WidgetHydrationStatus } from "./widget-hydration.types";
|
|
2
|
+
export interface UseWidgetHydrationResult<TData> {
|
|
3
|
+
data: TData | null;
|
|
4
|
+
status: WidgetHydrationStatus;
|
|
5
|
+
isLoading: boolean;
|
|
6
|
+
isError: boolean;
|
|
7
|
+
error: string | null;
|
|
8
|
+
/** Generation of the request the memory last started or settled (0 = none): newer results carry a higher id. */
|
|
9
|
+
requestId: number;
|
|
10
|
+
refetch: () => void;
|
|
11
|
+
}
|
|
12
|
+
export interface UseWidgetHydrationOptions {
|
|
13
|
+
/**
|
|
14
|
+
* When true, force a fetch on the first render of this instance even if
|
|
15
|
+
* memory holds a successful result for the same key. Used to honor the
|
|
16
|
+
* `fresh` widget prop (streamed agent message → refetch; history
|
|
17
|
+
* replay → reuse cache).
|
|
18
|
+
*/
|
|
19
|
+
forceRefresh?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Keep rendering the last loaded data for this key while a fetch runs, instead of the loading state. The fetch still
|
|
22
|
+
* runs (and its result replaces the data); only a key with no data yet shows loading. For a snapshot whose copy may
|
|
23
|
+
* already be on screen elsewhere — another agent window opening the same briefing.
|
|
24
|
+
*/
|
|
25
|
+
showLastDataWhileRefreshing?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare const useWidgetHydration: <TData = unknown, TPayload = unknown>(type: string, payload: TPayload, options?: UseWidgetHydrationOptions) => UseWidgetHydrationResult<TData>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AgentsStateAction, AgentsStateStore } from "../../provider/environment";
|
|
2
|
+
import type { WidgetHydrationSliceState } from "./widget-hydration.types";
|
|
3
|
+
/** The state of the package's default store: the widget hydration state under the key package code reads. */
|
|
4
|
+
export interface AgentsWidgetHydrationState {
|
|
5
|
+
AIExtensionsWidgetHydration: WidgetHydrationSliceState;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The package's own state store (widget hydration is one store per app): the widget hydration reducer
|
|
9
|
+
* behind `useSyncExternalStore`, no Redux. Package code reads and dispatches through it whenever the app supplies no
|
|
10
|
+
* `AgentsEnvironment.stateStore` (the host application supplies its Redux store, which mounts the same reducer). Actions the
|
|
11
|
+
* reducer does not know (the app's "a chat surface is open" action) change nothing.
|
|
12
|
+
*/
|
|
13
|
+
export declare class AgentsWidgetHydrationStateContainer implements AgentsStateStore {
|
|
14
|
+
protected state: AgentsWidgetHydrationState;
|
|
15
|
+
protected readonly listeners: Set<() => void>;
|
|
16
|
+
getState: () => AgentsWidgetHydrationState;
|
|
17
|
+
subscribe: (listener: () => void) => (() => void);
|
|
18
|
+
dispatch: (action: AgentsStateAction) => AgentsStateAction;
|
|
19
|
+
/** `AgentsStateStore.useSelector`: one value of the state, re-rendering when it changes. */
|
|
20
|
+
useSelector: <Selected>(selector: (state: AgentsWidgetHydrationState) => Selected) => Selected;
|
|
21
|
+
/** `AgentsStateStore.useDispatch`. */
|
|
22
|
+
useDispatch: () => ((action: AgentsStateAction) => AgentsStateAction);
|
|
23
|
+
}
|
|
24
|
+
/** A new widget hydration store (a test, a second app on one page). */
|
|
25
|
+
export declare const createAgentsWidgetHydrationStateStore: () => AgentsStateStore;
|
|
26
|
+
/** The one default store of the page, created on first use. */
|
|
27
|
+
export declare const getDefaultAgentsStateStore: () => AgentsStateStore;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { AgentsStateAction } from "../../provider/environment";
|
|
2
|
+
import { WidgetHydrationSliceState } from "./widget-hydration.types";
|
|
3
|
+
interface MemoryEnsuredPayload {
|
|
4
|
+
key: string;
|
|
5
|
+
}
|
|
6
|
+
interface InstanceAttachedPayload {
|
|
7
|
+
key: string;
|
|
8
|
+
instanceId: string;
|
|
9
|
+
}
|
|
10
|
+
interface HydrationStartedPayload {
|
|
11
|
+
key: string;
|
|
12
|
+
instanceId: string;
|
|
13
|
+
requestId: number;
|
|
14
|
+
}
|
|
15
|
+
interface HydrationSucceededPayload {
|
|
16
|
+
key: string;
|
|
17
|
+
requestId: number;
|
|
18
|
+
data: unknown;
|
|
19
|
+
}
|
|
20
|
+
interface HydrationFailedPayload {
|
|
21
|
+
key: string;
|
|
22
|
+
requestId: number;
|
|
23
|
+
error: string;
|
|
24
|
+
}
|
|
25
|
+
interface WidgetResetPayload {
|
|
26
|
+
key: string;
|
|
27
|
+
}
|
|
28
|
+
/** The action creators (the action types are the ones the former Redux Toolkit slice used). */
|
|
29
|
+
export declare const WidgetHydrationSlice: {
|
|
30
|
+
memoryEnsured: (payload: MemoryEnsuredPayload) => AgentsStateAction;
|
|
31
|
+
instanceAttached: (payload: InstanceAttachedPayload) => AgentsStateAction;
|
|
32
|
+
hydrationStarted: (payload: HydrationStartedPayload) => AgentsStateAction;
|
|
33
|
+
hydrationSucceeded: (payload: HydrationSucceededPayload) => AgentsStateAction;
|
|
34
|
+
hydrationFailed: (payload: HydrationFailedPayload) => AgentsStateAction;
|
|
35
|
+
widgetReset: (payload: WidgetResetPayload) => AgentsStateAction;
|
|
36
|
+
allWidgetsReset: () => AgentsStateAction;
|
|
37
|
+
};
|
|
38
|
+
export declare const WidgetHydrationReducer: (state: WidgetHydrationSliceState | undefined, action: AgentsStateAction) => WidgetHydrationSliceState;
|
|
39
|
+
export {};
|