stream-chat-react-native-core 9.12.1 → 9.13.0
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/a2ui/package.json +6 -0
- package/lib/commonjs/a11y/a11yUtils.js.map +1 -1
- package/lib/commonjs/a11y/hooks/useResolvedModalAccessibilityProps.js.map +1 -1
- package/lib/commonjs/a2ui/A2UIContexts.js +8 -0
- package/lib/commonjs/a2ui/A2UIContexts.js.map +1 -0
- package/lib/commonjs/a2ui/A2UIInstructions.js +49 -0
- package/lib/commonjs/a2ui/A2UIInstructions.js.map +1 -0
- package/lib/commonjs/a2ui/A2UIPlaceholder.js +37 -0
- package/lib/commonjs/a2ui/A2UIPlaceholder.js.map +1 -0
- package/lib/commonjs/a2ui/A2UIRenderer.js +363 -0
- package/lib/commonjs/a2ui/A2UIRenderer.js.map +1 -0
- package/lib/commonjs/a2ui/A2UIStream.js +91 -0
- package/lib/commonjs/a2ui/A2UIStream.js.map +1 -0
- package/lib/commonjs/a2ui/A2UISurface.js +212 -0
- package/lib/commonjs/a2ui/A2UISurface.js.map +1 -0
- package/lib/commonjs/a2ui/basicCatalog.json +1206 -0
- package/lib/commonjs/a2ui/basicFunctions.js +398 -0
- package/lib/commonjs/a2ui/basicFunctions.js.map +1 -0
- package/lib/commonjs/a2ui/catalogDocument.js +80 -0
- package/lib/commonjs/a2ui/catalogDocument.js.map +1 -0
- package/lib/commonjs/a2ui/catalogs.js +105 -0
- package/lib/commonjs/a2ui/catalogs.js.map +1 -0
- package/lib/commonjs/a2ui/components/DateTimeInput.js +445 -0
- package/lib/commonjs/a2ui/components/DateTimeInput.js.map +1 -0
- package/lib/commonjs/a2ui/components/Media.js +316 -0
- package/lib/commonjs/a2ui/components/Media.js.map +1 -0
- package/lib/commonjs/a2ui/components/basicComponents.js +975 -0
- package/lib/commonjs/a2ui/components/basicComponents.js.map +1 -0
- package/lib/commonjs/a2ui/components/iconPaths.js +66 -0
- package/lib/commonjs/a2ui/components/iconPaths.js.map +1 -0
- package/lib/commonjs/a2ui/components/types.js +4 -0
- package/lib/commonjs/a2ui/components/types.js.map +1 -0
- package/lib/commonjs/a2ui/index.js +70 -0
- package/lib/commonjs/a2ui/index.js.map +1 -0
- package/lib/commonjs/a2ui/instructions.js +268 -0
- package/lib/commonjs/a2ui/instructions.js.map +1 -0
- package/lib/commonjs/a2ui/secrets.js +169 -0
- package/lib/commonjs/a2ui/secrets.js.map +1 -0
- package/lib/commonjs/a2ui/useReplyState.js +35 -0
- package/lib/commonjs/a2ui/useReplyState.js.map +1 -0
- package/lib/commonjs/ai-components/AITypingIndicatorView.js +8 -18
- package/lib/commonjs/ai-components/AITypingIndicatorView.js.map +1 -1
- package/lib/commonjs/ai-components/README.md +55 -3
- package/lib/commonjs/ai-components/StreamingMessageView.js +26 -0
- package/lib/commonjs/ai-components/StreamingMessageView.js.map +1 -1
- package/lib/commonjs/ai-components/charts/components/PieLegend.js +2 -1
- package/lib/commonjs/ai-components/charts/components/PieLegend.js.map +1 -1
- package/lib/commonjs/ai-components/charts/components/VictoryChart.js +7 -2
- package/lib/commonjs/ai-components/charts/components/VictoryChart.js.map +1 -1
- package/lib/commonjs/ai-components/charts/utils/format-time-label.js +15 -0
- package/lib/commonjs/ai-components/charts/utils/format-time-label.js.map +1 -0
- package/lib/commonjs/ai-components/charts/vega-lite/schema.js +17 -2
- package/lib/commonjs/ai-components/charts/vega-lite/schema.js.map +1 -1
- package/lib/commonjs/ai-components/contexts/composer-context.js +13 -6
- package/lib/commonjs/ai-components/contexts/composer-context.js.map +1 -1
- package/lib/commonjs/ai-components/contexts/index.js +11 -0
- package/lib/commonjs/ai-components/contexts/index.js.map +1 -1
- package/lib/commonjs/ai-components/contexts/theme-context.js +33 -2
- package/lib/commonjs/ai-components/contexts/theme-context.js.map +1 -1
- package/lib/commonjs/ai-components/contexts/translation-context.js +29 -0
- package/lib/commonjs/ai-components/contexts/translation-context.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/AIConversation.js +366 -0
- package/lib/commonjs/ai-components/conversation/AIConversation.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/AIAgentError.js +13 -0
- package/lib/commonjs/ai-components/conversation/controller/AIAgentError.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/AIConversationController.js +425 -0
- package/lib/commonjs/ai-components/conversation/controller/AIConversationController.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/AIConversationExchange.js +89 -0
- package/lib/commonjs/ai-components/conversation/controller/AIConversationExchange.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/index.js +48 -0
- package/lib/commonjs/ai-components/conversation/controller/index.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/offers.js +29 -0
- package/lib/commonjs/ai-components/conversation/controller/offers.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/types.js +13 -0
- package/lib/commonjs/ai-components/conversation/controller/types.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/controller/useAIConversationState.js +8 -0
- package/lib/commonjs/ai-components/conversation/controller/useAIConversationState.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/entries.js +98 -0
- package/lib/commonjs/ai-components/conversation/entries.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/fromStreamMessage.js +66 -0
- package/lib/commonjs/ai-components/conversation/fromStreamMessage.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/index.js +48 -0
- package/lib/commonjs/ai-components/conversation/index.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/AIChatList.js +224 -0
- package/lib/commonjs/ai-components/conversation/list/AIChatList.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/useChatListController.js +78 -0
- package/lib/commonjs/ai-components/conversation/list/useChatListController.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/useEndInView.js +51 -0
- package/lib/commonjs/ai-components/conversation/list/useEndInView.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/useKeyboardOverlap.js +54 -0
- package/lib/commonjs/ai-components/conversation/list/useKeyboardOverlap.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/useLoadOlder.js +73 -0
- package/lib/commonjs/ai-components/conversation/list/useLoadOlder.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/list/usePinnedAnchor.js +84 -0
- package/lib/commonjs/ai-components/conversation/list/usePinnedAnchor.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/types.js +4 -0
- package/lib/commonjs/ai-components/conversation/types.js.map +1 -0
- package/lib/commonjs/ai-components/conversation/useConversationRows.js +117 -0
- package/lib/commonjs/ai-components/conversation/useConversationRows.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIAction.js +30 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIAction.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIArguments.js +128 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIArguments.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIComponent.js +50 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIComponent.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIComponentDefinition.js +134 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIComponentDefinition.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIDocument.js +32 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIDocument.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIEntrance.js +193 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIEntrance.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIErrorBoundary.js +30 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIErrorBoundary.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIHelpers.js +54 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIHelpers.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIHost.js +259 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIHost.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIMedia.js +24 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIMedia.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIRenderer.js +10 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIRenderer.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIView.js +57 -0
- package/lib/commonjs/ai-components/generative-ui/AIUIView.js.map +1 -0
- package/lib/commonjs/ai-components/generative-ui/index.js +181 -0
- package/lib/commonjs/ai-components/generative-ui/index.js.map +1 -0
- package/lib/commonjs/ai-components/icons.js +44 -0
- package/lib/commonjs/ai-components/icons.js.map +1 -0
- package/lib/commonjs/ai-components/index.js +96 -0
- package/lib/commonjs/ai-components/index.js.map +1 -1
- package/lib/commonjs/ai-components/internal/Shimmer.js +36 -0
- package/lib/commonjs/ai-components/internal/Shimmer.js.map +1 -0
- package/lib/commonjs/ai-components/internal/format.js +66 -0
- package/lib/commonjs/ai-components/internal/format.js.map +1 -0
- package/lib/commonjs/ai-components/internal/hooks/useBottomSafeArea.js +12 -0
- package/lib/commonjs/ai-components/internal/hooks/useBottomSafeArea.js.map +1 -0
- package/lib/commonjs/ai-components/internal/icons/AgentIcons.js +74 -0
- package/lib/commonjs/ai-components/internal/icons/AgentIcons.js.map +1 -0
- package/lib/commonjs/ai-components/internal/tokens.js +11 -0
- package/lib/commonjs/ai-components/internal/tokens.js.map +1 -0
- package/lib/commonjs/ai-components/internal/uuid.js +21 -0
- package/lib/commonjs/ai-components/internal/uuid.js.map +1 -0
- package/lib/commonjs/ai-components/markdown/components/CodeBlock.js +4 -2
- package/lib/commonjs/ai-components/markdown/components/CodeBlock.js.map +1 -1
- package/lib/commonjs/ai-components/markdown/components/InlineCode.js +1 -0
- package/lib/commonjs/ai-components/markdown/components/InlineCode.js.map +1 -1
- package/lib/commonjs/ai-components/markdown/components/Text.js +11 -2
- package/lib/commonjs/ai-components/markdown/components/Text.js.map +1 -1
- package/lib/commonjs/ai-components/markdown/styles.js +27 -29
- package/lib/commonjs/ai-components/markdown/styles.js.map +1 -1
- package/lib/commonjs/ai-components/message/AIAssistantMessage.js +63 -0
- package/lib/commonjs/ai-components/message/AIAssistantMessage.js.map +1 -0
- package/lib/commonjs/ai-components/message/AIMessageAttachment.js +189 -0
- package/lib/commonjs/ai-components/message/AIMessageAttachment.js.map +1 -0
- package/lib/commonjs/ai-components/message/AIReplyActions.js +132 -0
- package/lib/commonjs/ai-components/message/AIReplyActions.js.map +1 -0
- package/lib/commonjs/ai-components/message/AIUserMessage.js +104 -0
- package/lib/commonjs/ai-components/message/AIUserMessage.js.map +1 -0
- package/lib/commonjs/ai-components/message/UserMessageMenu.js +150 -0
- package/lib/commonjs/ai-components/message/UserMessageMenu.js.map +1 -0
- package/lib/commonjs/ai-components/message/index.js +48 -0
- package/lib/commonjs/ai-components/message/index.js.map +1 -0
- package/lib/commonjs/ai-components/message-composer/ActionButton.js +2 -1
- package/lib/commonjs/ai-components/message-composer/ActionButton.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/ActionSheet.js +22 -6
- package/lib/commonjs/ai-components/message-composer/ActionSheet.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/AttachmentButton.js +5 -1
- package/lib/commonjs/ai-components/message-composer/AttachmentButton.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/ChatOptions.js +147 -0
- package/lib/commonjs/ai-components/message-composer/ChatOptions.js.map +1 -0
- package/lib/commonjs/ai-components/message-composer/ComposerView.js +136 -20
- package/lib/commonjs/ai-components/message-composer/ComposerView.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/EditingMessageChip.js +80 -0
- package/lib/commonjs/ai-components/message-composer/EditingMessageChip.js.map +1 -0
- package/lib/commonjs/ai-components/message-composer/MediaPreviewList.js +26 -1
- package/lib/commonjs/ai-components/message-composer/MediaPreviewList.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/index.js +11 -0
- package/lib/commonjs/ai-components/message-composer/index.js.map +1 -1
- package/lib/commonjs/ai-components/message-parts/AIMessageParts.js +110 -0
- package/lib/commonjs/ai-components/message-parts/AIMessageParts.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/AIToolApproval.js +197 -0
- package/lib/commonjs/ai-components/message-parts/AIToolApproval.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/AIToolAuthorization.js +250 -0
- package/lib/commonjs/ai-components/message-parts/AIToolAuthorization.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/AIToolCall.js +159 -0
- package/lib/commonjs/ai-components/message-parts/AIToolCall.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/callStates.js +54 -0
- package/lib/commonjs/ai-components/message-parts/callStates.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/index.js +70 -0
- package/lib/commonjs/ai-components/message-parts/index.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/parseMessageParts.js +126 -0
- package/lib/commonjs/ai-components/message-parts/parseMessageParts.js.map +1 -0
- package/lib/commonjs/ai-components/message-parts/types.js +2 -0
- package/lib/commonjs/ai-components/message-parts/types.js.map +1 -0
- package/lib/commonjs/ai-components/native-specs/NativeAIAgent.js +7 -0
- package/lib/commonjs/ai-components/native-specs/NativeAIAgent.js.map +1 -0
- package/lib/commonjs/ai-components/reasoning/AIReasoning.js +401 -0
- package/lib/commonjs/ai-components/reasoning/AIReasoning.js.map +1 -0
- package/lib/commonjs/ai-components/reasoning/index.js +26 -0
- package/lib/commonjs/ai-components/reasoning/index.js.map +1 -0
- package/lib/commonjs/ai-components/reasoning/thinkingClock.js +63 -0
- package/lib/commonjs/ai-components/reasoning/thinkingClock.js.map +1 -0
- package/lib/commonjs/ai-components/services/clipboard-service/expo.js +7 -2
- package/lib/commonjs/ai-components/services/clipboard-service/expo.js.map +1 -1
- package/lib/commonjs/ai-components/store/composer/store.js.map +1 -1
- package/lib/commonjs/ai-components/store/composer/useComposerChatOption.js +18 -0
- package/lib/commonjs/ai-components/store/composer/useComposerChatOption.js.map +1 -0
- package/lib/commonjs/ai-components/store/composer/useComposerIsEditing.js +18 -0
- package/lib/commonjs/ai-components/store/composer/useComposerIsEditing.js.map +1 -0
- package/lib/commonjs/ai-components/store/index.js +22 -0
- package/lib/commonjs/ai-components/store/index.js.map +1 -1
- package/lib/commonjs/ai-components/suggestions/AISuggestions.js +66 -0
- package/lib/commonjs/ai-components/suggestions/AISuggestions.js.map +1 -0
- package/lib/commonjs/ai-components/suggestions/index.js +15 -0
- package/lib/commonjs/ai-components/suggestions/index.js.map +1 -0
- package/lib/commonjs/ai-components/syntax-highlighting/utils/flatten-nodes.js +2 -1
- package/lib/commonjs/ai-components/syntax-highlighting/utils/flatten-nodes.js.map +1 -1
- package/lib/commonjs/ai-components/syntax-highlighting/utils/renderer.js +3 -2
- package/lib/commonjs/ai-components/syntax-highlighting/utils/renderer.js.map +1 -1
- package/lib/commonjs/ai-components/theme.js +137 -1
- package/lib/commonjs/ai-components/theme.js.map +1 -1
- package/lib/commonjs/ai-components/tool-calls/AIClientIdentity.js +22 -0
- package/lib/commonjs/ai-components/tool-calls/AIClientIdentity.js.map +1 -0
- package/lib/commonjs/ai-components/tool-calls/AIClientToolRunner.js +109 -0
- package/lib/commonjs/ai-components/tool-calls/AIClientToolRunner.js.map +1 -0
- package/lib/commonjs/ai-components/tool-calls/AIToolApprover.js +23 -0
- package/lib/commonjs/ai-components/tool-calls/AIToolApprover.js.map +1 -0
- package/lib/commonjs/ai-components/tool-calls/authSessionAuthorizer.js +88 -0
- package/lib/commonjs/ai-components/tool-calls/authSessionAuthorizer.js.map +1 -0
- package/lib/commonjs/ai-components/tool-calls/index.js +48 -0
- package/lib/commonjs/ai-components/tool-calls/index.js.map +1 -0
- package/lib/commonjs/ai-components/voice-visualization/glowShader.js.map +1 -1
- package/lib/commonjs/components/Accessibility/useAccessibilityAnnouncer.js.map +1 -1
- package/lib/commonjs/components/Message/MessageItemView/utils/renderText.js.map +1 -1
- package/lib/commonjs/contexts/translationContext/TranslationContext.js +2 -2
- package/lib/commonjs/contexts/translationContext/TranslationContext.js.map +1 -1
- package/lib/commonjs/i18n/ar.json +39 -1
- package/lib/commonjs/i18n/en.json +39 -1
- package/lib/commonjs/i18n/es.json +39 -1
- package/lib/commonjs/i18n/fr.json +39 -1
- package/lib/commonjs/i18n/he.json +39 -1
- package/lib/commonjs/i18n/hi.json +39 -1
- package/lib/commonjs/i18n/it.json +39 -1
- package/lib/commonjs/i18n/ja.json +39 -1
- package/lib/commonjs/i18n/ko.json +39 -1
- package/lib/commonjs/i18n/nl.json +39 -1
- package/lib/commonjs/i18n/pt-br.json +39 -1
- package/lib/commonjs/i18n/ru.json +39 -1
- package/lib/commonjs/i18n/tr.json +39 -1
- package/lib/commonjs/mock-builders/a2ui/ohrid.js +84 -0
- package/lib/commonjs/mock-builders/a2ui/ohrid.js.map +1 -0
- package/lib/commonjs/utils/i18n/Streami18n.js +9 -4
- package/lib/commonjs/utils/i18n/Streami18n.js.map +1 -1
- package/lib/commonjs/utils/i18n/utils.js +7 -0
- package/lib/commonjs/utils/i18n/utils.js.map +1 -0
- package/lib/commonjs/version.json +1 -1
- package/lib/module/a11y/a11yUtils.js.map +1 -1
- package/lib/module/a11y/hooks/useResolvedModalAccessibilityProps.js.map +1 -1
- package/lib/module/a2ui/A2UIContexts.js +8 -0
- package/lib/module/a2ui/A2UIContexts.js.map +1 -0
- package/lib/module/a2ui/A2UIInstructions.js +49 -0
- package/lib/module/a2ui/A2UIInstructions.js.map +1 -0
- package/lib/module/a2ui/A2UIPlaceholder.js +37 -0
- package/lib/module/a2ui/A2UIPlaceholder.js.map +1 -0
- package/lib/module/a2ui/A2UIRenderer.js +363 -0
- package/lib/module/a2ui/A2UIRenderer.js.map +1 -0
- package/lib/module/a2ui/A2UIStream.js +91 -0
- package/lib/module/a2ui/A2UIStream.js.map +1 -0
- package/lib/module/a2ui/A2UISurface.js +212 -0
- package/lib/module/a2ui/A2UISurface.js.map +1 -0
- package/lib/module/a2ui/basicCatalog.json +1206 -0
- package/lib/module/a2ui/basicFunctions.js +398 -0
- package/lib/module/a2ui/basicFunctions.js.map +1 -0
- package/lib/module/a2ui/catalogDocument.js +80 -0
- package/lib/module/a2ui/catalogDocument.js.map +1 -0
- package/lib/module/a2ui/catalogs.js +105 -0
- package/lib/module/a2ui/catalogs.js.map +1 -0
- package/lib/module/a2ui/components/DateTimeInput.js +445 -0
- package/lib/module/a2ui/components/DateTimeInput.js.map +1 -0
- package/lib/module/a2ui/components/Media.js +316 -0
- package/lib/module/a2ui/components/Media.js.map +1 -0
- package/lib/module/a2ui/components/basicComponents.js +975 -0
- package/lib/module/a2ui/components/basicComponents.js.map +1 -0
- package/lib/module/a2ui/components/iconPaths.js +66 -0
- package/lib/module/a2ui/components/iconPaths.js.map +1 -0
- package/lib/module/a2ui/components/types.js +4 -0
- package/lib/module/a2ui/components/types.js.map +1 -0
- package/lib/module/a2ui/index.js +70 -0
- package/lib/module/a2ui/index.js.map +1 -0
- package/lib/module/a2ui/instructions.js +268 -0
- package/lib/module/a2ui/instructions.js.map +1 -0
- package/lib/module/a2ui/secrets.js +169 -0
- package/lib/module/a2ui/secrets.js.map +1 -0
- package/lib/module/a2ui/useReplyState.js +35 -0
- package/lib/module/a2ui/useReplyState.js.map +1 -0
- package/lib/module/ai-components/AITypingIndicatorView.js +8 -18
- package/lib/module/ai-components/AITypingIndicatorView.js.map +1 -1
- package/lib/module/ai-components/README.md +55 -3
- package/lib/module/ai-components/StreamingMessageView.js +26 -0
- package/lib/module/ai-components/StreamingMessageView.js.map +1 -1
- package/lib/module/ai-components/charts/components/PieLegend.js +2 -1
- package/lib/module/ai-components/charts/components/PieLegend.js.map +1 -1
- package/lib/module/ai-components/charts/components/VictoryChart.js +7 -2
- package/lib/module/ai-components/charts/components/VictoryChart.js.map +1 -1
- package/lib/module/ai-components/charts/utils/format-time-label.js +15 -0
- package/lib/module/ai-components/charts/utils/format-time-label.js.map +1 -0
- package/lib/module/ai-components/charts/vega-lite/schema.js +17 -2
- package/lib/module/ai-components/charts/vega-lite/schema.js.map +1 -1
- package/lib/module/ai-components/contexts/composer-context.js +13 -6
- package/lib/module/ai-components/contexts/composer-context.js.map +1 -1
- package/lib/module/ai-components/contexts/index.js +11 -0
- package/lib/module/ai-components/contexts/index.js.map +1 -1
- package/lib/module/ai-components/contexts/theme-context.js +33 -2
- package/lib/module/ai-components/contexts/theme-context.js.map +1 -1
- package/lib/module/ai-components/contexts/translation-context.js +29 -0
- package/lib/module/ai-components/contexts/translation-context.js.map +1 -0
- package/lib/module/ai-components/conversation/AIConversation.js +366 -0
- package/lib/module/ai-components/conversation/AIConversation.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/AIAgentError.js +13 -0
- package/lib/module/ai-components/conversation/controller/AIAgentError.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/AIConversationController.js +425 -0
- package/lib/module/ai-components/conversation/controller/AIConversationController.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/AIConversationExchange.js +89 -0
- package/lib/module/ai-components/conversation/controller/AIConversationExchange.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/index.js +48 -0
- package/lib/module/ai-components/conversation/controller/index.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/offers.js +29 -0
- package/lib/module/ai-components/conversation/controller/offers.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/types.js +13 -0
- package/lib/module/ai-components/conversation/controller/types.js.map +1 -0
- package/lib/module/ai-components/conversation/controller/useAIConversationState.js +8 -0
- package/lib/module/ai-components/conversation/controller/useAIConversationState.js.map +1 -0
- package/lib/module/ai-components/conversation/entries.js +98 -0
- package/lib/module/ai-components/conversation/entries.js.map +1 -0
- package/lib/module/ai-components/conversation/fromStreamMessage.js +66 -0
- package/lib/module/ai-components/conversation/fromStreamMessage.js.map +1 -0
- package/lib/module/ai-components/conversation/index.js +48 -0
- package/lib/module/ai-components/conversation/index.js.map +1 -0
- package/lib/module/ai-components/conversation/list/AIChatList.js +224 -0
- package/lib/module/ai-components/conversation/list/AIChatList.js.map +1 -0
- package/lib/module/ai-components/conversation/list/useChatListController.js +78 -0
- package/lib/module/ai-components/conversation/list/useChatListController.js.map +1 -0
- package/lib/module/ai-components/conversation/list/useEndInView.js +51 -0
- package/lib/module/ai-components/conversation/list/useEndInView.js.map +1 -0
- package/lib/module/ai-components/conversation/list/useKeyboardOverlap.js +54 -0
- package/lib/module/ai-components/conversation/list/useKeyboardOverlap.js.map +1 -0
- package/lib/module/ai-components/conversation/list/useLoadOlder.js +73 -0
- package/lib/module/ai-components/conversation/list/useLoadOlder.js.map +1 -0
- package/lib/module/ai-components/conversation/list/usePinnedAnchor.js +84 -0
- package/lib/module/ai-components/conversation/list/usePinnedAnchor.js.map +1 -0
- package/lib/module/ai-components/conversation/types.js +4 -0
- package/lib/module/ai-components/conversation/types.js.map +1 -0
- package/lib/module/ai-components/conversation/useConversationRows.js +117 -0
- package/lib/module/ai-components/conversation/useConversationRows.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIAction.js +30 -0
- package/lib/module/ai-components/generative-ui/AIUIAction.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIArguments.js +128 -0
- package/lib/module/ai-components/generative-ui/AIUIArguments.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIComponent.js +50 -0
- package/lib/module/ai-components/generative-ui/AIUIComponent.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIComponentDefinition.js +134 -0
- package/lib/module/ai-components/generative-ui/AIUIComponentDefinition.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIDocument.js +32 -0
- package/lib/module/ai-components/generative-ui/AIUIDocument.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIEntrance.js +193 -0
- package/lib/module/ai-components/generative-ui/AIUIEntrance.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIErrorBoundary.js +30 -0
- package/lib/module/ai-components/generative-ui/AIUIErrorBoundary.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIHelpers.js +54 -0
- package/lib/module/ai-components/generative-ui/AIUIHelpers.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIHost.js +259 -0
- package/lib/module/ai-components/generative-ui/AIUIHost.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIMedia.js +24 -0
- package/lib/module/ai-components/generative-ui/AIUIMedia.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIRenderer.js +10 -0
- package/lib/module/ai-components/generative-ui/AIUIRenderer.js.map +1 -0
- package/lib/module/ai-components/generative-ui/AIUIView.js +57 -0
- package/lib/module/ai-components/generative-ui/AIUIView.js.map +1 -0
- package/lib/module/ai-components/generative-ui/index.js +181 -0
- package/lib/module/ai-components/generative-ui/index.js.map +1 -0
- package/lib/module/ai-components/icons.js +44 -0
- package/lib/module/ai-components/icons.js.map +1 -0
- package/lib/module/ai-components/index.js +96 -0
- package/lib/module/ai-components/index.js.map +1 -1
- package/lib/module/ai-components/internal/Shimmer.js +36 -0
- package/lib/module/ai-components/internal/Shimmer.js.map +1 -0
- package/lib/module/ai-components/internal/format.js +66 -0
- package/lib/module/ai-components/internal/format.js.map +1 -0
- package/lib/module/ai-components/internal/hooks/useBottomSafeArea.js +12 -0
- package/lib/module/ai-components/internal/hooks/useBottomSafeArea.js.map +1 -0
- package/lib/module/ai-components/internal/icons/AgentIcons.js +74 -0
- package/lib/module/ai-components/internal/icons/AgentIcons.js.map +1 -0
- package/lib/module/ai-components/internal/tokens.js +11 -0
- package/lib/module/ai-components/internal/tokens.js.map +1 -0
- package/lib/module/ai-components/internal/uuid.js +21 -0
- package/lib/module/ai-components/internal/uuid.js.map +1 -0
- package/lib/module/ai-components/markdown/components/CodeBlock.js +4 -2
- package/lib/module/ai-components/markdown/components/CodeBlock.js.map +1 -1
- package/lib/module/ai-components/markdown/components/InlineCode.js +1 -0
- package/lib/module/ai-components/markdown/components/InlineCode.js.map +1 -1
- package/lib/module/ai-components/markdown/components/Text.js +11 -2
- package/lib/module/ai-components/markdown/components/Text.js.map +1 -1
- package/lib/module/ai-components/markdown/styles.js +27 -29
- package/lib/module/ai-components/markdown/styles.js.map +1 -1
- package/lib/module/ai-components/message/AIAssistantMessage.js +63 -0
- package/lib/module/ai-components/message/AIAssistantMessage.js.map +1 -0
- package/lib/module/ai-components/message/AIMessageAttachment.js +189 -0
- package/lib/module/ai-components/message/AIMessageAttachment.js.map +1 -0
- package/lib/module/ai-components/message/AIReplyActions.js +132 -0
- package/lib/module/ai-components/message/AIReplyActions.js.map +1 -0
- package/lib/module/ai-components/message/AIUserMessage.js +104 -0
- package/lib/module/ai-components/message/AIUserMessage.js.map +1 -0
- package/lib/module/ai-components/message/UserMessageMenu.js +150 -0
- package/lib/module/ai-components/message/UserMessageMenu.js.map +1 -0
- package/lib/module/ai-components/message/index.js +48 -0
- package/lib/module/ai-components/message/index.js.map +1 -0
- package/lib/module/ai-components/message-composer/ActionButton.js +2 -1
- package/lib/module/ai-components/message-composer/ActionButton.js.map +1 -1
- package/lib/module/ai-components/message-composer/ActionSheet.js +22 -6
- package/lib/module/ai-components/message-composer/ActionSheet.js.map +1 -1
- package/lib/module/ai-components/message-composer/AttachmentButton.js +5 -1
- package/lib/module/ai-components/message-composer/AttachmentButton.js.map +1 -1
- package/lib/module/ai-components/message-composer/ChatOptions.js +147 -0
- package/lib/module/ai-components/message-composer/ChatOptions.js.map +1 -0
- package/lib/module/ai-components/message-composer/ComposerView.js +136 -20
- package/lib/module/ai-components/message-composer/ComposerView.js.map +1 -1
- package/lib/module/ai-components/message-composer/EditingMessageChip.js +80 -0
- package/lib/module/ai-components/message-composer/EditingMessageChip.js.map +1 -0
- package/lib/module/ai-components/message-composer/MediaPreviewList.js +26 -1
- package/lib/module/ai-components/message-composer/MediaPreviewList.js.map +1 -1
- package/lib/module/ai-components/message-composer/index.js +11 -0
- package/lib/module/ai-components/message-composer/index.js.map +1 -1
- package/lib/module/ai-components/message-parts/AIMessageParts.js +110 -0
- package/lib/module/ai-components/message-parts/AIMessageParts.js.map +1 -0
- package/lib/module/ai-components/message-parts/AIToolApproval.js +197 -0
- package/lib/module/ai-components/message-parts/AIToolApproval.js.map +1 -0
- package/lib/module/ai-components/message-parts/AIToolAuthorization.js +250 -0
- package/lib/module/ai-components/message-parts/AIToolAuthorization.js.map +1 -0
- package/lib/module/ai-components/message-parts/AIToolCall.js +159 -0
- package/lib/module/ai-components/message-parts/AIToolCall.js.map +1 -0
- package/lib/module/ai-components/message-parts/callStates.js +54 -0
- package/lib/module/ai-components/message-parts/callStates.js.map +1 -0
- package/lib/module/ai-components/message-parts/index.js +70 -0
- package/lib/module/ai-components/message-parts/index.js.map +1 -0
- package/lib/module/ai-components/message-parts/parseMessageParts.js +126 -0
- package/lib/module/ai-components/message-parts/parseMessageParts.js.map +1 -0
- package/lib/module/ai-components/message-parts/types.js +2 -0
- package/lib/module/ai-components/message-parts/types.js.map +1 -0
- package/lib/module/ai-components/native-specs/NativeAIAgent.js +7 -0
- package/lib/module/ai-components/native-specs/NativeAIAgent.js.map +1 -0
- package/lib/module/ai-components/reasoning/AIReasoning.js +401 -0
- package/lib/module/ai-components/reasoning/AIReasoning.js.map +1 -0
- package/lib/module/ai-components/reasoning/index.js +26 -0
- package/lib/module/ai-components/reasoning/index.js.map +1 -0
- package/lib/module/ai-components/reasoning/thinkingClock.js +63 -0
- package/lib/module/ai-components/reasoning/thinkingClock.js.map +1 -0
- package/lib/module/ai-components/services/clipboard-service/expo.js +7 -2
- package/lib/module/ai-components/services/clipboard-service/expo.js.map +1 -1
- package/lib/module/ai-components/store/composer/store.js.map +1 -1
- package/lib/module/ai-components/store/composer/useComposerChatOption.js +18 -0
- package/lib/module/ai-components/store/composer/useComposerChatOption.js.map +1 -0
- package/lib/module/ai-components/store/composer/useComposerIsEditing.js +18 -0
- package/lib/module/ai-components/store/composer/useComposerIsEditing.js.map +1 -0
- package/lib/module/ai-components/store/index.js +22 -0
- package/lib/module/ai-components/store/index.js.map +1 -1
- package/lib/module/ai-components/suggestions/AISuggestions.js +66 -0
- package/lib/module/ai-components/suggestions/AISuggestions.js.map +1 -0
- package/lib/module/ai-components/suggestions/index.js +15 -0
- package/lib/module/ai-components/suggestions/index.js.map +1 -0
- package/lib/module/ai-components/syntax-highlighting/utils/flatten-nodes.js +2 -1
- package/lib/module/ai-components/syntax-highlighting/utils/flatten-nodes.js.map +1 -1
- package/lib/module/ai-components/syntax-highlighting/utils/renderer.js +3 -2
- package/lib/module/ai-components/syntax-highlighting/utils/renderer.js.map +1 -1
- package/lib/module/ai-components/theme.js +137 -1
- package/lib/module/ai-components/theme.js.map +1 -1
- package/lib/module/ai-components/tool-calls/AIClientIdentity.js +22 -0
- package/lib/module/ai-components/tool-calls/AIClientIdentity.js.map +1 -0
- package/lib/module/ai-components/tool-calls/AIClientToolRunner.js +109 -0
- package/lib/module/ai-components/tool-calls/AIClientToolRunner.js.map +1 -0
- package/lib/module/ai-components/tool-calls/AIToolApprover.js +23 -0
- package/lib/module/ai-components/tool-calls/AIToolApprover.js.map +1 -0
- package/lib/module/ai-components/tool-calls/authSessionAuthorizer.js +88 -0
- package/lib/module/ai-components/tool-calls/authSessionAuthorizer.js.map +1 -0
- package/lib/module/ai-components/tool-calls/index.js +48 -0
- package/lib/module/ai-components/tool-calls/index.js.map +1 -0
- package/lib/module/ai-components/voice-visualization/glowShader.js.map +1 -1
- package/lib/module/components/Accessibility/useAccessibilityAnnouncer.js.map +1 -1
- package/lib/module/components/Message/MessageItemView/utils/renderText.js.map +1 -1
- package/lib/module/contexts/translationContext/TranslationContext.js +2 -2
- package/lib/module/contexts/translationContext/TranslationContext.js.map +1 -1
- package/lib/module/i18n/ar.json +39 -1
- package/lib/module/i18n/en.json +39 -1
- package/lib/module/i18n/es.json +39 -1
- package/lib/module/i18n/fr.json +39 -1
- package/lib/module/i18n/he.json +39 -1
- package/lib/module/i18n/hi.json +39 -1
- package/lib/module/i18n/it.json +39 -1
- package/lib/module/i18n/ja.json +39 -1
- package/lib/module/i18n/ko.json +39 -1
- package/lib/module/i18n/nl.json +39 -1
- package/lib/module/i18n/pt-br.json +39 -1
- package/lib/module/i18n/ru.json +39 -1
- package/lib/module/i18n/tr.json +39 -1
- package/lib/module/mock-builders/a2ui/ohrid.js +84 -0
- package/lib/module/mock-builders/a2ui/ohrid.js.map +1 -0
- package/lib/module/utils/i18n/Streami18n.js +9 -4
- package/lib/module/utils/i18n/Streami18n.js.map +1 -1
- package/lib/module/utils/i18n/utils.js +7 -0
- package/lib/module/utils/i18n/utils.js.map +1 -0
- package/lib/module/version.json +1 -1
- package/lib/typescript/a11y/a11yUtils.d.ts +0 -1
- package/lib/typescript/a11y/a11yUtils.d.ts.map +1 -1
- package/lib/typescript/a11y/hooks/useResolvedModalAccessibilityProps.d.ts +2 -3
- package/lib/typescript/a11y/hooks/useResolvedModalAccessibilityProps.d.ts.map +1 -1
- package/lib/typescript/a2ui/A2UIContexts.d.ts +9 -0
- package/lib/typescript/a2ui/A2UIContexts.d.ts.map +1 -0
- package/lib/typescript/a2ui/A2UIInstructions.d.ts +47 -0
- package/lib/typescript/a2ui/A2UIInstructions.d.ts.map +1 -0
- package/lib/typescript/a2ui/A2UIPlaceholder.d.ts +4 -0
- package/lib/typescript/a2ui/A2UIPlaceholder.d.ts.map +1 -0
- package/lib/typescript/a2ui/A2UIRenderer.d.ts +130 -0
- package/lib/typescript/a2ui/A2UIRenderer.d.ts.map +1 -0
- package/lib/typescript/a2ui/A2UIStream.d.ts +23 -0
- package/lib/typescript/a2ui/A2UIStream.d.ts.map +1 -0
- package/lib/typescript/a2ui/A2UISurface.d.ts +19 -0
- package/lib/typescript/a2ui/A2UISurface.d.ts.map +1 -0
- package/lib/typescript/a2ui/basicFunctions.d.ts +10 -0
- package/lib/typescript/a2ui/basicFunctions.d.ts.map +1 -0
- package/lib/typescript/a2ui/catalogDocument.d.ts +56 -0
- package/lib/typescript/a2ui/catalogDocument.d.ts.map +1 -0
- package/lib/typescript/a2ui/catalogs.d.ts +42 -0
- package/lib/typescript/a2ui/catalogs.d.ts.map +1 -0
- package/lib/typescript/a2ui/components/DateTimeInput.d.ts +44 -0
- package/lib/typescript/a2ui/components/DateTimeInput.d.ts.map +1 -0
- package/lib/typescript/a2ui/components/Media.d.ts +27 -0
- package/lib/typescript/a2ui/components/Media.d.ts.map +1 -0
- package/lib/typescript/a2ui/components/basicComponents.d.ts +4 -0
- package/lib/typescript/a2ui/components/basicComponents.d.ts.map +1 -0
- package/lib/typescript/a2ui/components/iconPaths.d.ts +2 -0
- package/lib/typescript/a2ui/components/iconPaths.d.ts.map +1 -0
- package/lib/typescript/a2ui/components/types.d.ts +23 -0
- package/lib/typescript/a2ui/components/types.d.ts.map +1 -0
- package/lib/typescript/a2ui/index.d.ts +8 -0
- package/lib/typescript/a2ui/index.d.ts.map +1 -0
- package/lib/typescript/a2ui/instructions.d.ts +39 -0
- package/lib/typescript/a2ui/instructions.d.ts.map +1 -0
- package/lib/typescript/a2ui/secrets.d.ts +20 -0
- package/lib/typescript/a2ui/secrets.d.ts.map +1 -0
- package/lib/typescript/a2ui/useReplyState.d.ts +4 -0
- package/lib/typescript/a2ui/useReplyState.d.ts.map +1 -0
- package/lib/typescript/ai-components/AITypingIndicatorView.d.ts.map +1 -1
- package/lib/typescript/ai-components/StreamingMessageView.d.ts +4 -1
- package/lib/typescript/ai-components/StreamingMessageView.d.ts.map +1 -1
- package/lib/typescript/ai-components/charts/components/PieLegend.d.ts.map +1 -1
- package/lib/typescript/ai-components/charts/components/VictoryChart.d.ts.map +1 -1
- package/lib/typescript/ai-components/charts/utils/format-time-label.d.ts +7 -0
- package/lib/typescript/ai-components/charts/utils/format-time-label.d.ts.map +1 -0
- package/lib/typescript/ai-components/charts/vega-lite/schema.d.ts +8 -8
- package/lib/typescript/ai-components/charts/vega-lite/schema.d.ts.map +1 -1
- package/lib/typescript/ai-components/contexts/composer-context.d.ts +3 -0
- package/lib/typescript/ai-components/contexts/composer-context.d.ts.map +1 -1
- package/lib/typescript/ai-components/contexts/index.d.ts +1 -0
- package/lib/typescript/ai-components/contexts/index.d.ts.map +1 -1
- package/lib/typescript/ai-components/contexts/theme-context.d.ts.map +1 -1
- package/lib/typescript/ai-components/contexts/translation-context.d.ts +19 -0
- package/lib/typescript/ai-components/contexts/translation-context.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/AIConversation.d.ts +130 -0
- package/lib/typescript/ai-components/conversation/AIConversation.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/AIAgentError.d.ts +10 -0
- package/lib/typescript/ai-components/conversation/controller/AIAgentError.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/AIConversationController.d.ts +173 -0
- package/lib/typescript/ai-components/conversation/controller/AIConversationController.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/AIConversationExchange.d.ts +23 -0
- package/lib/typescript/ai-components/conversation/controller/AIConversationExchange.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/index.d.ts +5 -0
- package/lib/typescript/ai-components/conversation/controller/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/offers.d.ts +23 -0
- package/lib/typescript/ai-components/conversation/controller/offers.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/types.d.ts +142 -0
- package/lib/typescript/ai-components/conversation/controller/types.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/controller/useAIConversationState.d.ts +9 -0
- package/lib/typescript/ai-components/conversation/controller/useAIConversationState.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/entries.d.ts +47 -0
- package/lib/typescript/ai-components/conversation/entries.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/fromStreamMessage.d.ts +25 -0
- package/lib/typescript/ai-components/conversation/fromStreamMessage.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/index.d.ts +6 -0
- package/lib/typescript/ai-components/conversation/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/AIChatList.d.ts +30 -0
- package/lib/typescript/ai-components/conversation/list/AIChatList.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/useChatListController.d.ts +45 -0
- package/lib/typescript/ai-components/conversation/list/useChatListController.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/useEndInView.d.ts +26 -0
- package/lib/typescript/ai-components/conversation/list/useEndInView.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/useKeyboardOverlap.d.ts +17 -0
- package/lib/typescript/ai-components/conversation/list/useKeyboardOverlap.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/useLoadOlder.d.ts +24 -0
- package/lib/typescript/ai-components/conversation/list/useLoadOlder.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/list/usePinnedAnchor.d.ts +26 -0
- package/lib/typescript/ai-components/conversation/list/usePinnedAnchor.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/types.d.ts +55 -0
- package/lib/typescript/ai-components/conversation/types.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation/useConversationRows.d.ts +66 -0
- package/lib/typescript/ai-components/conversation/useConversationRows.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIAction.d.ts +48 -0
- package/lib/typescript/ai-components/generative-ui/AIUIAction.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIArguments.d.ts +15 -0
- package/lib/typescript/ai-components/generative-ui/AIUIArguments.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIComponent.d.ts +51 -0
- package/lib/typescript/ai-components/generative-ui/AIUIComponent.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIComponentDefinition.d.ts +84 -0
- package/lib/typescript/ai-components/generative-ui/AIUIComponentDefinition.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIDocument.d.ts +50 -0
- package/lib/typescript/ai-components/generative-ui/AIUIDocument.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIEntrance.d.ts +75 -0
- package/lib/typescript/ai-components/generative-ui/AIUIEntrance.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIErrorBoundary.d.ts +26 -0
- package/lib/typescript/ai-components/generative-ui/AIUIErrorBoundary.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIHelpers.d.ts +23 -0
- package/lib/typescript/ai-components/generative-ui/AIUIHelpers.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIHost.d.ts +160 -0
- package/lib/typescript/ai-components/generative-ui/AIUIHost.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIMedia.d.ts +22 -0
- package/lib/typescript/ai-components/generative-ui/AIUIMedia.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIRenderer.d.ts +53 -0
- package/lib/typescript/ai-components/generative-ui/AIUIRenderer.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/AIUIView.d.ts +35 -0
- package/lib/typescript/ai-components/generative-ui/AIUIView.d.ts.map +1 -0
- package/lib/typescript/ai-components/generative-ui/index.d.ts +11 -0
- package/lib/typescript/ai-components/generative-ui/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/icons.d.ts +66 -0
- package/lib/typescript/ai-components/icons.d.ts.map +1 -0
- package/lib/typescript/ai-components/index.d.ts +8 -0
- package/lib/typescript/ai-components/index.d.ts.map +1 -1
- package/lib/typescript/ai-components/internal/Shimmer.d.ts +14 -0
- package/lib/typescript/ai-components/internal/Shimmer.d.ts.map +1 -0
- package/lib/typescript/ai-components/internal/format.d.ts +7 -0
- package/lib/typescript/ai-components/internal/format.d.ts.map +1 -0
- package/lib/typescript/ai-components/internal/hooks/useBottomSafeArea.d.ts +3 -0
- package/lib/typescript/ai-components/internal/hooks/useBottomSafeArea.d.ts.map +1 -0
- package/lib/typescript/ai-components/internal/icons/AgentIcons.d.ts +31 -0
- package/lib/typescript/ai-components/internal/icons/AgentIcons.d.ts.map +1 -0
- package/lib/typescript/ai-components/internal/tokens.d.ts +2 -0
- package/lib/typescript/ai-components/internal/tokens.d.ts.map +1 -0
- package/lib/typescript/ai-components/internal/uuid.d.ts +2 -0
- package/lib/typescript/ai-components/internal/uuid.d.ts.map +1 -0
- package/lib/typescript/ai-components/markdown/components/CodeBlock.d.ts.map +1 -1
- package/lib/typescript/ai-components/markdown/components/InlineCode.d.ts.map +1 -1
- package/lib/typescript/ai-components/markdown/components/Text.d.ts.map +1 -1
- package/lib/typescript/ai-components/markdown/styles.d.ts +23 -4
- package/lib/typescript/ai-components/markdown/styles.d.ts.map +1 -1
- package/lib/typescript/ai-components/markdown/types.d.ts +1 -0
- package/lib/typescript/ai-components/markdown/types.d.ts.map +1 -1
- package/lib/typescript/ai-components/message/AIAssistantMessage.d.ts +40 -0
- package/lib/typescript/ai-components/message/AIAssistantMessage.d.ts.map +1 -0
- package/lib/typescript/ai-components/message/AIMessageAttachment.d.ts +33 -0
- package/lib/typescript/ai-components/message/AIMessageAttachment.d.ts.map +1 -0
- package/lib/typescript/ai-components/message/AIReplyActions.d.ts +19 -0
- package/lib/typescript/ai-components/message/AIReplyActions.d.ts.map +1 -0
- package/lib/typescript/ai-components/message/AIUserMessage.d.ts +17 -0
- package/lib/typescript/ai-components/message/AIUserMessage.d.ts.map +1 -0
- package/lib/typescript/ai-components/message/UserMessageMenu.d.ts +31 -0
- package/lib/typescript/ai-components/message/UserMessageMenu.d.ts.map +1 -0
- package/lib/typescript/ai-components/message/index.d.ts +5 -0
- package/lib/typescript/ai-components/message/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-composer/ActionButton.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-composer/ActionSheet.d.ts +2 -2
- package/lib/typescript/ai-components/message-composer/ActionSheet.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-composer/AttachmentButton.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-composer/ChatOptions.d.ts +35 -0
- package/lib/typescript/ai-components/message-composer/ChatOptions.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-composer/ComposerView.d.ts +34 -3
- package/lib/typescript/ai-components/message-composer/ComposerView.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-composer/EditingMessageChip.d.ts +7 -0
- package/lib/typescript/ai-components/message-composer/EditingMessageChip.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-composer/MediaPreviewList.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-composer/index.d.ts +1 -0
- package/lib/typescript/ai-components/message-composer/index.d.ts.map +1 -1
- package/lib/typescript/ai-components/message-parts/AIMessageParts.d.ts +38 -0
- package/lib/typescript/ai-components/message-parts/AIMessageParts.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/AIToolApproval.d.ts +38 -0
- package/lib/typescript/ai-components/message-parts/AIToolApproval.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/AIToolAuthorization.d.ts +48 -0
- package/lib/typescript/ai-components/message-parts/AIToolAuthorization.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/AIToolCall.d.ts +11 -0
- package/lib/typescript/ai-components/message-parts/AIToolCall.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/callStates.d.ts +9 -0
- package/lib/typescript/ai-components/message-parts/callStates.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/index.d.ts +7 -0
- package/lib/typescript/ai-components/message-parts/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/parseMessageParts.d.ts +47 -0
- package/lib/typescript/ai-components/message-parts/parseMessageParts.d.ts.map +1 -0
- package/lib/typescript/ai-components/message-parts/types.d.ts +137 -0
- package/lib/typescript/ai-components/message-parts/types.d.ts.map +1 -0
- package/lib/typescript/ai-components/native-specs/NativeAIAgent.d.ts +22 -0
- package/lib/typescript/ai-components/native-specs/NativeAIAgent.d.ts.map +1 -0
- package/lib/typescript/ai-components/reasoning/AIReasoning.d.ts +63 -0
- package/lib/typescript/ai-components/reasoning/AIReasoning.d.ts.map +1 -0
- package/lib/typescript/ai-components/reasoning/index.d.ts +3 -0
- package/lib/typescript/ai-components/reasoning/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/reasoning/thinkingClock.d.ts +29 -0
- package/lib/typescript/ai-components/reasoning/thinkingClock.d.ts.map +1 -0
- package/lib/typescript/ai-components/services/clipboard-service/expo.d.ts.map +1 -1
- package/lib/typescript/ai-components/store/composer/store.d.ts +8 -0
- package/lib/typescript/ai-components/store/composer/store.d.ts.map +1 -1
- package/lib/typescript/ai-components/store/composer/useComposerChatOption.d.ts +5 -0
- package/lib/typescript/ai-components/store/composer/useComposerChatOption.d.ts.map +1 -0
- package/lib/typescript/ai-components/store/composer/useComposerIsEditing.d.ts +5 -0
- package/lib/typescript/ai-components/store/composer/useComposerIsEditing.d.ts.map +1 -0
- package/lib/typescript/ai-components/store/index.d.ts +2 -0
- package/lib/typescript/ai-components/store/index.d.ts.map +1 -1
- package/lib/typescript/ai-components/suggestions/AISuggestions.d.ts +13 -0
- package/lib/typescript/ai-components/suggestions/AISuggestions.d.ts.map +1 -0
- package/lib/typescript/ai-components/suggestions/index.d.ts +2 -0
- package/lib/typescript/ai-components/suggestions/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/syntax-highlighting/utils/flatten-nodes.d.ts.map +1 -1
- package/lib/typescript/ai-components/syntax-highlighting/utils/renderer.d.ts +1 -1
- package/lib/typescript/ai-components/syntax-highlighting/utils/renderer.d.ts.map +1 -1
- package/lib/typescript/ai-components/theme.d.ts +200 -0
- package/lib/typescript/ai-components/theme.d.ts.map +1 -1
- package/lib/typescript/ai-components/tool-calls/AIClientIdentity.d.ts +14 -0
- package/lib/typescript/ai-components/tool-calls/AIClientIdentity.d.ts.map +1 -0
- package/lib/typescript/ai-components/tool-calls/AIClientToolRunner.d.ts +109 -0
- package/lib/typescript/ai-components/tool-calls/AIClientToolRunner.d.ts.map +1 -0
- package/lib/typescript/ai-components/tool-calls/AIToolApprover.d.ts +48 -0
- package/lib/typescript/ai-components/tool-calls/AIToolApprover.d.ts.map +1 -0
- package/lib/typescript/ai-components/tool-calls/authSessionAuthorizer.d.ts +57 -0
- package/lib/typescript/ai-components/tool-calls/authSessionAuthorizer.d.ts.map +1 -0
- package/lib/typescript/ai-components/tool-calls/index.d.ts +5 -0
- package/lib/typescript/ai-components/tool-calls/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/voice-visualization/glowShader.d.ts.map +1 -1
- package/lib/typescript/ai-components/voice-visualization/simplex.d.ts +1 -1
- package/lib/typescript/components/Accessibility/NotificationAnnouncer.d.ts +5 -5
- package/lib/typescript/components/Accessibility/hooks/useIncomingMessageAnnouncements.d.ts +1 -1
- package/lib/typescript/components/Accessibility/useAccessibilityAnnouncer.d.ts +0 -2
- package/lib/typescript/components/Accessibility/useAccessibilityAnnouncer.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageItemView/utils/renderText.d.ts.map +1 -1
- package/lib/typescript/contexts/translationContext/TranslationContext.d.ts +1 -1
- package/lib/typescript/contexts/translationContext/TranslationContext.d.ts.map +1 -1
- package/lib/typescript/i18n/ar.json +39 -1
- package/lib/typescript/i18n/en.json +39 -1
- package/lib/typescript/i18n/es.json +39 -1
- package/lib/typescript/i18n/fr.json +39 -1
- package/lib/typescript/i18n/he.json +39 -1
- package/lib/typescript/i18n/hi.json +39 -1
- package/lib/typescript/i18n/it.json +39 -1
- package/lib/typescript/i18n/ja.json +39 -1
- package/lib/typescript/i18n/ko.json +39 -1
- package/lib/typescript/i18n/nl.json +39 -1
- package/lib/typescript/i18n/pt-br.json +39 -1
- package/lib/typescript/i18n/ru.json +39 -1
- package/lib/typescript/i18n/tr.json +39 -1
- package/lib/typescript/utils/i18n/Streami18n.d.ts +40 -2
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
- package/lib/typescript/utils/i18n/utils.d.ts +3 -0
- package/lib/typescript/utils/i18n/utils.d.ts.map +1 -0
- package/package.json +10 -2
- package/src/a11y/a11yUtils.ts +0 -1
- package/src/a11y/hooks/useResolvedModalAccessibilityProps.ts +2 -3
- package/src/a2ui/A2UIContexts.ts +15 -0
- package/src/a2ui/A2UIInstructions.ts +102 -0
- package/src/a2ui/A2UIPlaceholder.tsx +24 -0
- package/src/a2ui/A2UIRenderer.tsx +504 -0
- package/src/a2ui/A2UIStream.ts +105 -0
- package/src/a2ui/A2UISurface.tsx +241 -0
- package/src/a2ui/__tests__/A2UIInstructions.test.ts +233 -0
- package/src/a2ui/__tests__/A2UIRenderer.test.tsx +1514 -0
- package/src/a2ui/__tests__/conformance.test.ts +579 -0
- package/src/a2ui/basicCatalog.json +1206 -0
- package/src/a2ui/basicFunctions.ts +429 -0
- package/src/a2ui/catalogDocument.ts +119 -0
- package/src/a2ui/catalogs.ts +185 -0
- package/src/a2ui/components/DateTimeInput.tsx +381 -0
- package/src/a2ui/components/Media.tsx +278 -0
- package/src/a2ui/components/basicComponents.tsx +832 -0
- package/src/a2ui/components/iconPaths.ts +116 -0
- package/src/a2ui/components/types.ts +24 -0
- package/src/a2ui/index.ts +18 -0
- package/src/a2ui/instructions.ts +341 -0
- package/src/a2ui/secrets.ts +154 -0
- package/src/a2ui/useReplyState.ts +26 -0
- package/src/ai-components/AITypingIndicatorView.tsx +6 -22
- package/src/ai-components/README.md +55 -3
- package/src/ai-components/StreamingMessageView.tsx +27 -3
- package/src/ai-components/__tests__/ComposerView.test.tsx +227 -2
- package/src/ai-components/__tests__/Markdown.test.tsx +13 -0
- package/src/ai-components/__tests__/StreamingMessageView.test.tsx +69 -0
- package/src/ai-components/__tests__/charts.test.ts +75 -0
- package/src/ai-components/__tests__/clientToolRunner.test.ts +239 -0
- package/src/ai-components/__tests__/conversation.test.tsx +705 -0
- package/src/ai-components/__tests__/conversationController.test.ts +1561 -0
- package/src/ai-components/__tests__/conversationExchange.test.ts +187 -0
- package/src/ai-components/__tests__/conversationRows.test.ts +207 -0
- package/src/ai-components/__tests__/conversationUI.test.tsx +586 -0
- package/src/ai-components/__tests__/format.test.ts +32 -0
- package/src/ai-components/__tests__/generativeUI.test.ts +634 -0
- package/src/ai-components/__tests__/keyboard.test.ts +14 -0
- package/src/ai-components/__tests__/messagePartViews.test.tsx +343 -0
- package/src/ai-components/__tests__/messageParts.test.ts +336 -0
- package/src/ai-components/__tests__/messageViews.test.tsx +321 -0
- package/src/ai-components/__tests__/signIn.test.tsx +324 -0
- package/src/ai-components/__tests__/theme.test.tsx +18 -0
- package/src/ai-components/__tests__/translation.test.tsx +85 -0
- package/src/ai-components/__tests__/voiceDriver.test.ts +0 -3
- package/src/ai-components/__tests__/voicePalette.test.ts +1 -1
- package/src/ai-components/charts/components/PieLegend.tsx +2 -1
- package/src/ai-components/charts/components/VictoryChart.tsx +10 -2
- package/src/ai-components/charts/utils/format-time-label.ts +18 -0
- package/src/ai-components/charts/vega-lite/schema.ts +19 -2
- package/src/ai-components/contexts/composer-context.tsx +13 -5
- package/src/ai-components/contexts/index.ts +1 -0
- package/src/ai-components/contexts/theme-context.tsx +19 -4
- package/src/ai-components/contexts/translation-context.tsx +44 -0
- package/src/ai-components/conversation/AIConversation.tsx +590 -0
- package/src/ai-components/conversation/controller/AIAgentError.ts +14 -0
- package/src/ai-components/conversation/controller/AIConversationController.ts +623 -0
- package/src/ai-components/conversation/controller/AIConversationExchange.ts +132 -0
- package/src/ai-components/conversation/controller/index.ts +4 -0
- package/src/ai-components/conversation/controller/offers.ts +43 -0
- package/src/ai-components/conversation/controller/types.ts +154 -0
- package/src/ai-components/conversation/controller/useAIConversationState.ts +21 -0
- package/src/ai-components/conversation/entries.ts +177 -0
- package/src/ai-components/conversation/fromStreamMessage.ts +87 -0
- package/src/ai-components/conversation/index.ts +5 -0
- package/src/ai-components/conversation/list/AIChatList.tsx +227 -0
- package/src/ai-components/conversation/list/useChatListController.ts +91 -0
- package/src/ai-components/conversation/list/useEndInView.ts +61 -0
- package/src/ai-components/conversation/list/useKeyboardOverlap.ts +51 -0
- package/src/ai-components/conversation/list/useLoadOlder.ts +97 -0
- package/src/ai-components/conversation/list/usePinnedAnchor.ts +113 -0
- package/src/ai-components/conversation/types.ts +57 -0
- package/src/ai-components/conversation/useConversationRows.ts +230 -0
- package/src/ai-components/generative-ui/AIUIAction.ts +73 -0
- package/src/ai-components/generative-ui/AIUIArguments.ts +117 -0
- package/src/ai-components/generative-ui/AIUIComponent.tsx +106 -0
- package/src/ai-components/generative-ui/AIUIComponentDefinition.ts +163 -0
- package/src/ai-components/generative-ui/AIUIDocument.ts +77 -0
- package/src/ai-components/generative-ui/AIUIEntrance.tsx +223 -0
- package/src/ai-components/generative-ui/AIUIErrorBoundary.tsx +39 -0
- package/src/ai-components/generative-ui/AIUIHelpers.ts +86 -0
- package/src/ai-components/generative-ui/AIUIHost.ts +358 -0
- package/src/ai-components/generative-ui/AIUIMedia.ts +45 -0
- package/src/ai-components/generative-ui/AIUIRenderer.ts +60 -0
- package/src/ai-components/generative-ui/AIUIView.tsx +87 -0
- package/src/ai-components/generative-ui/index.ts +48 -0
- package/src/ai-components/icons.ts +101 -0
- package/src/ai-components/index.ts +10 -0
- package/src/ai-components/internal/Shimmer.tsx +40 -0
- package/src/ai-components/internal/format.ts +69 -0
- package/src/ai-components/internal/hooks/useBottomSafeArea.ts +6 -0
- package/src/ai-components/internal/icons/AgentIcons.tsx +138 -0
- package/src/ai-components/internal/tokens.ts +4 -0
- package/src/ai-components/internal/uuid.ts +17 -0
- package/src/ai-components/markdown/components/CodeBlock.tsx +13 -2
- package/src/ai-components/markdown/components/InlineCode.tsx +1 -0
- package/src/ai-components/markdown/components/Text.tsx +7 -2
- package/src/ai-components/markdown/styles.ts +29 -27
- package/src/ai-components/markdown/types.ts +1 -0
- package/src/ai-components/message/AIAssistantMessage.tsx +99 -0
- package/src/ai-components/message/AIMessageAttachment.tsx +245 -0
- package/src/ai-components/message/AIReplyActions.tsx +139 -0
- package/src/ai-components/message/AIUserMessage.tsx +121 -0
- package/src/ai-components/message/UserMessageMenu.tsx +149 -0
- package/src/ai-components/message/index.ts +4 -0
- package/src/ai-components/message-composer/ActionButton.tsx +5 -1
- package/src/ai-components/message-composer/ActionSheet.tsx +28 -6
- package/src/ai-components/message-composer/AttachmentButton.tsx +9 -1
- package/src/ai-components/message-composer/ChatOptions.tsx +144 -0
- package/src/ai-components/message-composer/ComposerView.tsx +179 -29
- package/src/ai-components/message-composer/EditingMessageChip.tsx +61 -0
- package/src/ai-components/message-composer/MediaPreviewList.tsx +34 -8
- package/src/ai-components/message-composer/index.ts +1 -0
- package/src/ai-components/message-parts/AIMessageParts.tsx +120 -0
- package/src/ai-components/message-parts/AIToolApproval.tsx +196 -0
- package/src/ai-components/message-parts/AIToolAuthorization.tsx +279 -0
- package/src/ai-components/message-parts/AIToolCall.tsx +117 -0
- package/src/ai-components/message-parts/callStates.ts +44 -0
- package/src/ai-components/message-parts/index.ts +6 -0
- package/src/ai-components/message-parts/parseMessageParts.ts +195 -0
- package/src/ai-components/message-parts/types.ts +157 -0
- package/src/ai-components/native-specs/NativeAIAgent.ts +25 -0
- package/src/ai-components/reasoning/AIReasoning.tsx +509 -0
- package/src/ai-components/reasoning/index.ts +2 -0
- package/src/ai-components/reasoning/thinkingClock.ts +109 -0
- package/src/ai-components/services/clipboard-service/expo.ts +18 -4
- package/src/ai-components/store/composer/store.ts +9 -0
- package/src/ai-components/store/composer/useComposerChatOption.ts +15 -0
- package/src/ai-components/store/composer/useComposerIsEditing.ts +15 -0
- package/src/ai-components/store/index.ts +2 -0
- package/src/ai-components/suggestions/AISuggestions.tsx +73 -0
- package/src/ai-components/suggestions/index.ts +1 -0
- package/src/ai-components/syntax-highlighting/utils/flatten-nodes.ts +2 -1
- package/src/ai-components/syntax-highlighting/utils/renderer.tsx +4 -2
- package/src/ai-components/theme.ts +334 -0
- package/src/ai-components/tool-calls/AIClientIdentity.ts +33 -0
- package/src/ai-components/tool-calls/AIClientToolRunner.ts +200 -0
- package/src/ai-components/tool-calls/AIToolApprover.tsx +60 -0
- package/src/ai-components/tool-calls/authSessionAuthorizer.ts +137 -0
- package/src/ai-components/tool-calls/index.ts +4 -0
- package/src/ai-components/voice-visualization/glowShader.ts +1 -3
- package/src/ai-components/voice-visualization/simplex.ts +1 -1
- package/src/components/Accessibility/NotificationAnnouncer.tsx +5 -5
- package/src/components/Accessibility/hooks/useIncomingMessageAnnouncements.ts +1 -1
- package/src/components/Accessibility/useAccessibilityAnnouncer.ts +0 -2
- package/src/components/Message/MessageItemView/utils/renderText.tsx +1 -2
- package/src/contexts/translationContext/TranslationContext.tsx +2 -2
- package/src/i18n/ar.json +39 -1
- package/src/i18n/en.json +39 -1
- package/src/i18n/es.json +39 -1
- package/src/i18n/fr.json +39 -1
- package/src/i18n/he.json +39 -1
- package/src/i18n/hi.json +39 -1
- package/src/i18n/it.json +39 -1
- package/src/i18n/ja.json +39 -1
- package/src/i18n/ko.json +39 -1
- package/src/i18n/nl.json +39 -1
- package/src/i18n/pt-br.json +39 -1
- package/src/i18n/ru.json +39 -1
- package/src/i18n/tr.json +39 -1
- package/src/mock-builders/a2ui/ohrid.ts +106 -0
- package/src/utils/i18n/Streami18n.ts +4 -1
- package/src/utils/i18n/utils.ts +3 -0
- package/src/version.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Dispatch, type SetStateAction, useCallback, useContext, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { A2UIReplyContext } from './A2UIContexts';
|
|
4
|
+
|
|
5
|
+
const resolve = <T>(initial: T | (() => T)) =>
|
|
6
|
+
typeof initial === 'function' ? (initial as () => T)() : initial;
|
|
7
|
+
|
|
8
|
+
/** `useState` for a part's own state, which starts again from `initial` for another reply. */
|
|
9
|
+
export const useReplyState = <T>(initial: T | (() => T)): [T, Dispatch<SetStateAction<T>>] => {
|
|
10
|
+
const messageId = useContext(A2UIReplyContext)?.messageId;
|
|
11
|
+
const [held, setHeld] = useState(() => ({ messageId, value: resolve(initial) }));
|
|
12
|
+
let { value } = held;
|
|
13
|
+
if (held.messageId !== messageId) {
|
|
14
|
+
value = resolve(initial);
|
|
15
|
+
setHeld({ messageId, value });
|
|
16
|
+
}
|
|
17
|
+
const setValue = useCallback<Dispatch<SetStateAction<T>>>(
|
|
18
|
+
(next) =>
|
|
19
|
+
setHeld((current) => ({
|
|
20
|
+
...current,
|
|
21
|
+
value: typeof next === 'function' ? (next as (value: T) => T)(current.value) : next,
|
|
22
|
+
})),
|
|
23
|
+
[],
|
|
24
|
+
);
|
|
25
|
+
return [value, setValue];
|
|
26
|
+
};
|
|
@@ -1,31 +1,17 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
|
-
import { StyleSheet, Text
|
|
2
|
+
import { StyleSheet, Text } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { useTheme } from './contexts';
|
|
5
|
-
|
|
6
|
-
import {
|
|
5
|
+
import { Shimmer } from './internal/Shimmer';
|
|
6
|
+
import { primitives } from './internal/tokens';
|
|
7
7
|
|
|
8
8
|
export const AITypingIndicatorView = ({ text }: { text: string }) => {
|
|
9
|
-
const {
|
|
10
|
-
theme: {
|
|
11
|
-
colors: { shimmer },
|
|
12
|
-
},
|
|
13
|
-
} = useTheme();
|
|
14
9
|
const styles = useStyles();
|
|
15
10
|
|
|
16
|
-
// The native shimmer paints behind its children, so it is laid over the text instead: the
|
|
17
|
-
// highlight has to sweep across the glyphs, which a transparent background would otherwise hide.
|
|
18
11
|
return (
|
|
19
|
-
<
|
|
12
|
+
<Shimmer style={styles.wrapper}>
|
|
20
13
|
<Text style={styles.text}>{text}</Text>
|
|
21
|
-
|
|
22
|
-
baseColor={'transparent'}
|
|
23
|
-
duration={1200}
|
|
24
|
-
gradientColor={shimmer}
|
|
25
|
-
pointerEvents='none'
|
|
26
|
-
style={[StyleSheet.absoluteFill, styles.shimmer]}
|
|
27
|
-
/>
|
|
28
|
-
</View>
|
|
14
|
+
</Shimmer>
|
|
29
15
|
);
|
|
30
16
|
};
|
|
31
17
|
|
|
@@ -35,10 +21,8 @@ const useStyles = () => {
|
|
|
35
21
|
return useMemo(
|
|
36
22
|
() =>
|
|
37
23
|
StyleSheet.create({
|
|
38
|
-
// The native highlight band is soft and wide, so it is kept fairly strong over the text.
|
|
39
|
-
shimmer: { opacity: 0.8 },
|
|
40
24
|
text: {
|
|
41
|
-
fontSize:
|
|
25
|
+
fontSize: primitives.typographyFontSizeMd,
|
|
42
26
|
color: theme.colors.grey_dark,
|
|
43
27
|
},
|
|
44
28
|
wrapper: {
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
- `ComposerView` - a prompt composer with attachments and speech input
|
|
7
7
|
- `SpeechToTextButton` - records voice input and streams the recognized transcript into your UI
|
|
8
8
|
- `AITypingIndicatorView` - displays the state of the LLM (thinking, checking external sources, etc.)
|
|
9
|
+
- Generated UI - draws the UI an agent writes for its replies, such as A2UI, with your own components
|
|
9
10
|
|
|
10
11
|
The components live in their own entry point. Apps that never import `stream-chat-react-native/ai-components` do not bundle any of it, and apps that only use the AI components do not bundle the rest of the chat SDK.
|
|
11
12
|
|
|
@@ -246,7 +247,7 @@ The `SpeechToTextButton` is already integrated within the `ComposerView`, howeve
|
|
|
246
247
|
|
|
247
248
|
### `VoiceGlow` and `VoiceWave`
|
|
248
249
|
|
|
249
|
-
Two visualizations of a voice agent
|
|
250
|
+
Two visualizations of a voice agent:
|
|
250
251
|
|
|
251
252
|
- `VoiceGlow`: a soft, airy globe whose color masses orbit inside it and swell with speech. It is drawn by a Skia shader, every pixel on the GPU.
|
|
252
253
|
- `VoiceWave`: a single string carrying a wave packet that erupts with speech, its colors flowing along it.
|
|
@@ -288,9 +289,60 @@ The motion runs entirely on the UI thread with Reanimated and Skia, so the visua
|
|
|
288
289
|
|
|
289
290
|
**Theming.** The theme's `voiceVisualization.colors` are the default palette (the accent color unless you set them). The visualizations draw for a light or a dark background following `voiceVisualization.backdropColor` when you set it, and the system color scheme otherwise.
|
|
290
291
|
|
|
291
|
-
**Accessibility.** Each is an image named "Voice agent" with its state as the value ("Ready", "Connecting", "Listening", "Thinking", "Speaking")
|
|
292
|
+
**Accessibility.** Each is an image named "Voice agent" with its state as the value ("Ready", "Connecting", "Listening", "Thinking", "Speaking"). Pass `stateLabels` to translate the state values, `accessibilityLabel` to change the label, or `accessibilityValue` to replace the value outright. Under the system's Reduce Motion (animations off on Android), they barely move and ignore taps.
|
|
292
293
|
|
|
293
|
-
**
|
|
294
|
+
**Rendering.** The glow's shader runs through Skia on every Android version, so there is no fallback rendering, and it does not switch to a cheaper look in battery saver. A visualization keeps animating while it is mounted, even when scrolled off screen; it pauses only while the app is in the background.
|
|
295
|
+
|
|
296
|
+
### Generated UI
|
|
297
|
+
|
|
298
|
+
An agent can answer with UI instead of text: a form, a list of options, a card with buttons. The backend splits the model's UI block out of the reply into the message's `ai_ui` field, and the app draws it with a renderer for the format the agent writes. Today that is [A2UI](https://a2ui.org) v1.0, from its own entry point, so apps that don't use it don't bundle it:
|
|
299
|
+
|
|
300
|
+
```tsx
|
|
301
|
+
import { createA2UIRenderer } from 'stream-chat-react-native/a2ui'; // or 'stream-chat-expo/a2ui'
|
|
302
|
+
import { AIConversation, AIUIHost, aiUIActionJSON } from 'stream-chat-react-native/ai-components';
|
|
303
|
+
|
|
304
|
+
const Conversation = ({ messages, session }) => {
|
|
305
|
+
// One host per conversation, kept for as long as it shows, so what a reply's UI holds (a
|
|
306
|
+
// half-filled form) survives scrolling it away and back.
|
|
307
|
+
const [ui] = useState(
|
|
308
|
+
() =>
|
|
309
|
+
new AIUIHost({
|
|
310
|
+
renderers: [createA2UIRenderer()],
|
|
311
|
+
// What the person did goes to the agent as their next message.
|
|
312
|
+
send: action => session.responses.create(action.label, { uiAction: aiUIActionJSON(action) }),
|
|
313
|
+
}),
|
|
314
|
+
);
|
|
315
|
+
|
|
316
|
+
return <AIConversation messages={messages} ui={ui} />;
|
|
317
|
+
};
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
The label of the message an action sends is the text of the control the person tapped, never text the agent wrote. Values typed into obscured text fields never leave the device. A reply's UI shows a placeholder until its first surface arrives, and a finished reply whose UI draws nothing shows its text instead.
|
|
321
|
+
|
|
322
|
+
`createA2UIRenderer` draws all 18 components of A2UI's basic catalog natively, and takes:
|
|
323
|
+
|
|
324
|
+
| Name | Description |
|
|
325
|
+
| -------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
326
|
+
| `components` | Your own views for basic components, by type, such as `{ Card: MyCard }`. Each gets the node and its resolved props. |
|
|
327
|
+
| `icons` | Your own icons for the names `Icon` takes, over the Material icons drawn by default. |
|
|
328
|
+
| `removing` | Basic components or functions to leave out, such as `['Video']`. The agent's instructions leave them out too. |
|
|
329
|
+
| `locale` | The locale numbers and dates are formatted in. `en-US` by default. |
|
|
330
|
+
| `mediaUrl` | Decides what an `Image`, `Video` or `AudioPlayer` loads for a link. Public web links only by default. |
|
|
331
|
+
| `instructions` | What you tell the model before A2UI's own instructions, such as which answers to write as UI. |
|
|
332
|
+
| `catalogId` | The id of the catalog with your own components. |
|
|
333
|
+
| `onError` | Called with what was wrong in a reply's A2UI. The rest of the reply still shows. Logged by default. |
|
|
334
|
+
|
|
335
|
+
**Your own components.** Define a component with `defineAIUIComponent(definition, View)` and pass it to the host's `components`. The definition is portable JSON (name, description, parameters, events), so the same `UIComponents.json` can describe it to the agent and to your apps on other platforms. A component calls `context.emit(name, label, payload)` to send an action.
|
|
336
|
+
|
|
337
|
+
**Tools.** The host's `tools` are functions of yours that a reply's UI can call, such as reading something on the device. They are the same `AIClientTool`s an `AIClientToolRunner` takes, so a tool is defined once. A tool runs by itself as a reply shows only when its definition says it is read-only (`annotations: { readOnlyHint: true }`); any other runs only from something the person did, such as a tap. Output that isn't JSON is refused, and what the person typed into a password field never reaches a tool.
|
|
338
|
+
|
|
339
|
+
**Instructions for the model.** `await ui.capabilities()` returns what the backend needs to tell the model: each renderer's format and instructions, your components and your tools. To write them yourself, use `a2uiInstructions({ components, removing, tools, examples })`, which refuses examples that wouldn't render. `a2uiProblems(text)` checks a reply's A2UI the same way.
|
|
340
|
+
|
|
341
|
+
**Links.** Only web and email links open by default, since the agent writes them. Pass the host an `open` function to allow others.
|
|
342
|
+
|
|
343
|
+
**Theming.** The theme's `a2ui` key styles the basic components: `colors` (`accent`, `onAccent`, `text`, `secondaryText`, `surface`, `subtleSurface`, `border`, `error`) and one style per part (`surfaces`, `card`, `button`, `buttonText`, `input`, `label`, `chip`, `chipText`, `tab`, `tabText`, `divider`, `caption`, `image`).
|
|
344
|
+
|
|
345
|
+
**Media.** `Image`, `Video` and `AudioPlayer` load only public web links by default, never addresses on the person's network such as `192.168.1.1` or `localhost`, since the agent writes the links. Pass `mediaUrl` to decide otherwise. `Video` and `AudioPlayer` play in place with the player you registered for the chat SDK's own video and voice messages. Without one they show a link that opens where the device plays it.
|
|
294
346
|
|
|
295
347
|
### Theming
|
|
296
348
|
|
|
@@ -17,12 +17,28 @@ export const useStreamingMessage = ({
|
|
|
17
17
|
letterInterval = 0,
|
|
18
18
|
renderingLetterCount = 2,
|
|
19
19
|
text,
|
|
20
|
-
}: UseStreamingMessageProps): { streamedMessageText: string } => {
|
|
20
|
+
}: UseStreamingMessageProps): { isWriting: boolean; streamedMessageText: string } => {
|
|
21
21
|
const [streamedMessageText, setStreamedMessageText] = useState<string>(text);
|
|
22
22
|
const textCursor = useRef<number>(text.length);
|
|
23
|
+
// How much of the text is typed out, to say whether it still is.
|
|
24
|
+
const [typedLength, setTypedLength] = useState(text.length);
|
|
25
|
+
|
|
26
|
+
// Only text added to the end is typed out. Another text, such as another message's when a list
|
|
27
|
+
// reuses this view, shows at once, from this render rather than after the old text's.
|
|
28
|
+
const [lastText, setLastText] = useState(text);
|
|
29
|
+
if (text !== lastText) {
|
|
30
|
+
setLastText(text);
|
|
31
|
+
if (!text.startsWith(lastText)) {
|
|
32
|
+
setStreamedMessageText(text);
|
|
33
|
+
setTypedLength(text.length);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const typedToward = useRef(text);
|
|
23
37
|
|
|
24
38
|
useEffect(() => {
|
|
25
39
|
const textLength = text.length;
|
|
40
|
+
if (!text.startsWith(typedToward.current)) textCursor.current = textLength;
|
|
41
|
+
typedToward.current = text;
|
|
26
42
|
const interval = setInterval(() => {
|
|
27
43
|
if (!text || textCursor.current >= textLength) {
|
|
28
44
|
clearInterval(interval);
|
|
@@ -33,6 +49,7 @@ export const useStreamingMessage = ({
|
|
|
33
49
|
const codeBlockCounts = (newText.match(/```/g) || []).length;
|
|
34
50
|
const shouldOptimisticallyCloseCodeBlock = codeBlockCounts > 0 && codeBlockCounts % 2 > 0;
|
|
35
51
|
setStreamedMessageText(shouldOptimisticallyCloseCodeBlock ? newText + '```' : newText);
|
|
52
|
+
setTypedLength(textCursor.current);
|
|
36
53
|
}, letterInterval);
|
|
37
54
|
|
|
38
55
|
return () => {
|
|
@@ -40,7 +57,7 @@ export const useStreamingMessage = ({
|
|
|
40
57
|
};
|
|
41
58
|
}, [letterInterval, renderingLetterCount, text]);
|
|
42
59
|
|
|
43
|
-
return { streamedMessageText };
|
|
60
|
+
return { isWriting: typedLength < text.length, streamedMessageText };
|
|
44
61
|
};
|
|
45
62
|
|
|
46
63
|
export const StreamingMessageView = ({
|
|
@@ -49,6 +66,7 @@ export const StreamingMessageView = ({
|
|
|
49
66
|
rules,
|
|
50
67
|
onLink: onLinkParam,
|
|
51
68
|
letterInterval,
|
|
69
|
+
onWritingChange,
|
|
52
70
|
renderingLetterCount,
|
|
53
71
|
}: {
|
|
54
72
|
text: string;
|
|
@@ -56,15 +74,21 @@ export const StreamingMessageView = ({
|
|
|
56
74
|
rules?: MarkdownRules;
|
|
57
75
|
onLink?: (url: string) => void;
|
|
58
76
|
letterInterval?: number;
|
|
77
|
+
/** Called when the text starts or stops being typed out, such as to show what follows it once it is. */
|
|
78
|
+
onWritingChange?: (isWriting: boolean) => void;
|
|
59
79
|
renderingLetterCount?: number;
|
|
60
80
|
}) => {
|
|
61
81
|
const markdownText = useMemo(() => generateMarkdownText(text), [text]);
|
|
62
82
|
|
|
63
|
-
const { streamedMessageText } = useStreamingMessage({
|
|
83
|
+
const { isWriting, streamedMessageText } = useStreamingMessage({
|
|
64
84
|
text: markdownText ?? '',
|
|
65
85
|
letterInterval,
|
|
66
86
|
renderingLetterCount,
|
|
67
87
|
});
|
|
88
|
+
const reportWriting = useStableCallback((writing: boolean) => onWritingChange?.(writing));
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
reportWriting(isWriting);
|
|
91
|
+
}, [isWriting, reportWriting]);
|
|
68
92
|
|
|
69
93
|
const onLink = useStableCallback((url: string): void | Promise<void> =>
|
|
70
94
|
onLinkParam
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Image, Text } from 'react-native';
|
|
2
|
+
import { Image, Pressable, Text } from 'react-native';
|
|
3
|
+
import { KeyboardController } from 'react-native-keyboard-controller';
|
|
3
4
|
|
|
4
5
|
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react-native';
|
|
5
6
|
|
|
6
7
|
import {
|
|
8
|
+
AIConversationController,
|
|
9
|
+
type AIConversationFeed,
|
|
10
|
+
AISuggestions,
|
|
7
11
|
ComposerView,
|
|
8
12
|
type ComposerViewProps,
|
|
9
13
|
sheetStore,
|
|
@@ -73,7 +77,12 @@ describe('ai-components ComposerView', () => {
|
|
|
73
77
|
mediaPickerService,
|
|
74
78
|
});
|
|
75
79
|
|
|
76
|
-
|
|
80
|
+
await act(async () => {
|
|
81
|
+
fireEvent.press(screen.getByText('+'));
|
|
82
|
+
await flushPromises();
|
|
83
|
+
});
|
|
84
|
+
// Once the keyboard has closed, which a sheet opening over it leaves to stray events.
|
|
85
|
+
expect(KeyboardController.dismiss).toHaveBeenCalled();
|
|
77
86
|
expect(sheetStore.getLatestValue().open).toBe(true);
|
|
78
87
|
expect(screen.getByText('Camera')).toBeTruthy();
|
|
79
88
|
expect(screen.getByText('Custom option')).toBeTruthy();
|
|
@@ -110,4 +119,220 @@ describe('ai-components ComposerView', () => {
|
|
|
110
119
|
screen.UNSAFE_queryAllByType(Text).some((t) => t.props.children === 'With an image'),
|
|
111
120
|
).toBe(false);
|
|
112
121
|
});
|
|
122
|
+
|
|
123
|
+
it('sends the picked chat option, which stays picked until removed', async () => {
|
|
124
|
+
const think = {
|
|
125
|
+
description: 'More time to reason before answering',
|
|
126
|
+
id: 'think_harder',
|
|
127
|
+
shortTitle: 'Think',
|
|
128
|
+
title: 'Think harder',
|
|
129
|
+
};
|
|
130
|
+
const { onSendMessage } = renderComposer({ chatOptions: [think] });
|
|
131
|
+
|
|
132
|
+
await act(async () => {
|
|
133
|
+
fireEvent.press(screen.getByText('+'));
|
|
134
|
+
await flushPromises();
|
|
135
|
+
});
|
|
136
|
+
expect(screen.getByText('More time to reason before answering')).toBeTruthy();
|
|
137
|
+
expect(screen.getByRole('radio', { checked: false })).toBeTruthy();
|
|
138
|
+
await act(async () => {
|
|
139
|
+
fireEvent.press(screen.getByText('Think harder'));
|
|
140
|
+
await flushPromises();
|
|
141
|
+
});
|
|
142
|
+
expect(sheetStore.getLatestValue().open).toBe(false);
|
|
143
|
+
expect(screen.getByTestId('ai-selected-chat-option')).toBeTruthy();
|
|
144
|
+
expect(screen.getByText('Think')).toBeTruthy();
|
|
145
|
+
|
|
146
|
+
fireEvent.changeText(screen.getByPlaceholderText('Ask anything'), 'Why is the sky blue?');
|
|
147
|
+
await act(async () => {
|
|
148
|
+
fireEvent.press(screen.getByTestId('send-up'));
|
|
149
|
+
await flushPromises();
|
|
150
|
+
});
|
|
151
|
+
expect(onSendMessage).toHaveBeenCalledWith(
|
|
152
|
+
expect.objectContaining({ chatOption: think, text: 'Why is the sky blue?' }),
|
|
153
|
+
);
|
|
154
|
+
expect(screen.getByText('Think')).toBeTruthy();
|
|
155
|
+
|
|
156
|
+
fireEvent.press(screen.getByLabelText('Remove option: Think'));
|
|
157
|
+
expect(screen.queryByTestId('ai-selected-chat-option')).toBeNull();
|
|
158
|
+
|
|
159
|
+
fireEvent.changeText(screen.getByPlaceholderText('Ask anything'), 'And now?');
|
|
160
|
+
await act(async () => {
|
|
161
|
+
fireEvent.press(screen.getByTestId('send-up'));
|
|
162
|
+
await flushPromises();
|
|
163
|
+
});
|
|
164
|
+
expect(onSendMessage).toHaveBeenLastCalledWith(
|
|
165
|
+
expect.objectContaining({ chatOption: undefined, text: 'And now?' }),
|
|
166
|
+
);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it('removes the picked chat option when it is picked again', async () => {
|
|
170
|
+
renderComposer({ chatOptions: [{ id: 'search', title: 'Web search' }] });
|
|
171
|
+
|
|
172
|
+
act(() => {
|
|
173
|
+
sheetStoreApi.openSheet();
|
|
174
|
+
});
|
|
175
|
+
await act(async () => {
|
|
176
|
+
fireEvent.press(screen.getByText('Web search'));
|
|
177
|
+
await flushPromises();
|
|
178
|
+
});
|
|
179
|
+
// Without a short title, the chip shows the title.
|
|
180
|
+
expect(screen.getByLabelText('Remove option: Web search')).toBeTruthy();
|
|
181
|
+
|
|
182
|
+
act(() => {
|
|
183
|
+
sheetStoreApi.openSheet();
|
|
184
|
+
});
|
|
185
|
+
expect(screen.getByRole('radio', { checked: true })).toBeTruthy();
|
|
186
|
+
await act(async () => {
|
|
187
|
+
fireEvent.press(screen.getByRole('radio'));
|
|
188
|
+
await flushPromises();
|
|
189
|
+
});
|
|
190
|
+
expect(screen.queryByTestId('ai-selected-chat-option')).toBeNull();
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it('shows a picked file that is not an image as a file, with a way to remove it', () => {
|
|
194
|
+
const mediaPickerService = new FakeMediaPickerService();
|
|
195
|
+
mediaPickerService.appendAssets([
|
|
196
|
+
{ name: 'clip.mp4', size: 2048, type: 'video/mp4', uri: 'file:///clip.mp4' },
|
|
197
|
+
]);
|
|
198
|
+
renderComposer({ mediaPickerService });
|
|
199
|
+
|
|
200
|
+
expect(screen.UNSAFE_queryAllByType(Image)).toHaveLength(0);
|
|
201
|
+
expect(screen.getByText('clip.mp4')).toBeTruthy();
|
|
202
|
+
expect(screen.getByText('MP4 · 2.00 kB')).toBeTruthy();
|
|
203
|
+
|
|
204
|
+
fireEvent.press(screen.getByLabelText('Remove attachment'));
|
|
205
|
+
expect(mediaPickerService.state.getLatestValue().assets).toEqual([]);
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
describe('ComposerView header', () => {
|
|
210
|
+
it('shows what it is given above the composer', () => {
|
|
211
|
+
render(
|
|
212
|
+
<StreamTheme>
|
|
213
|
+
<ComposerView
|
|
214
|
+
header={<Text>Starters</Text>}
|
|
215
|
+
onSendMessage={jest.fn(() => Promise.resolve())}
|
|
216
|
+
/>
|
|
217
|
+
</StreamTheme>,
|
|
218
|
+
);
|
|
219
|
+
expect(screen.getByText('Starters')).toBeTruthy();
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
describe('ComposerView trailing', () => {
|
|
224
|
+
it('shows what it is given after the message box, and its presses reach it', () => {
|
|
225
|
+
const onTalk = jest.fn();
|
|
226
|
+
render(
|
|
227
|
+
<StreamTheme>
|
|
228
|
+
<ComposerView
|
|
229
|
+
onSendMessage={jest.fn(() => Promise.resolve())}
|
|
230
|
+
trailing={
|
|
231
|
+
<Pressable accessibilityLabel='Talk' accessibilityRole='button' onPress={onTalk} />
|
|
232
|
+
}
|
|
233
|
+
/>
|
|
234
|
+
</StreamTheme>,
|
|
235
|
+
);
|
|
236
|
+
fireEvent.press(screen.getByRole('button', { name: 'Talk' }));
|
|
237
|
+
expect(onTalk).toHaveBeenCalledTimes(1);
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
describe('AISuggestions', () => {
|
|
242
|
+
it('hands the picked suggestion over, and shows nothing without any', () => {
|
|
243
|
+
const onSelect = jest.fn();
|
|
244
|
+
const { rerender } = render(
|
|
245
|
+
<StreamTheme>
|
|
246
|
+
<AISuggestions onSelect={onSelect} suggestions={['Plan a weekend in Lisbon', 'Cook']} />
|
|
247
|
+
</StreamTheme>,
|
|
248
|
+
);
|
|
249
|
+
fireEvent.press(screen.getByRole('button', { name: 'Plan a weekend in Lisbon' }));
|
|
250
|
+
expect(onSelect).toHaveBeenCalledWith('Plan a weekend in Lisbon');
|
|
251
|
+
|
|
252
|
+
rerender(
|
|
253
|
+
<StreamTheme>
|
|
254
|
+
<AISuggestions onSelect={onSelect} suggestions={[]} />
|
|
255
|
+
</StreamTheme>,
|
|
256
|
+
);
|
|
257
|
+
expect(screen.queryByTestId('ai-suggestions')).toBeNull();
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
describe('ComposerView with a conversation', () => {
|
|
262
|
+
const conversationOf = (messages: { id: string; role: string; text: string }[] = []) => {
|
|
263
|
+
const transport = {
|
|
264
|
+
connect: (feed: AIConversationFeed) => feed.updateMessages(messages),
|
|
265
|
+
send: jest.fn(() => Promise.resolve()),
|
|
266
|
+
stop: jest.fn(() => Promise.resolve()),
|
|
267
|
+
};
|
|
268
|
+
return { controller: new AIConversationController({ transport }), transport };
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
const renderWith = (controller: AIConversationController) =>
|
|
272
|
+
render(
|
|
273
|
+
<StreamTheme>
|
|
274
|
+
<ComposerView conversation={controller} />
|
|
275
|
+
</StreamTheme>,
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
it('sends to the conversation, and stops the agent while it answers', async () => {
|
|
279
|
+
const { controller, transport } = conversationOf([{ id: 'u1', role: 'user', text: 'Hi' }]);
|
|
280
|
+
renderWith(controller);
|
|
281
|
+
|
|
282
|
+
fireEvent.changeText(screen.getByPlaceholderText('Ask anything'), 'Plan a weekend in Lisbon');
|
|
283
|
+
await act(async () => {
|
|
284
|
+
fireEvent.press(screen.getByTestId('send-up'));
|
|
285
|
+
await flushPromises();
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
expect(transport.send).toHaveBeenCalledWith(
|
|
289
|
+
expect.objectContaining({ kind: 'message', text: 'Plan a weekend in Lisbon' }),
|
|
290
|
+
);
|
|
291
|
+
expect(controller.state.getLatestValue().status).toBe('submitted');
|
|
292
|
+
|
|
293
|
+
fireEvent.press(screen.getByTestId('stop-generating'));
|
|
294
|
+
await act(flushPromises);
|
|
295
|
+
|
|
296
|
+
expect(transport.stop).toHaveBeenCalledTimes(1);
|
|
297
|
+
expect(controller.state.getLatestValue().status).toBe('ready');
|
|
298
|
+
controller.dispose();
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
it('shows the draft of the conversation it is given', () => {
|
|
302
|
+
const first = conversationOf().controller;
|
|
303
|
+
const second = conversationOf().controller;
|
|
304
|
+
first.composer.partialNext({ text: 'Lisbon' });
|
|
305
|
+
second.composer.partialNext({ text: 'Porto' });
|
|
306
|
+
const { rerender } = renderWith(first);
|
|
307
|
+
expect(screen.getByPlaceholderText('Ask anything').props.value).toBe('Lisbon');
|
|
308
|
+
|
|
309
|
+
rerender(
|
|
310
|
+
<StreamTheme>
|
|
311
|
+
<ComposerView conversation={second} />
|
|
312
|
+
</StreamTheme>,
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
expect(screen.getByPlaceholderText('Ask anything').props.value).toBe('Porto');
|
|
316
|
+
first.dispose();
|
|
317
|
+
second.dispose();
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
it('says the person is editing a message, and cancels it', () => {
|
|
321
|
+
const message = { id: 'u1', role: 'user', text: 'Plan Lisbon' };
|
|
322
|
+
const { controller } = conversationOf([message, { id: 'a1', role: 'assistant', text: 'Done' }]);
|
|
323
|
+
renderWith(controller);
|
|
324
|
+
expect(screen.queryByTestId('ai-editing-message')).toBeNull();
|
|
325
|
+
|
|
326
|
+
act(() => controller.edit(message));
|
|
327
|
+
|
|
328
|
+
expect(screen.getByText('Editing message')).toBeTruthy();
|
|
329
|
+
expect(screen.getByPlaceholderText('Ask anything').props.value).toBe('Plan Lisbon');
|
|
330
|
+
|
|
331
|
+
fireEvent.press(screen.getByRole('button', { name: 'Cancel editing' }));
|
|
332
|
+
|
|
333
|
+
expect(screen.queryByTestId('ai-editing-message')).toBeNull();
|
|
334
|
+
expect(controller.editingMessage).toBeUndefined();
|
|
335
|
+
expect(screen.getByPlaceholderText('Ask anything').props.value).toBe('');
|
|
336
|
+
controller.dispose();
|
|
337
|
+
});
|
|
113
338
|
});
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
2
3
|
|
|
3
4
|
import { fireEvent, render, screen } from '@testing-library/react-native';
|
|
4
5
|
|
|
5
6
|
import { Markdown, mergeThemes, StreamTheme } from '../index';
|
|
7
|
+
import { primitives } from '../internal/tokens';
|
|
6
8
|
|
|
7
9
|
const mockSetString = jest.fn();
|
|
8
10
|
jest.mock(
|
|
@@ -81,6 +83,17 @@ describe('ai-components Markdown', () => {
|
|
|
81
83
|
expect(screen.getByText('json')).toBeTruthy();
|
|
82
84
|
});
|
|
83
85
|
|
|
86
|
+
it('sizes text from the design tokens, leaving headings and inline code their own size', () => {
|
|
87
|
+
renderMarkdown('## Heading\n\nbody with `code`');
|
|
88
|
+
|
|
89
|
+
const fontSizeOf = (text: string) =>
|
|
90
|
+
StyleSheet.flatten(screen.getByText(text).props.style).fontSize;
|
|
91
|
+
expect(fontSizeOf('body with ')).toBe(primitives.typographyFontSizeMd);
|
|
92
|
+
// The size comes from the heading or inline code around the text.
|
|
93
|
+
expect(fontSizeOf('Heading')).toBeUndefined();
|
|
94
|
+
expect(fontSizeOf('code')).toBeUndefined();
|
|
95
|
+
});
|
|
96
|
+
|
|
84
97
|
it('applies theme overrides', () => {
|
|
85
98
|
const theme = mergeThemes({ style: { markdown: { text: { color: 'rgb(1, 2, 3)' } } } });
|
|
86
99
|
render(
|
|
@@ -41,6 +41,53 @@ describe('ai-components streaming', () => {
|
|
|
41
41
|
expect(result.current.streamedMessageText).toBe('Hello world');
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
+
it('shows another text at once rather than typing it out', () => {
|
|
45
|
+
const { result, rerender } = renderHook(
|
|
46
|
+
({ text }: { text: string }) =>
|
|
47
|
+
useStreamingMessage({ letterInterval: 10, renderingLetterCount: 2, text }),
|
|
48
|
+
{ initialProps: { text: 'Hi' } },
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
// As when a list reuses the view for another, longer message.
|
|
52
|
+
rerender({ text: 'Goodbye, and thanks for all the fish' });
|
|
53
|
+
expect(result.current.streamedMessageText).toBe('Goodbye, and thanks for all the fish');
|
|
54
|
+
act(() => {
|
|
55
|
+
jest.advanceTimersByTime(100);
|
|
56
|
+
});
|
|
57
|
+
expect(result.current.streamedMessageText).toBe('Goodbye, and thanks for all the fish');
|
|
58
|
+
|
|
59
|
+
// And one shorter than what was shown.
|
|
60
|
+
rerender({ text: 'Bye' });
|
|
61
|
+
expect(result.current.streamedMessageText).toBe('Bye');
|
|
62
|
+
|
|
63
|
+
// Text added to the end of it is still typed out.
|
|
64
|
+
rerender({ text: 'Bye now' });
|
|
65
|
+
act(() => {
|
|
66
|
+
jest.advanceTimersByTime(10);
|
|
67
|
+
});
|
|
68
|
+
expect(result.current.streamedMessageText).toBe('Bye n');
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('says whether text is still being typed out', () => {
|
|
72
|
+
const { result, rerender } = renderHook(
|
|
73
|
+
({ text }: { text: string }) =>
|
|
74
|
+
useStreamingMessage({ letterInterval: 10, renderingLetterCount: 2, text }),
|
|
75
|
+
{ initialProps: { text: 'Hello' } },
|
|
76
|
+
);
|
|
77
|
+
expect(result.current.isWriting).toBe(false);
|
|
78
|
+
|
|
79
|
+
rerender({ text: 'Hello world' });
|
|
80
|
+
expect(result.current.isWriting).toBe(true);
|
|
81
|
+
act(() => {
|
|
82
|
+
jest.advanceTimersByTime(100);
|
|
83
|
+
});
|
|
84
|
+
expect(result.current.isWriting).toBe(false);
|
|
85
|
+
|
|
86
|
+
// Another text shows at once, so nothing is being typed.
|
|
87
|
+
rerender({ text: 'Bye' });
|
|
88
|
+
expect(result.current.isWriting).toBe(false);
|
|
89
|
+
});
|
|
90
|
+
|
|
44
91
|
it('optimistically closes a code fence while it is being streamed', () => {
|
|
45
92
|
const { result, rerender } = renderHook(
|
|
46
93
|
({ text }: { text: string }) =>
|
|
@@ -57,6 +104,28 @@ describe('ai-components streaming', () => {
|
|
|
57
104
|
});
|
|
58
105
|
|
|
59
106
|
describe('StreamingMessageView', () => {
|
|
107
|
+
it('reports when it starts and stops typing', () => {
|
|
108
|
+
const onWritingChange = jest.fn();
|
|
109
|
+
const { rerender } = render(
|
|
110
|
+
<StreamTheme>
|
|
111
|
+
<StreamingMessageView letterInterval={10} onWritingChange={onWritingChange} text='Hi' />
|
|
112
|
+
</StreamTheme>,
|
|
113
|
+
);
|
|
114
|
+
rerender(
|
|
115
|
+
<StreamTheme>
|
|
116
|
+
<StreamingMessageView
|
|
117
|
+
letterInterval={10}
|
|
118
|
+
onWritingChange={onWritingChange}
|
|
119
|
+
text='Hi there, friend'
|
|
120
|
+
/>
|
|
121
|
+
</StreamTheme>,
|
|
122
|
+
);
|
|
123
|
+
act(() => {
|
|
124
|
+
jest.advanceTimersByTime(200);
|
|
125
|
+
});
|
|
126
|
+
expect(onWritingChange.mock.calls.map(([writing]) => writing)).toEqual([false, true, false]);
|
|
127
|
+
});
|
|
128
|
+
|
|
60
129
|
it('renders markdown and handles links with the provided callback', () => {
|
|
61
130
|
const onLink = jest.fn();
|
|
62
131
|
render(
|