@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,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type MarkdownLinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
3
|
+
/** The hast node react-markdown passes to every custom component; not a valid DOM attribute. */
|
|
4
|
+
node?: unknown;
|
|
5
|
+
};
|
|
6
|
+
export declare const MarkdownLink: ({ node, children, ...anchorProps }: MarkdownLinkProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface WindowedWidgetProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
/** First-paint guess from the index window: recent messages start mounted, older ones start as a placeholder. */
|
|
5
|
+
initialRevealed: boolean;
|
|
6
|
+
/** The freshly-delivered widget — kept mounted (never windowed out) so its one-shot effects don't re-fire. */
|
|
7
|
+
pinned: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Mounts a chat widget only while it is near the viewport (see {@link useWidgetWindow}); far from the viewport it
|
|
11
|
+
* collapses to a lightweight placeholder. The wrapper element is STABLE across the toggle so the shared
|
|
12
|
+
* IntersectionObserver keeps tracking it. The placeholder reserves the widget's last measured height, so re-hiding it
|
|
13
|
+
* causes ZERO layout shift (no scroll jump); revealing again restores the real widget (self-hydrating widgets re-fetch
|
|
14
|
+
* with a brief skeleton).
|
|
15
|
+
*/
|
|
16
|
+
export declare const WindowedWidget: ({ children, initialRevealed, pinned }: WindowedWidgetProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/** Shared prop contract for any widget upgrade offer (a widget's own `upsellTrigger`); the flag is the app's object. */
|
|
3
|
+
export interface ConversationWidgetUpsellProps {
|
|
4
|
+
flag: unknown;
|
|
5
|
+
}
|
|
6
|
+
interface ConversationWidgetFeatureGateProps {
|
|
7
|
+
/** The requirement the widget declares in the registry (an app feature flag, opaque to the package). */
|
|
8
|
+
featureFlag: string;
|
|
9
|
+
/** Optional per-widget upgrade offer; falls back to the app gate's own. */
|
|
10
|
+
UpsellTrigger?: React.ComponentType<ConversationWidgetUpsellProps>;
|
|
11
|
+
/** The widget's raw agent space key attribute (renders for another agent space). */
|
|
12
|
+
agentSpaceKeyAttribute?: string | number;
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Gates a widget on the requirement its registry entry declares, through the app's `WidgetFeatureGate` component (the
|
|
17
|
+
* environment's): the widget, a placeholder while the requirements load, or an upgrade offer. Without an app gate
|
|
18
|
+
* every widget renders.
|
|
19
|
+
*/
|
|
20
|
+
export declare const ConversationWidgetFeatureGate: (props: ConversationWidgetFeatureGateProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface ConversationWidgetAgentSpaceFrameProps {
|
|
3
|
+
/** The key of another agent space than the active one: the frame shows its header chip. Undefined → no header. */
|
|
4
|
+
anotherAgentSpaceKey?: number;
|
|
5
|
+
/** Apply the shared wide layout — the frame becomes the wide bounds the chip anchors to. */
|
|
6
|
+
wide?: boolean;
|
|
7
|
+
/** Extra class on the frame — e.g. a widget that needs the frame to fill the drawer height. */
|
|
8
|
+
className?: string;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const ConversationWidgetAgentSpaceFrame: (props: ConversationWidgetAgentSpaceFrameProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ConversationWidgetAgentSpaceHeaderProps {
|
|
2
|
+
agentSpaceKey: number;
|
|
3
|
+
/**
|
|
4
|
+
* Render the chip in the normal flow instead of floating it over the top-right corner of the enclosing frame — for a
|
|
5
|
+
* surface whose corner is taken (the open arrow of a canvas handle, a canvas heading). The parent places it.
|
|
6
|
+
*/
|
|
7
|
+
inFlow?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The chip above a widget whose block names another agent space than the one the owner works in. The name is read
|
|
11
|
+
* through the widget hydration, so several chips of one agent space share one read and the entry is cleared with the
|
|
12
|
+
* other widget data when the conversation changes. The app words what kind of thing an agent space is
|
|
13
|
+
* (`AgentsEnvironment.buildUnnamedAgentSpaceLabel`, `buildWidgetOfAnotherAgentSpaceExplanation`).
|
|
14
|
+
*/
|
|
15
|
+
export declare const ConversationWidgetAgentSpaceHeader: (props: ConversationWidgetAgentSpaceHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A fixture of the package as the app reads it. The package's fixtures name the key of a block's agent space with the
|
|
3
|
+
* package default field (`agentSpaceId`): as a key of an object, as a field in a block's JSON, as an attribute of a
|
|
4
|
+
* block's markdown. An app that declares another field name (`AgentsEnvironment.widgetSelfHydrationKeyFieldName`)
|
|
5
|
+
* reads every occurrence under its own name, so a fixture is mapped once, when it is loaded. Without a declaration
|
|
6
|
+
* the fixture is returned as it is.
|
|
7
|
+
*/
|
|
8
|
+
export declare const mapFixtureToDeclaredAgentSpaceKeyFieldName: <Fixture>(fixture: Fixture) => Fixture;
|
package/dist/types/renderer/_agent-space/use-resolved-conversation-widget-agent-space-key.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ResolvedConversationWidgetAgentSpaceKey {
|
|
2
|
+
/**
|
|
3
|
+
* The key of the agent space the widget renders for when the agent named ANOTHER one than the active one; undefined
|
|
4
|
+
* when the block names none or names the active one. A widget takes its chat-only read path for this key.
|
|
5
|
+
*/
|
|
6
|
+
anotherAgentSpaceKey: number | undefined;
|
|
7
|
+
/** The key of the agent space the owner works in; undefined when the app has none selected. */
|
|
8
|
+
activeAgentSpaceKey: number | undefined;
|
|
9
|
+
isAnotherAgentSpace: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Resolves the agent space a widget block names (`readWidgetAgentSpaceKeyAttribute`) against the agent space the owner
|
|
13
|
+
* works in (`AgentsEnvironment.useActiveAgentSpaceKey`). Returns the key of another agent space only when the agent
|
|
14
|
+
* explicitly names a different one than the active one; otherwise undefined, so the widget keeps its regular behaviour.
|
|
15
|
+
*/
|
|
16
|
+
export declare const useResolvedConversationWidgetAgentSpaceKey: (agentSpaceKeyAttribute: unknown) => ResolvedConversationWidgetAgentSpaceKey;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** The key of a widget block's agent space as it arrives: a string from a markdown attribute, a number from a block field. */
|
|
2
|
+
export type WidgetAgentSpaceKeyAttribute = string | number | undefined;
|
|
3
|
+
/**
|
|
4
|
+
* Reads the key of the agent space a widget block names: the value of the block field the app declares
|
|
5
|
+
* (`AgentsEnvironment.widgetSelfHydrationKeyFieldName`), among a widget's props or a block's fields. Undefined when the
|
|
6
|
+
* block names none.
|
|
7
|
+
*/
|
|
8
|
+
export declare const readWidgetAgentSpaceKeyAttribute: (propsOrFields: object) => WidgetAgentSpaceKeyAttribute;
|
|
9
|
+
/**
|
|
10
|
+
* The props that hand a widget the key of its agent space under the block field the app declares, exactly as a
|
|
11
|
+
* markdown attribute would carry it; no prop without a key.
|
|
12
|
+
*/
|
|
13
|
+
export declare const buildWidgetAgentSpaceKeyProps: (agentSpaceKeyAttribute: WidgetAgentSpaceKeyAttribute) => Record<string, string | number>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one string-aware brace walk every "how far does this widget JSON payload extend" question in the pipeline
|
|
3
|
+
* needs — the malformed-fence repairer, the naked-JSON referencer and the unrendered-widget detector all call this
|
|
4
|
+
* single copy of the scan.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The index of the `}` closing the first `{ … }` JSON object that begins (after optional whitespace) at or after
|
|
8
|
+
* `fromIndex` in `text`, or null when no object starts there or it never balances within `maxScanLength` characters
|
|
9
|
+
* of its start. Quotes and escapes are tracked so a `{`/`}` inside a JSON string value never affects the brace
|
|
10
|
+
* depth (e.g. a widget's `title` field containing literal `{braces}` text).
|
|
11
|
+
*/
|
|
12
|
+
export declare const findBalancedJsonObjectEnd: (text: string, fromIndex: number, maxScanLength?: number) => number | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ChatMessage } from "../../chat/chat-message";
|
|
2
|
+
export interface CanvasRestoreOnMountProps {
|
|
3
|
+
/** The conversation the host shows. Undefined for a cold chat — nothing to restore. */
|
|
4
|
+
conversationId?: number;
|
|
5
|
+
/** The host's loaded messages. A message-anchored restore waits for THIS conversation's page to be in. */
|
|
6
|
+
messages: ChatMessage[] | null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Restores the canvas that was open in this conversation — on a reload, in a new tab, and when the customer comes
|
|
10
|
+
* back to the conversation (A → B → A alike). Must render INSIDE the provider (it dispatches
|
|
11
|
+
* through the context) and runs once per conversation, after the mount reset. A PAGE-anchored canvas (an app's
|
|
12
|
+
* editor opened from a page) needs no message and restores as soon as the conversation id is known. A MESSAGE-anchored
|
|
13
|
+
* canvas waits for the conversation's own messages and has three limits:
|
|
14
|
+
* - the anchor message must be in the loaded page — otherwise the canvas is that far back and irrelevant: the pointer
|
|
15
|
+
* is dropped, nothing is paged in;
|
|
16
|
+
* - a `turn` canvas whose anchor message is no longer the newest assistant message is not restored — its turn is over;
|
|
17
|
+
* - the anchor message must still carry a widget that opens this canvas (a stale or mangled pointer opens nothing).
|
|
18
|
+
*/
|
|
19
|
+
export declare const CanvasRestoreOnMount: ({ conversationId, messages }: CanvasRestoreOnMountProps) => null;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CANVAS BEHAVIOURS — one declaration per canvas of how it lives on the surface: how long it stays (`lifetime`),
|
|
3
|
+
* how it takes the screen (`layout`), what happens on a narrow viewport and whether its body starts flush at the top.
|
|
4
|
+
*
|
|
5
|
+
* Keyed on a CANVAS id, not a widget name: one body may have several openers, and one widget can be inline with a
|
|
6
|
+
* detail canvas. The widget registry lists which canvases a widget may open (`opensCanvases`); the canvas BODIES (React
|
|
7
|
+
* components) live in `canvasBodies.tsx`, imported only by the shell. The package declares the canvases of its own
|
|
8
|
+
* widgets here (`packageCanvasBehaviours`); an app declares the canvases of its widgets on its agents environment
|
|
9
|
+
* (`AgentsEnvironment.furtherCanvasBehaviours`), read at every lookup. This module imports nothing but the environment
|
|
10
|
+
* module (which has no runtime imports), so the conversation slice and its specs can read it during store
|
|
11
|
+
* initialisation (the widget registry is downstream of the store; a slice → registry import forms a temporal-dead-zone
|
|
12
|
+
* cycle).
|
|
13
|
+
*/
|
|
14
|
+
/** The canvases of the package's own widgets. */
|
|
15
|
+
export type PackageCanvasId = "conversationSearchResults" | "webSearchResults" | "entityDetail" | "mapFullScreen";
|
|
16
|
+
/**
|
|
17
|
+
* The id of a canvas: one of the package's (`PackageCanvasId`) or one an app declares
|
|
18
|
+
* (`AgentsEnvironment.furtherCanvasBehaviours`). Append-only while a stored pointer (`canvasStorage.ts`) may still name
|
|
19
|
+
* the id. A string, because the app's ids are not known to the package; `isCanvasId` checks a value against both.
|
|
20
|
+
*/
|
|
21
|
+
export type CanvasId = PackageCanvasId | (string & {});
|
|
22
|
+
/**
|
|
23
|
+
* `turn`: the canvas belongs to one question — the next SEND closes it for good (the card in the transcript is the
|
|
24
|
+
* way back). `pinned`: a work surface for the whole conversation — it stays through sends and stays re-openable after
|
|
25
|
+
* the customer closes it. Lifetime says nothing about a reload: the canvas open at reload time is restored for BOTH.
|
|
26
|
+
*/
|
|
27
|
+
export type CanvasLifetime = "turn" | "pinned";
|
|
28
|
+
/**
|
|
29
|
+
* `split`: the canvas is the right pane beside the chat. `canvasFillsScreen`: the canvas takes the screen and the chat
|
|
30
|
+
* becomes the narrow companion (a full work surface such as an editor); the host's compact mode is overridden while it
|
|
31
|
+
* is open.
|
|
32
|
+
*/
|
|
33
|
+
export type CanvasLayout = "split" | "canvasFillsScreen";
|
|
34
|
+
/**
|
|
35
|
+
* Below the viable split width (`CANVAS_VIABLE_MIN_WIDTH`): `none` — a live delivery does not take the phone screen
|
|
36
|
+
* over (the card stays, the customer taps it), and the wide → narrow crossing closes an open canvas; `overlay` — the
|
|
37
|
+
* canvas is the widget's only surface, so it opens as the full-screen overlay and survives the crossing.
|
|
38
|
+
*/
|
|
39
|
+
export type CanvasNarrowViewport = "none" | "overlay";
|
|
40
|
+
export interface CanvasBehaviour {
|
|
41
|
+
readonly lifetime: CanvasLifetime;
|
|
42
|
+
readonly layout: CanvasLayout;
|
|
43
|
+
/** Width of the canvas pane as a percentage of the split. Only read for `layout: "split"`; default 50. */
|
|
44
|
+
readonly widthPercent?: number;
|
|
45
|
+
readonly narrowViewport: CanvasNarrowViewport;
|
|
46
|
+
/**
|
|
47
|
+
* The body starts flush at its top edge (a hero image, an iframe) — the pane keeps its gap under the close row, unless
|
|
48
|
+
* `overlayCloseButton` floats the row over the body.
|
|
49
|
+
*/
|
|
50
|
+
readonly fullBleed: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The close button floats over the body's top edge instead of reserving a row of its own, and the pane drops its top
|
|
53
|
+
* and side padding — for a body whose top (a hero image) may sit under the button. The button is then muted
|
|
54
|
+
* `inverted` + `onDark`, since it sits on the dark image. Default false: the row stays in flow so it never covers
|
|
55
|
+
* content.
|
|
56
|
+
*/
|
|
57
|
+
readonly overlayCloseButton?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/** Width of the canvas pane (% of the split) when a behaviour declares none. */
|
|
60
|
+
export declare const DEFAULT_CANVAS_WIDTH_PERCENT = 50;
|
|
61
|
+
/** The narrowest the customer can pull the canvas (px); pulling further and holding folds the tab into "close". */
|
|
62
|
+
export declare const CANVAS_MIN_WIDTH_PX = 420;
|
|
63
|
+
/** What the chat column keeps beside the widest canvas (px). */
|
|
64
|
+
export declare const CHAT_COLUMN_MIN_WIDTH_PX = 360;
|
|
65
|
+
/**
|
|
66
|
+
* The boxed canvas card's inset from its pane edge (px) — the pull tab sits on the card's edge, not the pane's. The
|
|
67
|
+
* pane's padding reads it as `--agents-canvas-inset` (`.splitViewPaneBoxed`), so this is the one place it is set.
|
|
68
|
+
*/
|
|
69
|
+
export declare const CANVAS_BOXED_INSET_PX = 8;
|
|
70
|
+
/** Width of the canvas pane for `layout: "canvasFillsScreen"` — the chat keeps a narrow companion column. */
|
|
71
|
+
export declare const CANVAS_FILLS_SCREEN_WIDTH_PERCENT = 72;
|
|
72
|
+
/** The canvases of the package's own widgets. */
|
|
73
|
+
export declare const packageCanvasBehaviours: Readonly<Record<PackageCanvasId, CanvasBehaviour>>;
|
|
74
|
+
/**
|
|
75
|
+
* The behaviour of a canvas: the package's own, else the one the app declares
|
|
76
|
+
* (`AgentsEnvironment.furtherCanvasBehaviours`); undefined for an id nobody declared (a stale stored pointer, a typo —
|
|
77
|
+
* the opening rule ignores it). An app cannot replace a package canvas's behaviour.
|
|
78
|
+
*/
|
|
79
|
+
export declare const canvasBehaviourOf: (canvasId: CanvasId) => CanvasBehaviour | undefined;
|
|
80
|
+
/** Every declared canvas id: the package's own first, then the app's further ones. */
|
|
81
|
+
export declare const getDeclaredCanvasIds: () => readonly CanvasId[];
|
|
82
|
+
/** Type guard for a value read from untrusted input (`sessionStorage`, a URL): is it a declared canvas id? */
|
|
83
|
+
export declare const isCanvasId: (value: unknown) => value is CanvasId;
|
|
84
|
+
export declare const canvasWidthPercentOf: (behaviour: CanvasBehaviour) => number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CanvasState } from "./canvas-state";
|
|
2
|
+
/**
|
|
3
|
+
* What every canvas BODY receives from the shell. The body derives everything else itself: a message-anchored body
|
|
4
|
+
* parses its widget's fence out of the anchor message (the same parser the inline widget uses), a page-anchored body
|
|
5
|
+
* hydrates from the agent space. Nothing is handed over that the transcript already holds.
|
|
6
|
+
*
|
|
7
|
+
* A type-only module: bodies import it without touching `canvasBodies.tsx`, which stays imported by the shell alone.
|
|
8
|
+
*/
|
|
9
|
+
export interface CanvasBodyProps {
|
|
10
|
+
canvas: CanvasState;
|
|
11
|
+
/**
|
|
12
|
+
* The key of the agent space the chat is scoped to (`chatAgentSpaceKey`), for a body whose anchor is a message and
|
|
13
|
+
* whose fence names no other agent space. A page anchor carries its own agent space.
|
|
14
|
+
*/
|
|
15
|
+
agentSpaceKey?: number;
|
|
16
|
+
/** Normalised markdown of the anchor message, for a body that parses its fence out of it. Null for a page anchor. */
|
|
17
|
+
anchorMessageMarkdown: string | null;
|
|
18
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CanvasId } from "./canvas-behaviours";
|
|
2
|
+
/**
|
|
3
|
+
* The requirement (an app feature flag, opaque to the package) a CANVAS requires — the same one its opening widget
|
|
4
|
+
* declares in the registry. Owned by the canvas (not read off an opener) because a restored or page-opened canvas has
|
|
5
|
+
* no widget mount to inherit it from; the shell wraps a gated body in `ConversationWidgetFeatureGate`. An app names
|
|
6
|
+
* the requirements of its canvases with `registerCanvasFeatureFlags`; the package's own canvases are ungated.
|
|
7
|
+
*/
|
|
8
|
+
export declare const canvasFeatureFlags: Partial<Record<CanvasId, string>>;
|
|
9
|
+
/** Adds the requirements of an app's canvases. Runs outside React, before the first render. */
|
|
10
|
+
export declare const registerCanvasFeatureFlags: (featureFlags: Readonly<Partial<Record<CanvasId, string>>>) => void;
|
|
11
|
+
export declare const canvasFeatureFlagOf: (canvasId: CanvasId) => string | undefined;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { CanvasOpenRequest, CanvasState, LastClosedCanvas } from "./canvas-state";
|
|
2
|
+
import { CanvasOpenDecision } from "./decide-canvas-open";
|
|
3
|
+
/**
|
|
4
|
+
* The canvas part of a chat slice partition — the two fields every transition reads and writes. Both chat doors carry
|
|
5
|
+
* them (`ConversationState`); the shell is shared, so the state must have the same shape in both partitions.
|
|
6
|
+
*/
|
|
7
|
+
export interface CanvasSliceState {
|
|
8
|
+
canvas: CanvasState | null;
|
|
9
|
+
lastClosedCanvas: LastClosedCanvas | null;
|
|
10
|
+
/**
|
|
11
|
+
* How many canvases this partition has mounted so far — the source of `mountGeneration`. Never reset by a close,
|
|
12
|
+
* a send or a clear (and exempt from `resetState`), so a late asynchronous write from a body that was replaced,
|
|
13
|
+
* cleared or belonged to the previous conversation can never match a new canvas's generation.
|
|
14
|
+
*/
|
|
15
|
+
canvasMountCount: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Open a canvas — the ONE way to open, for all four origins. On Accept: the replaced canvas (a different identity)
|
|
19
|
+
* becomes `lastClosedCanvas`; a `lastClosedCanvas` of the accepted identity is consumed (its veto is cleared — the
|
|
20
|
+
* customer, the page or the restore decided to have it back); the created entity survives a re-open of the same
|
|
21
|
+
* identity so a restored editor keeps its draft.
|
|
22
|
+
*/
|
|
23
|
+
export declare const applyOpenCanvas: (state: CanvasSliceState, request: CanvasOpenRequest) => CanvasOpenDecision;
|
|
24
|
+
/**
|
|
25
|
+
* Close the open canvas but keep it re-openable: it becomes `lastClosedCanvas`. `byCustomer` marks the customer's own
|
|
26
|
+
* close (the canvas close control) — a live delivery of the same identity is then ignored until a send, a card click
|
|
27
|
+
* or a page hand-over. A shell-driven close (compact mode, the side panel opening, a narrow crossing) passes false.
|
|
28
|
+
*/
|
|
29
|
+
export declare const applyCloseCanvas: (state: CanvasSliceState, byCustomer: boolean) => void;
|
|
30
|
+
/**
|
|
31
|
+
* The SEND boundary: a new user message starts a new turn. A `turn` canvas is over for good — it leaves the open slot
|
|
32
|
+
* AND `lastClosedCanvas` (the card in the transcript is the way back). A `pinned` canvas stays open,
|
|
33
|
+
* and a closed pinned one stays re-openable with its customer veto cleared (the send is a clearing edge).
|
|
34
|
+
*/
|
|
35
|
+
export declare const applyResetCanvasForNewTurn: (state: CanvasSliceState) => void;
|
|
36
|
+
/** Forget the canvas entirely — a conversation switch, `closeAgent`, the modal unmount. Nothing is re-openable. */
|
|
37
|
+
export declare const applyClearCanvas: (state: CanvasSliceState) => void;
|
|
38
|
+
export interface CanvasCreatedEntity {
|
|
39
|
+
readonly canvasId: CanvasState["canvasId"];
|
|
40
|
+
readonly instanceId: string;
|
|
41
|
+
/** The generation the body was mounted with — a late write from a body that was replaced meanwhile is dropped. */
|
|
42
|
+
readonly mountGeneration: number;
|
|
43
|
+
readonly createdEntityId: number;
|
|
44
|
+
}
|
|
45
|
+
/** A body created its entity (the post editor's draft): remember the id on the canvas it was created for. */
|
|
46
|
+
export declare const applySetCanvasCreatedEntityId: (state: CanvasSliceState, created: CanvasCreatedEntity) => boolean;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import type { CanvasId } from "./canvas-behaviours";
|
|
2
|
+
/**
|
|
3
|
+
* The canvas STATE — plain, readonly, serialisable data (it lives in the Redux store, where RTK + Immer forbid class
|
|
4
|
+
* instances). The value-object behaviour — invariants, equality, the transitions — lives in the pure functions of this
|
|
5
|
+
* module and of `decide-canvas-open.ts` / `canvas-reducers.ts`.
|
|
6
|
+
*
|
|
7
|
+
* The canvas is a POINTER to its anchor: the data a canvas body needs already lives in the transcript — the
|
|
8
|
+
* widget's fence in the anchor message is persisted, loaded and rendered. The shell finds the anchor message in the
|
|
9
|
+
* loaded list, parses the fence with the widget's own parser and renders the body from the result. Nothing about the
|
|
10
|
+
* content is stored a second time. A page-opened canvas (an app's editor opened from its page) has no message; its
|
|
11
|
+
* anchor is the agent space and the body hydrates from it.
|
|
12
|
+
*/
|
|
13
|
+
export type CanvasAnchor = {
|
|
14
|
+
readonly kind: "message";
|
|
15
|
+
readonly messageId: number;
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: "page";
|
|
18
|
+
readonly agentSpaceKey: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* How a canvas came to be open — the one question the opening rule asks (`decide-canvas-open.ts`):
|
|
22
|
+
* - `deliveredInMessage` a canvas widget in a message delivered live (`justDelivered`); replay never opens one
|
|
23
|
+
* - `cardClick` the customer clicked a card in the transcript, or the canvas toggle button on the divider
|
|
24
|
+
* - `openedByPage` a page handed the tool over (`openAgentWithWidget` / `?agentWidget=`)
|
|
25
|
+
* - `restoredAfterReload` the pointer stored for this conversation, on the mount of the conversation
|
|
26
|
+
* A restored or page-opened canvas never runs a body's creation side effects (a post editor with no created entity
|
|
27
|
+
* renders its empty state instead of creating a draft).
|
|
28
|
+
*/
|
|
29
|
+
export type CanvasOrigin = "deliveredInMessage" | "cardClick" | "openedByPage" | "restoredAfterReload";
|
|
30
|
+
/** The identity of a canvas: WHICH canvas, and which instance of it. Two canvases with the same identity are one. */
|
|
31
|
+
export interface CanvasIdentity {
|
|
32
|
+
readonly canvasId: CanvasId;
|
|
33
|
+
/**
|
|
34
|
+
* Distinguishes instances of one canvas: lists per message (+ occurrence in the message), a work surface per
|
|
35
|
+
* agent space, an entity editor or detail per entity. Built with the helpers below.
|
|
36
|
+
* Never includes the conversation id — a cold chat receives its id after the first send.
|
|
37
|
+
*/
|
|
38
|
+
readonly instanceId: string;
|
|
39
|
+
}
|
|
40
|
+
export interface CanvasState extends CanvasIdentity {
|
|
41
|
+
readonly anchor: CanvasAnchor;
|
|
42
|
+
readonly origin: CanvasOrigin;
|
|
43
|
+
/**
|
|
44
|
+
* Bumped on every accepted open (also of the same identity from a card click) so the shell keys the body on it: a
|
|
45
|
+
* list re-opened with other filters remounts and re-runs its mount effects. Monotonic within the conversation.
|
|
46
|
+
*/
|
|
47
|
+
readonly mountGeneration: number;
|
|
48
|
+
/**
|
|
49
|
+
* The one datum not in a message: the id of the entity a body CREATED after opening (the post editor's draft).
|
|
50
|
+
* Written back by `setCanvasCreatedEntityId`; a restored editor with no id renders its empty state.
|
|
51
|
+
*/
|
|
52
|
+
readonly createdEntityId?: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The canvas that was open last and is not open now — what the canvas toggle button on the divider, the narrow-
|
|
56
|
+
* viewport re-open control and the compact → expand path re-open. `closedByCustomer` is the customer's veto: a live
|
|
57
|
+
* delivery of the SAME identity is ignored until a send, a card click or a page hand-over clears it.
|
|
58
|
+
*/
|
|
59
|
+
export interface LastClosedCanvas extends CanvasIdentity {
|
|
60
|
+
readonly anchor: CanvasAnchor;
|
|
61
|
+
readonly mountGeneration: number;
|
|
62
|
+
readonly closedByCustomer: boolean;
|
|
63
|
+
readonly createdEntityId?: number;
|
|
64
|
+
}
|
|
65
|
+
/** What an opener hands to `openCanvas` — everything the opening rule needs to decide, nothing more. */
|
|
66
|
+
export interface CanvasOpenRequest extends CanvasIdentity {
|
|
67
|
+
readonly anchor: CanvasAnchor;
|
|
68
|
+
readonly origin: CanvasOrigin;
|
|
69
|
+
/** The host message was delivered live right now (the widget's `justDelivered`). Irrelevant for other origins. */
|
|
70
|
+
readonly justDelivered: boolean;
|
|
71
|
+
/** The viewport is wide enough for the side split (`useCanvasViable`). */
|
|
72
|
+
readonly viewportViable: boolean;
|
|
73
|
+
/** The host renders the split at all (`disableSplitView` hosts have no canvas surface). */
|
|
74
|
+
readonly hostHasCanvasSurface: boolean;
|
|
75
|
+
/** Carried by a restored pointer so a re-opened editor keeps its created entity. */
|
|
76
|
+
readonly createdEntityId?: number;
|
|
77
|
+
}
|
|
78
|
+
export declare const sameCanvasIdentity: (a: CanvasIdentity, b: CanvasIdentity) => boolean;
|
|
79
|
+
export declare const sameCanvasAnchor: (a: CanvasAnchor, b: CanvasAnchor) => boolean;
|
|
80
|
+
export declare const messageAnchor: (messageId: number) => CanvasAnchor;
|
|
81
|
+
export declare const pageAnchor: (agentSpaceKey: number) => CanvasAnchor;
|
|
82
|
+
/** A list-like canvas: one instance per message, and per occurrence when a message carries the widget twice. */
|
|
83
|
+
export declare const canvasInstanceIdForMessage: (canvasId: CanvasId, messageId: number, occurrence?: number) => string;
|
|
84
|
+
/** A work surface unique per agent space (an app's editor): a later card for the same agent space never replaces it. */
|
|
85
|
+
export declare const canvasInstanceIdForAgentSpace: (canvasId: CanvasId, agentSpaceKey: number) => string;
|
|
86
|
+
/**
|
|
87
|
+
* A short, stable, dependency-free hash of a string (djb2, base 36) — identifies a widget's payload inside a message
|
|
88
|
+
* without storing the payload. Not cryptographic; two payloads colliding would only merge two identical-looking
|
|
89
|
+
* canvases of one message.
|
|
90
|
+
*/
|
|
91
|
+
export declare const shortStringHash: (value: string) => string;
|
|
92
|
+
/**
|
|
93
|
+
* A canvas opened by a widget WITH a payload (a list with filters, a search result): one instance per message and
|
|
94
|
+
* payload, so two different widgets of one kind in one message are two canvases while two identical ones are one.
|
|
95
|
+
* The body finds its fence again through the hash (`findWidgetFenceByPayloadHash`).
|
|
96
|
+
*/
|
|
97
|
+
export declare const canvasInstanceIdForMessagePayload: (canvasId: CanvasId, messageId: number, payload: string) => string;
|
|
98
|
+
/** The payload hash a message+payload instance id carries, or undefined for another shape of instance id. */
|
|
99
|
+
export declare const payloadHashOfInstanceId: (instanceId: string) => string | undefined;
|
|
100
|
+
/** The same work surface when no agent space key is known at open time (the body resolves the active agent space itself). */
|
|
101
|
+
export declare const canvasInstanceIdForActiveAgentSpace: (canvasId: CanvasId) => string;
|
|
102
|
+
/** An editor / detail unique per entity (post, event, schedule). */
|
|
103
|
+
export declare const canvasInstanceIdForEntity: (canvasId: CanvasId, entityId: number) => string;
|
|
104
|
+
/** The entity id an entity instance id carries, or undefined for another shape of instance id. */
|
|
105
|
+
export declare const entityIdOfInstanceId: (instanceId: string) => number | undefined;
|
|
106
|
+
/** True when the anchor message of a canvas is among the loaded messages (a restored pointer must point somewhere). */
|
|
107
|
+
export declare const isCanvasAnchorLoaded: (anchor: CanvasAnchor, loadedMessageIds: ReadonlyArray<number | undefined | null>) => boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { CanvasId } from "./canvas-behaviours";
|
|
3
|
+
import type { CanvasBodyProps } from "./canvas-body-props";
|
|
4
|
+
export type { CanvasBodyProps } from "./canvas-body-props";
|
|
5
|
+
export { canvasFeatureFlagOf } from "./canvas-feature-flags";
|
|
6
|
+
/**
|
|
7
|
+
* THE CANVAS BODIES — canvas id → the React component the shell mounts in the canvas pane. The one module that knows
|
|
8
|
+
* both the canvas ids and React components, and it is imported ONLY by `CanvasPane` (the shell), never by
|
|
9
|
+
* the slice, the behaviours or a widget — that is the import layering that keeps the store-init temporal-dead-zone
|
|
10
|
+
* cycle away. The bodies themselves are small: a body that hosts a heavy page (an app's list page or editor)
|
|
11
|
+
* lazy-loads that page, exactly as its widget did. Every canvas has a body; nothing
|
|
12
|
+
* else hands the pane a rendered node.
|
|
13
|
+
*
|
|
14
|
+
* The package's own bodies are listed here; an app adds the bodies of its canvases with `registerCanvasBodies` before
|
|
15
|
+
* the first render. The object is filled in place, so the shell reads every registration.
|
|
16
|
+
*/
|
|
17
|
+
export declare const canvasBodies: Record<CanvasId, React.ComponentType<CanvasBodyProps>>;
|
|
18
|
+
/** Adds an app's canvas bodies (canvas id → body). Runs outside React, before the first render. */
|
|
19
|
+
export declare const registerCanvasBodies: (bodies: Readonly<Partial<Record<CanvasId, React.ComponentType<CanvasBodyProps>>>>) => void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CanvasAnchor, CanvasState } from "./canvas-state";
|
|
2
|
+
/**
|
|
3
|
+
* Where the open canvas of a conversation is remembered across a reload: `sessionStorage`, per conversation, holding
|
|
4
|
+
* the POINTER only — which canvas, which anchor, which instance, and the entity a body created. Never
|
|
5
|
+
* content: the anchor message's fence supplies the body's data on restore. Tab-local by design (the canvas is viewing
|
|
6
|
+
* state of this tab); a new tab starts with no canvas.
|
|
7
|
+
*
|
|
8
|
+
* Written on every change of the open canvas for ANY lifetime, cleared when the canvas closes; on read the pointer is
|
|
9
|
+
* validated shape by shape — a stale id or a mangled entry reads as "nothing stored". Every accessor is try/catch-
|
|
10
|
+
* guarded: a private window, blocked site data or a preview context can throw on the accessor itself.
|
|
11
|
+
*/
|
|
12
|
+
export interface StoredCanvasPointer {
|
|
13
|
+
readonly canvasId: CanvasState["canvasId"];
|
|
14
|
+
readonly anchor: CanvasAnchor;
|
|
15
|
+
readonly instanceId: string;
|
|
16
|
+
readonly createdEntityId?: number;
|
|
17
|
+
}
|
|
18
|
+
/** Validate an untrusted value into a pointer, or null. Exported for the spec and for the shell's restore path. */
|
|
19
|
+
export declare const parseStoredCanvasPointer: (value: unknown) => StoredCanvasPointer | null;
|
|
20
|
+
/** Remember the canvas open in this conversation. No-op without a conversation id (a cold chat has none yet). */
|
|
21
|
+
export declare const storeOpenCanvas: (conversationId: number | undefined, canvas: CanvasState) => void;
|
|
22
|
+
/** The canvas that was open in this conversation, validated, or null (nothing stored, stale, or storage unusable). */
|
|
23
|
+
export declare const readStoredCanvas: (conversationId: number | undefined) => StoredCanvasPointer | null;
|
|
24
|
+
/** Forget the canvas of this conversation — it closed, or its anchor is no longer among the loaded messages. */
|
|
25
|
+
export declare const clearStoredCanvas: (conversationId: number | undefined) => void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { CanvasBehaviour } from "./canvas-behaviours";
|
|
2
|
+
import { CanvasOpenRequest, CanvasState, LastClosedCanvas } from "./canvas-state";
|
|
3
|
+
/**
|
|
4
|
+
* Why an open request is ignored. Every reason is a sentence the shell could log:
|
|
5
|
+
* - `unknownCanvas` no behaviour is declared for the id (a stale stored pointer, a typo)
|
|
6
|
+
* - `noSurface` the host renders no split (`disableSplitView`), so there is nowhere to open
|
|
7
|
+
* - `replay` a delivery-origin request for a message that was NOT just delivered — history
|
|
8
|
+
* replay, a reload, scroll-back; rejected BEFORE anything is read or written
|
|
9
|
+
* - `alreadyOpen` a delivery-origin request for the identity that is already open (the agent re-emits
|
|
10
|
+
* an editor widget after a rebuild) — the open canvas is kept, never remounted
|
|
11
|
+
* - `customerClosedIt` the customer closed exactly this identity and nothing has cleared the veto yet
|
|
12
|
+
* - `noTakeoverOnNarrowViewport` a live delivery on a narrow viewport of a canvas that declares no overlay — the
|
|
13
|
+
* card stays, the customer taps it
|
|
14
|
+
*/
|
|
15
|
+
export type CanvasOpenIgnoreReason = "unknownCanvas" | "noSurface" | "replay" | "alreadyOpen" | "customerClosedIt" | "noTakeoverOnNarrowViewport";
|
|
16
|
+
export type CanvasOpenDecision = {
|
|
17
|
+
readonly kind: "accept";
|
|
18
|
+
} | {
|
|
19
|
+
readonly kind: "ignore";
|
|
20
|
+
readonly reason: CanvasOpenIgnoreReason;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* THE opening rule — the one place that answers "may this canvas open now?". Pure: it reads the behaviour, the open
|
|
24
|
+
* canvas, the last closed one and the request, and returns Accept or Ignore. It never mutates; the reducer
|
|
25
|
+
* (`canvas-reducers.ts`) applies an Accept. There is no merge rung: the same identity opened again from a card click
|
|
26
|
+
* is a fresh Accept (remount), and the refresh contract of a pinned work surface is a value the body derives from the
|
|
27
|
+
* message list, not a reducer merge.
|
|
28
|
+
*
|
|
29
|
+
* A `cardClick`, an `openedByPage` and a `restoredAfterReload` request always open (the customer, the page or the
|
|
30
|
+
* stored pointer decided); only `deliveredInMessage` is judged.
|
|
31
|
+
*/
|
|
32
|
+
export declare const decideCanvasOpen: (behaviour: CanvasBehaviour | undefined, openCanvas: CanvasState | null, lastClosedCanvas: LastClosedCanvas | null, request: CanvasOpenRequest) => CanvasOpenDecision;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface EntityDetailTarget {
|
|
2
|
+
entityType: string;
|
|
3
|
+
entityId: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const canvasInstanceIdForEntityDetail: (target: EntityDetailTarget) => string;
|
|
6
|
+
/** The entity an `entityDetail` instance id names, or undefined for another instance id. */
|
|
7
|
+
export declare const readEntityDetailInstanceId: (instanceId: string) => EntityDetailTarget | undefined;
|
|
8
|
+
/** The `refState` the backend writes on an `openEntity` action whose `ref` is bound to the current row. */
|
|
9
|
+
export declare const OPEN_ENTITY_REF_STATE_FROM_ROW = "row";
|
|
10
|
+
/**
|
|
11
|
+
* Whether an `openEntity` action opens the entity of the row it fires in — its `ref` is a `{"$item": "<key>"}`
|
|
12
|
+
* binding (`{"$item":"entityRef"}` inside a `Repeat`, a `Map` point, a list row), or the backend marked it
|
|
13
|
+
* `refState: "row"` (`ComposedViewBindingResolution::STATE_FROM_ROW`). Such an action carries no entity of its own.
|
|
14
|
+
*/
|
|
15
|
+
export declare const isRowBoundOpenEntityAction: (action: Record<string, unknown>) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The entity an `openEntity` action opens, or undefined (the action then does nothing):
|
|
18
|
+
* - an action with a platform-minted reference — `{"type":"openEntity", "ref":"<toolCallId>:<entityType>:<index>",
|
|
19
|
+
* "entity":{"entityType","entityId",<agent space key field>}}` — opens the `entity` the backend resolved it to; undefined while
|
|
20
|
+
* the reference is unresolved;
|
|
21
|
+
* - a row-bound action ({@link isRowBoundOpenEntityAction}) opens the `entity` of `currentRow`, the row of the item
|
|
22
|
+
* scope the event fires in (each row of a resolved `$from` list carries its own `entityRef` + `entity`) — NEVER an
|
|
23
|
+
* `entity` written on the action; undefined without a row or for a row without an entity.
|
|
24
|
+
*/
|
|
25
|
+
export declare const readOpenEntityActionTarget: (action: Record<string, unknown>, currentRow?: unknown) => (EntityDetailTarget & {
|
|
26
|
+
agentSpaceKey?: number;
|
|
27
|
+
}) | undefined;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** One widget the anchor message carries — what a canvas body parses its own payload from. */
|
|
2
|
+
export interface WidgetFenceInMessage {
|
|
3
|
+
/** The CANONICAL wire name (a stored legacy `<Name>Directive` resolves onto it). */
|
|
4
|
+
readonly name: string;
|
|
5
|
+
/** The fence's non-`type` fields as the JSON string every widget parser takes (`payload`). */
|
|
6
|
+
readonly payload: string;
|
|
7
|
+
/** The agent space key the framework lifts out of the fence (the block field the app declares), when present. */
|
|
8
|
+
readonly agentSpaceKey?: string;
|
|
9
|
+
/** `shortStringHash(payload)` — what `canvasInstanceIdForMessagePayload` puts into the instance id. */
|
|
10
|
+
readonly payloadHash: string;
|
|
11
|
+
/** Every string attribute of the node (`target`, `mode`, … — widgets that do not use `payload`). */
|
|
12
|
+
readonly attributes: Readonly<Record<string, string>>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Every widget in a message's markdown, in document order, through the SAME pipeline the message renders with
|
|
16
|
+
* (`remarkDirective` for the stored `::Name{payload='…'}` form, `remarkWidgetFencePlugin` for the ```widget fence and
|
|
17
|
+
* the bare `widget { … }` line) — so a canvas body re-reads exactly the payload its inline widget rendered from, in
|
|
18
|
+
* both the canonical and the legacy wire form. Malformed or unknown widgets are dropped, as when rendering.
|
|
19
|
+
*
|
|
20
|
+
* A `ComposedView` block is followed by the domain widgets its tree embeds (`Widget` nodes), each as if
|
|
21
|
+
* its own fence stood there — `payload` = the node's `fields` — so a canvas opened from a widget in a slot finds its
|
|
22
|
+
* payload like any other canvas body, and the reload restore finds the widget that opens the canvas.
|
|
23
|
+
*
|
|
24
|
+
* Shell-side only (the pipeline imports the widget registry through the name resolver): imported by canvas bodies,
|
|
25
|
+
* never by the slice or the canvas model modules.
|
|
26
|
+
*/
|
|
27
|
+
export declare const findWidgetFencesInMarkdown: (markdown: string) => WidgetFenceInMessage[];
|
|
28
|
+
/**
|
|
29
|
+
* The fence a canvas is anchored on: the widget of `name` whose payload hash the canvas instance id carries
|
|
30
|
+
* (`canvasInstanceIdForMessagePayload`). Two identical widgets in one message share one canvas by design.
|
|
31
|
+
*/
|
|
32
|
+
export declare const findWidgetFenceByPayloadHash: (markdown: string, name: string, payloadHash: string) => WidgetFenceInMessage | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CanvasState } from "./canvas-state";
|
|
2
|
+
/**
|
|
3
|
+
* The payload string of the widget a message-anchored canvas was opened from: the fence of `widgetName` in the anchor
|
|
4
|
+
* message whose payload hash the canvas instance id carries (`canvasInstanceIdForMessagePayload`); when the instance
|
|
5
|
+
* id carries no hash (one canvas per message), the first fence of that name. Undefined for a page anchor, a missing
|
|
6
|
+
* anchor message, or a message that no longer carries the fence — the body then renders nothing.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useAnchorWidgetPayload: (canvas: CanvasState, anchorMessageMarkdown: string | null, widgetName: string) => string | undefined;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ConversationComposerWidget } from "./conversation-composer-widget";
|
|
2
|
+
/**
|
|
3
|
+
* The FE twin of the backend's `AIConversationMessage::buildWidgetFenceBlock` — assembles / disassembles the
|
|
4
|
+
* ```widget fence(s) a composer widget becomes inside the message TEXT (the record; no DB column, no DTO change). `buildComposerWidgetFenceBlock` / `buildMessageTextWithComposerWidgets` run on SEND;
|
|
5
|
+
* `splitComposerWidgetFencesFromMessageText` runs on the USER BUBBLE to pull the fence back out as a
|
|
6
|
+
* read-only widget above the prose.
|
|
7
|
+
*/
|
|
8
|
+
/** One ```widget fence block for a composer widget — `type` first, then its own fields, one line of JSON. */
|
|
9
|
+
export declare const buildComposerWidgetFenceBlock: (widget: ConversationComposerWidget) => string;
|
|
10
|
+
/**
|
|
11
|
+
* The message text a send assembles: the typed text first, then one fence block per composer widget in composer
|
|
12
|
+
* order, a blank line between blocks. Empty text + at least one widget is allowed (a fence-only send) — the result
|
|
13
|
+
* is non-empty as long as EITHER side has content; both empty yields `""`, the send guard's cue to no-op.
|
|
14
|
+
*/
|
|
15
|
+
export declare const buildMessageTextWithComposerWidgets: (text: string, widgets: ConversationComposerWidget[]) => string;
|
|
16
|
+
export interface SplitComposerWidgetFencesResult {
|
|
17
|
+
/** The message text with every extracted fence removed, trimmed. */
|
|
18
|
+
text: string;
|
|
19
|
+
/** The extracted composer widgets, in the order they appeared. */
|
|
20
|
+
widgets: ConversationComposerWidget[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The inverse of {@link buildMessageTextWithComposerWidgets}. Extracts every ```widget fence in `text` whose `type`
|
|
24
|
+
* resolves (canonical or legacy `Directive` form, see `widget-name-resolver.ts`) to a registered widget that
|
|
25
|
+
* declares a `composerComponent` — the only fences a user bubble renders as a read-only widget instead of leaving as
|
|
26
|
+
* text. Every other fence — prose, and fences for widgets WITHOUT a `composerComponent` — is left in `text`
|
|
27
|
+
* verbatim. Never throws: an unterminated fence, malformed JSON, or an unresolved/non-composable `type` just leaves
|
|
28
|
+
* that fence untouched.
|
|
29
|
+
*/
|
|
30
|
+
export declare const splitComposerWidgetFencesFromMessageText: (text: string) => SplitComposerWidgetFencesResult;
|