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,705 @@
|
|
|
1
|
+
import React, { type ReactElement, useEffect } from 'react';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { act, fireEvent, render, screen } from '@testing-library/react-native';
|
|
5
|
+
|
|
6
|
+
import { AIPendingMessageTracker, turnsOf } from '../conversation/entries';
|
|
7
|
+
import {
|
|
8
|
+
AIConversation,
|
|
9
|
+
type AIConversationAssistantMessageProps,
|
|
10
|
+
AIConversationController,
|
|
11
|
+
type AIConversationControllerOptions,
|
|
12
|
+
type AIConversationFeed,
|
|
13
|
+
type AIConversationTransport,
|
|
14
|
+
type AIConversationUserMessageProps,
|
|
15
|
+
type AIMessage,
|
|
16
|
+
type AIToolApprover,
|
|
17
|
+
createFromStreamMessage,
|
|
18
|
+
fromStreamMessage,
|
|
19
|
+
parseMessageParts,
|
|
20
|
+
StreamTheme,
|
|
21
|
+
} from '../index';
|
|
22
|
+
import { forgetCallStates } from '../message-parts/callStates';
|
|
23
|
+
|
|
24
|
+
// Each test's questions start unanswered, though tests reuse calls.
|
|
25
|
+
afterEach(forgetCallStates);
|
|
26
|
+
|
|
27
|
+
jest.mock('../services/clipboard-service', () => ({ setClipboardString: jest.fn() }));
|
|
28
|
+
|
|
29
|
+
const user = (id: string, text: string): AIMessage => ({ id, role: 'user', text });
|
|
30
|
+
const reply = (id: string, text: string, extra: Partial<AIMessage> = {}): AIMessage => ({
|
|
31
|
+
id,
|
|
32
|
+
role: 'assistant',
|
|
33
|
+
text,
|
|
34
|
+
...extra,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const layoutOf = (height: number) => ({
|
|
38
|
+
nativeEvent: { layout: { height, width: 400, x: 0, y: 0 } },
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Lets the list apply what it measured, which it does on a later tick, with fake timers too.
|
|
42
|
+
const settle = async (ms = 20) => {
|
|
43
|
+
if ('clock' in setTimeout) {
|
|
44
|
+
await act(async () => {
|
|
45
|
+
await jest.advanceTimersByTimeAsync(ms);
|
|
46
|
+
});
|
|
47
|
+
} else {
|
|
48
|
+
await act(() => new Promise<void>((resolve) => setTimeout(resolve, ms)));
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// The list renders its rows once it knows its size, and lets them be touched once each one is
|
|
53
|
+
// measured, which a real layout does.
|
|
54
|
+
const layOut = async () => {
|
|
55
|
+
const list = screen.queryByTestId('ai-conversation-list');
|
|
56
|
+
if (!list) return;
|
|
57
|
+
act(() => {
|
|
58
|
+
fireEvent(list, 'layout', layoutOf(800));
|
|
59
|
+
});
|
|
60
|
+
// Measuring rows can bring more into the range it renders: until every row is measured.
|
|
61
|
+
for (let pass = 0; pass < 10; pass++) {
|
|
62
|
+
const measured = screen.UNSAFE_root.findAll(
|
|
63
|
+
(node) => typeof node.type === 'string' && !!node.props.onLayout && node !== list,
|
|
64
|
+
);
|
|
65
|
+
act(() => {
|
|
66
|
+
for (const node of measured) node.props.onLayout(layoutOf(60));
|
|
67
|
+
});
|
|
68
|
+
await settle();
|
|
69
|
+
const waiting = screen.UNSAFE_root.findAll(
|
|
70
|
+
(node) => typeof node.type === 'string' && node.props.pointerEvents === 'none',
|
|
71
|
+
);
|
|
72
|
+
if (waiting.length === 0) return;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// A scroll event at the start of the list.
|
|
77
|
+
const atStart = {
|
|
78
|
+
nativeEvent: {
|
|
79
|
+
contentInset: { bottom: 0, left: 0, right: 0, top: 0 },
|
|
80
|
+
contentOffset: { x: 0, y: 0 },
|
|
81
|
+
contentSize: { height: 800, width: 400 },
|
|
82
|
+
layoutMeasurement: { height: 800, width: 400 },
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// The person scrolling to the start of the list.
|
|
87
|
+
const scrollToStart = () => {
|
|
88
|
+
act(() => {
|
|
89
|
+
fireEvent.scroll(screen.getByTestId('ai-conversation-list'), atStart);
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const renderConversation = async (ui: ReactElement) => {
|
|
94
|
+
const result = render(<StreamTheme>{ui}</StreamTheme>);
|
|
95
|
+
await layOut();
|
|
96
|
+
return {
|
|
97
|
+
...result,
|
|
98
|
+
rerender: async (next: ReactElement) => {
|
|
99
|
+
result.rerender(<StreamTheme>{next}</StreamTheme>);
|
|
100
|
+
await layOut();
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
afterEach(() => {
|
|
106
|
+
jest.useRealTimers();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
describe('AIConversation', () => {
|
|
110
|
+
it('shows the empty content while there are no messages', async () => {
|
|
111
|
+
await renderConversation(
|
|
112
|
+
<AIConversation emptyContent={<Text>Ask me anything</Text>} messages={[]} />,
|
|
113
|
+
);
|
|
114
|
+
expect(screen.getByText('Ask me anything')).toBeTruthy();
|
|
115
|
+
// The list stays mounted under it, so it follows a keyboard opened before the first question.
|
|
116
|
+
expect(screen.getByTestId('ai-conversation-list')).toBeTruthy();
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('hides the empty content once there are messages', async () => {
|
|
120
|
+
const { rerender } = await renderConversation(
|
|
121
|
+
<AIConversation emptyContent={<Text>Ask me anything</Text>} messages={[]} />,
|
|
122
|
+
);
|
|
123
|
+
await rerender(
|
|
124
|
+
<AIConversation
|
|
125
|
+
emptyContent={<Text>Ask me anything</Text>}
|
|
126
|
+
messages={[user('u1', 'Is 7 prime?')]}
|
|
127
|
+
/>,
|
|
128
|
+
);
|
|
129
|
+
expect(screen.queryByText('Ask me anything')).toBeNull();
|
|
130
|
+
expect(screen.getByText('Is 7 prime?')).toBeTruthy();
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('groups the messages into turns, each starting with a question', async () => {
|
|
134
|
+
const messages = [
|
|
135
|
+
reply('a0', 'Hi, I am your assistant.'),
|
|
136
|
+
user('u1', 'What time is it?'),
|
|
137
|
+
reply('a1', 'It is noon.'),
|
|
138
|
+
user('u2', 'And the weather?'),
|
|
139
|
+
reply('a2', 'Sunny.'),
|
|
140
|
+
];
|
|
141
|
+
const turns = turnsOf(new AIPendingMessageTracker().entries(messages));
|
|
142
|
+
expect(turns.map((turn) => turn.id)).toEqual(['a0', 'u1', 'u2']);
|
|
143
|
+
expect(turns[2].entries.map((entry) => entry.id)).toEqual(['u2', 'a2']);
|
|
144
|
+
expect(turns[2].entries[1].isLatestReply).toBe(true);
|
|
145
|
+
|
|
146
|
+
await renderConversation(<AIConversation footer={<Text>footer</Text>} messages={messages} />);
|
|
147
|
+
for (const { text } of messages) expect(screen.getByText(text)).toBeTruthy();
|
|
148
|
+
expect(screen.getAllByText('footer')).toHaveLength(1);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('shows a pending message with the agent thinking, until its reply starts', async () => {
|
|
152
|
+
const mounts: string[] = [];
|
|
153
|
+
const UserMessage = ({ text }: AIConversationUserMessageProps) => {
|
|
154
|
+
useEffect(() => {
|
|
155
|
+
mounts.push(text);
|
|
156
|
+
}, [text]);
|
|
157
|
+
return <Text>{text}</Text>;
|
|
158
|
+
};
|
|
159
|
+
const history = [user('u1', 'Hello'), reply('a1', 'Hi!')];
|
|
160
|
+
const pending = { id: 'local-1', text: 'Plan my day' };
|
|
161
|
+
const { rerender } = await renderConversation(
|
|
162
|
+
<AIConversation messages={history} pendingMessage={pending} UserMessage={UserMessage} />,
|
|
163
|
+
);
|
|
164
|
+
expect(screen.getByText('Plan my day')).toBeTruthy();
|
|
165
|
+
expect(screen.getByRole('button', { name: 'Thinking...' })).toBeTruthy();
|
|
166
|
+
|
|
167
|
+
// Stream's copy arrives with another id: it takes over the pending row, under its key.
|
|
168
|
+
await rerender(
|
|
169
|
+
<AIConversation
|
|
170
|
+
messages={[...history, user('stream-u2', 'Plan my day')]}
|
|
171
|
+
pendingMessage={pending}
|
|
172
|
+
UserMessage={UserMessage}
|
|
173
|
+
/>,
|
|
174
|
+
);
|
|
175
|
+
expect(screen.getAllByText('Plan my day')).toHaveLength(1);
|
|
176
|
+
expect(screen.getByRole('button', { name: 'Thinking...' })).toBeTruthy();
|
|
177
|
+
|
|
178
|
+
// A reply being written that shows nothing yet: still thinking.
|
|
179
|
+
await rerender(
|
|
180
|
+
<AIConversation
|
|
181
|
+
messages={[
|
|
182
|
+
...history,
|
|
183
|
+
user('stream-u2', 'Plan my day'),
|
|
184
|
+
reply('a2', '', { isGenerating: true }),
|
|
185
|
+
]}
|
|
186
|
+
pendingMessage={pending}
|
|
187
|
+
UserMessage={UserMessage}
|
|
188
|
+
/>,
|
|
189
|
+
);
|
|
190
|
+
expect(screen.getByRole('button', { name: 'Thinking...' })).toBeTruthy();
|
|
191
|
+
|
|
192
|
+
await rerender(
|
|
193
|
+
<AIConversation
|
|
194
|
+
messages={[
|
|
195
|
+
...history,
|
|
196
|
+
user('stream-u2', 'Plan my day'),
|
|
197
|
+
reply('a2', 'Here is your plan.', { isGenerating: true }),
|
|
198
|
+
]}
|
|
199
|
+
UserMessage={UserMessage}
|
|
200
|
+
/>,
|
|
201
|
+
);
|
|
202
|
+
expect(screen.queryByRole('button', { name: 'Thinking...' })).toBeNull();
|
|
203
|
+
expect(screen.getByText('Here is your plan.')).toBeTruthy();
|
|
204
|
+
// The row the pending message showed in was never mounted again.
|
|
205
|
+
expect(mounts.filter((text) => text === 'Plan my day')).toHaveLength(1);
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it('finds the copy of a pending message by its id', async () => {
|
|
209
|
+
const pending = { id: 'm-2', text: 'Draft' };
|
|
210
|
+
const { rerender } = await renderConversation(
|
|
211
|
+
<AIConversation messages={[user('m-1', 'Draft')]} pendingMessage={pending} />,
|
|
212
|
+
);
|
|
213
|
+
// the earlier message saying the same is not its copy
|
|
214
|
+
expect(screen.getAllByText('Draft')).toHaveLength(2);
|
|
215
|
+
await rerender(
|
|
216
|
+
<AIConversation
|
|
217
|
+
messages={[user('m-1', 'Draft'), user('m-2', 'Draft')]}
|
|
218
|
+
pendingMessage={pending}
|
|
219
|
+
/>,
|
|
220
|
+
);
|
|
221
|
+
expect(screen.getAllByText('Draft')).toHaveLength(2);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it('shows the agent thinking when told to', async () => {
|
|
225
|
+
await renderConversation(<AIConversation isThinking messages={[user('u1', 'Hi')]} />);
|
|
226
|
+
expect(screen.getByRole('button', { name: 'Thinking...' })).toBeTruthy();
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it('shows reply actions under finished replies only', async () => {
|
|
230
|
+
const onRate = jest.fn();
|
|
231
|
+
const replyActions = (message: AIMessage, { isLatestReply }: { isLatestReply: boolean }) => ({
|
|
232
|
+
onRate: (rating: 'positive' | 'negative' | null) => onRate(message.id, rating, isLatestReply),
|
|
233
|
+
rating: null,
|
|
234
|
+
});
|
|
235
|
+
const { rerender } = await renderConversation(
|
|
236
|
+
<AIConversation
|
|
237
|
+
messages={[
|
|
238
|
+
user('u1', 'One'),
|
|
239
|
+
reply('a1', 'Done.'),
|
|
240
|
+
user('u2', 'Two'),
|
|
241
|
+
reply('a2', 'Writing', { isGenerating: true }),
|
|
242
|
+
]}
|
|
243
|
+
replyActions={replyActions}
|
|
244
|
+
/>,
|
|
245
|
+
);
|
|
246
|
+
expect(screen.getAllByTestId('ai-reply-actions')).toHaveLength(1);
|
|
247
|
+
fireEvent.press(screen.getByRole('button', { name: 'Good response' }));
|
|
248
|
+
expect(onRate).toHaveBeenCalledWith('a1', 'positive', false);
|
|
249
|
+
|
|
250
|
+
await rerender(
|
|
251
|
+
<AIConversation messages={[user('u1', 'One'), reply('a1', 'Done.')]} ReplyActions={null} />,
|
|
252
|
+
);
|
|
253
|
+
expect(screen.queryByTestId('ai-reply-actions')).toBeNull();
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
it('shows the actions under a reply once its answer is typed out', async () => {
|
|
257
|
+
const answer = 'word '.repeat(200).trim();
|
|
258
|
+
const { rerender } = await renderConversation(
|
|
259
|
+
<AIConversation
|
|
260
|
+
messages={[user('u1', 'One'), reply('a1', 'word', { isGenerating: true })]}
|
|
261
|
+
/>,
|
|
262
|
+
);
|
|
263
|
+
await rerender(<AIConversation messages={[user('u1', 'One'), reply('a1', answer)]} />);
|
|
264
|
+
// Finished, and still typing out what arrived last.
|
|
265
|
+
expect(screen.queryByTestId('ai-reply-actions')).toBeNull();
|
|
266
|
+
await settle(2000);
|
|
267
|
+
expect(screen.getByTestId('ai-reply-actions')).toBeTruthy();
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it('keeps the actions of rows it reuses for other replies', async () => {
|
|
271
|
+
const history = Array.from({ length: 40 }, (_, turn) => [
|
|
272
|
+
user(`u${turn}`, `Question ${turn}`),
|
|
273
|
+
reply(`a${turn}`, `Answer ${turn}.`),
|
|
274
|
+
]).flat();
|
|
275
|
+
const watched = (text: string, extra: Partial<AIMessage> = {}) => [
|
|
276
|
+
...history,
|
|
277
|
+
user('uw', 'Watched'),
|
|
278
|
+
reply('aw', text, extra),
|
|
279
|
+
];
|
|
280
|
+
const { rerender } = await renderConversation(
|
|
281
|
+
<AIConversation messages={watched('Writ', { isGenerating: true })} />,
|
|
282
|
+
);
|
|
283
|
+
// A reply watched as it was written, whose actions came in, then a turn after it.
|
|
284
|
+
await rerender(<AIConversation messages={watched('Written.')} />);
|
|
285
|
+
await settle(2000);
|
|
286
|
+
await rerender(
|
|
287
|
+
<AIConversation
|
|
288
|
+
messages={[...watched('Written.'), user('ul', 'Latest'), reply('al', 'Latest.')]}
|
|
289
|
+
/>,
|
|
290
|
+
);
|
|
291
|
+
await settle(2000);
|
|
292
|
+
const actions = screen.getAllByTestId('ai-reply-actions');
|
|
293
|
+
expect(screen.getByText('Written.')).toBeTruthy();
|
|
294
|
+
expect(screen.queryByText('Answer 0.')).toBeNull();
|
|
295
|
+
|
|
296
|
+
// Scrolled to the start, the rows at the end show the oldest replies.
|
|
297
|
+
act(() => {
|
|
298
|
+
fireEvent.scroll(screen.getByTestId('ai-conversation-list'), {
|
|
299
|
+
nativeEvent: { ...atStart.nativeEvent, contentSize: { height: 5000, width: 400 } },
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
await layOut();
|
|
303
|
+
expect(screen.getByText('Answer 0.')).toBeTruthy();
|
|
304
|
+
expect(screen.queryByText('Written.')).toBeNull();
|
|
305
|
+
const shown = screen.getAllByTestId('ai-reply-actions');
|
|
306
|
+
expect(actions.filter((view) => !shown.includes(view))).toEqual([]);
|
|
307
|
+
}, 30000);
|
|
308
|
+
|
|
309
|
+
it('shows a new rating when the messages stay the same', async () => {
|
|
310
|
+
const messages = [user('u1', 'One'), reply('a1', 'Done.')];
|
|
311
|
+
const rated = (rating: 'positive' | null) => (
|
|
312
|
+
<AIConversation messages={messages} replyActions={() => ({ onRate: jest.fn(), rating })} />
|
|
313
|
+
);
|
|
314
|
+
const { rerender } = await renderConversation(rated(null));
|
|
315
|
+
expect(screen.getByRole('button', { name: 'Good response', selected: false })).toBeTruthy();
|
|
316
|
+
await rerender(rated('positive'));
|
|
317
|
+
expect(screen.getByRole('button', { name: 'Good response', selected: true })).toBeTruthy();
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
it('renders messages through the slots', async () => {
|
|
321
|
+
const UserMessage = ({ text }: AIConversationUserMessageProps) => <Text>user:{text}</Text>;
|
|
322
|
+
const AssistantMessage = ({ message, text }: AIConversationAssistantMessageProps) => (
|
|
323
|
+
<Text>
|
|
324
|
+
agent:{message.id}:{text}
|
|
325
|
+
</Text>
|
|
326
|
+
);
|
|
327
|
+
await renderConversation(
|
|
328
|
+
<AIConversation
|
|
329
|
+
AssistantMessage={AssistantMessage}
|
|
330
|
+
messages={[user('u1', 'Hi'), reply('a1', 'Hello')]}
|
|
331
|
+
ReplyActions={() => <Text>actions</Text>}
|
|
332
|
+
UserMessage={UserMessage}
|
|
333
|
+
/>,
|
|
334
|
+
);
|
|
335
|
+
expect(screen.getByText('user:Hi')).toBeTruthy();
|
|
336
|
+
expect(screen.getByText('agent:a1:Hello')).toBeTruthy();
|
|
337
|
+
expect(screen.getByText('actions')).toBeTruthy();
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
it('renders again only the messages that changed', async () => {
|
|
341
|
+
const renders: string[] = [];
|
|
342
|
+
const AssistantMessage = ({ message, text }: AIConversationAssistantMessageProps) => {
|
|
343
|
+
renders.push(message.id);
|
|
344
|
+
return <Text>{text}</Text>;
|
|
345
|
+
};
|
|
346
|
+
const first = reply('a1', 'Done.');
|
|
347
|
+
const conversation = (latest: AIMessage) => (
|
|
348
|
+
<AIConversation
|
|
349
|
+
AssistantMessage={AssistantMessage}
|
|
350
|
+
messages={[user('u1', 'One'), first, user('u2', 'Two'), latest]}
|
|
351
|
+
ReplyActions={null}
|
|
352
|
+
/>
|
|
353
|
+
);
|
|
354
|
+
const { rerender } = await renderConversation(
|
|
355
|
+
conversation(reply('a2', 'Wri', { isGenerating: true })),
|
|
356
|
+
);
|
|
357
|
+
renders.length = 0;
|
|
358
|
+
await rerender(conversation(reply('a2', 'Writing', { isGenerating: true })));
|
|
359
|
+
expect(screen.getByText('Writing')).toBeTruthy();
|
|
360
|
+
expect(renders).toEqual(['a2']);
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
it('shows reasoning, tool calls and approvals of a reply', async () => {
|
|
364
|
+
let fail = true;
|
|
365
|
+
const decide = jest.fn(() =>
|
|
366
|
+
fail ? Promise.reject(new Error('offline')) : new Promise<void>(() => undefined),
|
|
367
|
+
);
|
|
368
|
+
const approver: AIToolApprover = { clientId: 'device-1', decide, userId: 'alex' };
|
|
369
|
+
const parts = parseMessageParts([
|
|
370
|
+
{ duration_ms: 3000, id: 'r1', preview: 'Thinking about the weather.', status: 'completed', type: 'ai_reasoning', v: 1 },
|
|
371
|
+
{
|
|
372
|
+
approval: { title: 'Share your location?' },
|
|
373
|
+
display_title: 'Checking your location',
|
|
374
|
+
executor: 'client',
|
|
375
|
+
id: 'call_1',
|
|
376
|
+
name: 'get_location',
|
|
377
|
+
status: 'awaiting_approval',
|
|
378
|
+
target_client_id: 'device-1',
|
|
379
|
+
target_user_id: 'alex',
|
|
380
|
+
type: 'ai_tool_call',
|
|
381
|
+
v: 1,
|
|
382
|
+
},
|
|
383
|
+
]); // prettier-ignore
|
|
384
|
+
await renderConversation(
|
|
385
|
+
<AIConversation
|
|
386
|
+
approver={approver}
|
|
387
|
+
messages={[user('u1', 'Weather?'), reply('a1', '', { isGenerating: true, parts })]}
|
|
388
|
+
/>,
|
|
389
|
+
);
|
|
390
|
+
expect(screen.getByRole('button', { name: /Thought for 3s/ })).toBeTruthy();
|
|
391
|
+
expect(screen.getByText('Checking your location')).toBeTruthy();
|
|
392
|
+
expect(screen.getByText('Waiting for approval')).toBeTruthy();
|
|
393
|
+
|
|
394
|
+
fireEvent.press(screen.getByRole('button', { name: 'Allow' }));
|
|
395
|
+
expect(decide).toHaveBeenCalledWith(parts[1].toolCall, true);
|
|
396
|
+
await act(() => Promise.resolve());
|
|
397
|
+
expect(screen.getByText("Your answer couldn't be sent. Try again.")).toBeTruthy();
|
|
398
|
+
|
|
399
|
+
fail = false;
|
|
400
|
+
fireEvent.press(screen.getByRole('button', { name: "Don't Allow" }));
|
|
401
|
+
expect(decide).toHaveBeenLastCalledWith(parts[1].toolCall, false);
|
|
402
|
+
expect(screen.queryByText("Your answer couldn't be sent. Try again.")).toBeNull();
|
|
403
|
+
expect(screen.getByRole('button', { name: "Don't Allow" })).toBeDisabled();
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
describe('loading older messages', () => {
|
|
407
|
+
beforeEach(() => {
|
|
408
|
+
jest.useFakeTimers();
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
it('loads once the spinner has been in view a moment', async () => {
|
|
412
|
+
const loadOlderMessages = jest.fn(() => Promise.resolve());
|
|
413
|
+
const { rerender } = await renderConversation(
|
|
414
|
+
<AIConversation
|
|
415
|
+
loadOlderMessages={loadOlderMessages}
|
|
416
|
+
messages={[user('u1', 'Hi'), reply('a1', 'Hello')]}
|
|
417
|
+
/>,
|
|
418
|
+
);
|
|
419
|
+
expect(screen.getByRole('progressbar', { name: 'Loading older messages' })).toBeTruthy();
|
|
420
|
+
loadOlderMessages.mockClear();
|
|
421
|
+
scrollToStart();
|
|
422
|
+
act(() => jest.advanceTimersByTime(299));
|
|
423
|
+
expect(loadOlderMessages).not.toHaveBeenCalled();
|
|
424
|
+
act(() => jest.advanceTimersByTime(1));
|
|
425
|
+
expect(loadOlderMessages).toHaveBeenCalledTimes(1);
|
|
426
|
+
|
|
427
|
+
await rerender(
|
|
428
|
+
<AIConversation
|
|
429
|
+
messages={[user('u0', 'Earlier'), user('u1', 'Hi'), reply('a1', 'Hello')]}
|
|
430
|
+
/>,
|
|
431
|
+
);
|
|
432
|
+
expect(screen.queryByRole('progressbar')).toBeNull();
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
it('asks again after a load that failed, while the spinner stays in view', async () => {
|
|
436
|
+
const loadOlderMessages = jest
|
|
437
|
+
.fn<Promise<void>, []>()
|
|
438
|
+
.mockRejectedValueOnce(new Error('offline'))
|
|
439
|
+
.mockResolvedValue(undefined);
|
|
440
|
+
await renderConversation(
|
|
441
|
+
<AIConversation
|
|
442
|
+
loadOlderMessages={loadOlderMessages}
|
|
443
|
+
messages={[user('u1', 'Hi'), reply('a1', 'Hello')]}
|
|
444
|
+
/>,
|
|
445
|
+
);
|
|
446
|
+
scrollToStart();
|
|
447
|
+
await act(async () => {
|
|
448
|
+
await jest.advanceTimersByTimeAsync(300);
|
|
449
|
+
});
|
|
450
|
+
expect(loadOlderMessages).toHaveBeenCalledTimes(1);
|
|
451
|
+
await act(async () => {
|
|
452
|
+
await jest.advanceTimersByTimeAsync(2999);
|
|
453
|
+
});
|
|
454
|
+
expect(loadOlderMessages).toHaveBeenCalledTimes(1);
|
|
455
|
+
await act(async () => {
|
|
456
|
+
await jest.advanceTimersByTimeAsync(1);
|
|
457
|
+
});
|
|
458
|
+
expect(loadOlderMessages).toHaveBeenCalledTimes(2);
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
it('waits for the list to come to rest', async () => {
|
|
462
|
+
const loadOlderMessages = jest.fn(() => Promise.resolve());
|
|
463
|
+
await renderConversation(
|
|
464
|
+
<AIConversation
|
|
465
|
+
loadOlderMessages={loadOlderMessages}
|
|
466
|
+
messages={[user('u1', 'Hi'), reply('a1', 'Hello')]}
|
|
467
|
+
/>,
|
|
468
|
+
);
|
|
469
|
+
const list = screen.getByTestId('ai-conversation-list');
|
|
470
|
+
loadOlderMessages.mockClear();
|
|
471
|
+
|
|
472
|
+
// A finger holds the list at its start.
|
|
473
|
+
act(() => {
|
|
474
|
+
fireEvent(list, 'scrollBeginDrag', atStart);
|
|
475
|
+
});
|
|
476
|
+
scrollToStart();
|
|
477
|
+
act(() => jest.advanceTimersByTime(1000));
|
|
478
|
+
expect(loadOlderMessages).not.toHaveBeenCalled();
|
|
479
|
+
|
|
480
|
+
// It lets go, and the list glides on.
|
|
481
|
+
act(() => {
|
|
482
|
+
fireEvent(list, 'scrollEndDrag', atStart);
|
|
483
|
+
fireEvent(list, 'momentumScrollBegin', atStart);
|
|
484
|
+
});
|
|
485
|
+
act(() => jest.advanceTimersByTime(1000));
|
|
486
|
+
expect(loadOlderMessages).not.toHaveBeenCalled();
|
|
487
|
+
|
|
488
|
+
act(() => {
|
|
489
|
+
fireEvent(list, 'momentumScrollEnd', atStart);
|
|
490
|
+
});
|
|
491
|
+
act(() => jest.advanceTimersByTime(300));
|
|
492
|
+
expect(loadOlderMessages).toHaveBeenCalledTimes(1);
|
|
493
|
+
});
|
|
494
|
+
});
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
describe('fromStreamMessage', () => {
|
|
498
|
+
it('adapts a reply with its steps and attachments', () => {
|
|
499
|
+
const reasoningText = jest.fn(() => 'The whole thought');
|
|
500
|
+
// A step's fields are the router's own, which Stream's `Attachment` type doesn't list.
|
|
501
|
+
const step = { id: 'r1', status: 'streaming', type: 'ai_reasoning', v: 1 };
|
|
502
|
+
const message = fromStreamMessage(
|
|
503
|
+
{
|
|
504
|
+
ai_generated: true,
|
|
505
|
+
attachments: [
|
|
506
|
+
step,
|
|
507
|
+
{ image_url: 'https://cdn.example.com/a.jpg', title: 'a.jpg', type: 'image' },
|
|
508
|
+
{
|
|
509
|
+
asset_url: 'https://cdn.example.com/plan.pdf',
|
|
510
|
+
file_size: 2400,
|
|
511
|
+
mime_type: 'application/pdf',
|
|
512
|
+
title: 'plan.pdf',
|
|
513
|
+
type: 'file',
|
|
514
|
+
},
|
|
515
|
+
{ type: 'connector_authorization' },
|
|
516
|
+
],
|
|
517
|
+
generating: true,
|
|
518
|
+
id: 'm1',
|
|
519
|
+
text: 'Working on it',
|
|
520
|
+
},
|
|
521
|
+
{ reasoningText },
|
|
522
|
+
);
|
|
523
|
+
expect(message).toMatchObject({
|
|
524
|
+
attachments: [
|
|
525
|
+
{ kind: 'image', name: 'a.jpg', url: 'https://cdn.example.com/a.jpg' },
|
|
526
|
+
{
|
|
527
|
+
kind: 'file',
|
|
528
|
+
mimeType: 'application/pdf',
|
|
529
|
+
name: 'plan.pdf',
|
|
530
|
+
size: 2400,
|
|
531
|
+
url: 'https://cdn.example.com/plan.pdf',
|
|
532
|
+
},
|
|
533
|
+
],
|
|
534
|
+
id: 'm1',
|
|
535
|
+
isGenerating: true,
|
|
536
|
+
role: 'assistant',
|
|
537
|
+
text: 'Working on it',
|
|
538
|
+
});
|
|
539
|
+
expect(message.parts?.map((part) => part.id)).toEqual(['r1']);
|
|
540
|
+
expect(message.reasoningText?.('r1')).toBe('The whole thought');
|
|
541
|
+
expect(reasoningText).toHaveBeenCalledWith('m1', 'r1');
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
it('adapts the person’s message', () => {
|
|
545
|
+
expect(fromStreamMessage({ attachments: [], id: 'u1', text: 'Hi' })).toMatchObject({
|
|
546
|
+
isGenerating: false,
|
|
547
|
+
parts: [],
|
|
548
|
+
role: 'user',
|
|
549
|
+
});
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
it('gives back the same message for the same Stream message, through its cache', () => {
|
|
553
|
+
const adapt = createFromStreamMessage({ isAssistant: (message) => message.id === 'a1' });
|
|
554
|
+
const stream = { attachments: [], id: 'a1', text: 'Hi' };
|
|
555
|
+
const adapted = adapt(stream);
|
|
556
|
+
expect(adapted.role).toBe('assistant');
|
|
557
|
+
expect(adapt(stream)).toBe(adapted);
|
|
558
|
+
expect(adapt({ ...stream, text: 'Hi there' })).not.toBe(adapted);
|
|
559
|
+
});
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
// A transport the test drives: what it sends, stops and rates, and the messages it reports.
|
|
563
|
+
const conversationOf = (
|
|
564
|
+
messages: AIMessage[],
|
|
565
|
+
options: Omit<AIConversationControllerOptions, 'transport'> = {},
|
|
566
|
+
) => {
|
|
567
|
+
let feed: AIConversationFeed | undefined;
|
|
568
|
+
const transport = {
|
|
569
|
+
connect: (connected: AIConversationFeed) => {
|
|
570
|
+
feed = connected;
|
|
571
|
+
connected.updateMessages(messages);
|
|
572
|
+
},
|
|
573
|
+
loadOlderMessages: jest.fn(() => Promise.resolve()),
|
|
574
|
+
rate: jest.fn(() => Promise.resolve()),
|
|
575
|
+
send: jest.fn(() => Promise.resolve()),
|
|
576
|
+
stop: jest.fn(() => Promise.resolve()),
|
|
577
|
+
} satisfies AIConversationTransport;
|
|
578
|
+
const controller = new AIConversationController({ transport, ...options });
|
|
579
|
+
const update = async (next: AIMessage[]) => {
|
|
580
|
+
act(() => feed?.updateMessages(next));
|
|
581
|
+
await layOut();
|
|
582
|
+
};
|
|
583
|
+
const olderMessages = async (hasOlderMessages: boolean) => {
|
|
584
|
+
act(() => feed?.updateHasOlderMessages(hasOlderMessages));
|
|
585
|
+
await layOut();
|
|
586
|
+
};
|
|
587
|
+
return { controller, olderMessages, transport, update };
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
const thinking = () => screen.queryByRole('button', { name: 'Thinking...' });
|
|
591
|
+
|
|
592
|
+
describe('AIConversation with a controller', () => {
|
|
593
|
+
it('shows the conversation as the controller has it', async () => {
|
|
594
|
+
const history = [user('u1', 'Hello'), reply('a1', 'Hi!')];
|
|
595
|
+
const { controller, update } = conversationOf(history);
|
|
596
|
+
await renderConversation(<AIConversation conversation={controller} />);
|
|
597
|
+
expect(screen.getByText('Hi!')).toBeTruthy();
|
|
598
|
+
expect(thinking()).toBeNull();
|
|
599
|
+
|
|
600
|
+
act(() => controller.send({ text: 'Plan my day' }));
|
|
601
|
+
await layOut();
|
|
602
|
+
expect(screen.getByText('Plan my day')).toBeTruthy();
|
|
603
|
+
expect(thinking()).toBeTruthy();
|
|
604
|
+
|
|
605
|
+
await update([
|
|
606
|
+
...history,
|
|
607
|
+
user('u2', 'Plan my day'),
|
|
608
|
+
reply('a2', 'Here is your plan.', { isGenerating: true }),
|
|
609
|
+
]);
|
|
610
|
+
expect(thinking()).toBeNull();
|
|
611
|
+
expect(screen.getByText('Here is your plan.')).toBeTruthy();
|
|
612
|
+
expect(screen.getAllByText('Plan my day')).toHaveLength(1);
|
|
613
|
+
controller.dispose();
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
it('shows the agent thinking while a reply is written again', async () => {
|
|
617
|
+
const { controller } = conversationOf([user('u1', 'Hello'), reply('a1', 'Hi!')]);
|
|
618
|
+
await renderConversation(<AIConversation conversation={controller} />);
|
|
619
|
+
|
|
620
|
+
act(() => controller.regenerate(reply('a1', 'Hi!')));
|
|
621
|
+
await layOut();
|
|
622
|
+
|
|
623
|
+
expect(screen.queryByText('Hi!')).toBeNull();
|
|
624
|
+
expect(thinking()).toBeTruthy();
|
|
625
|
+
controller.dispose();
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
it('stops showing the agent thinking once stopped, with the message still on its way', async () => {
|
|
629
|
+
const { controller, transport } = conversationOf([user('u1', 'Hello'), reply('a1', 'Hi!')]);
|
|
630
|
+
await renderConversation(<AIConversation conversation={controller} />);
|
|
631
|
+
act(() => controller.send({ text: 'Plan my day' }));
|
|
632
|
+
await layOut();
|
|
633
|
+
expect(thinking()).toBeTruthy();
|
|
634
|
+
|
|
635
|
+
act(() => controller.stop());
|
|
636
|
+
await layOut();
|
|
637
|
+
|
|
638
|
+
expect(screen.getByText('Plan my day')).toBeTruthy();
|
|
639
|
+
expect(thinking()).toBeNull();
|
|
640
|
+
expect(transport.stop).toHaveBeenCalledTimes(1);
|
|
641
|
+
controller.dispose();
|
|
642
|
+
});
|
|
643
|
+
|
|
644
|
+
it('offers the controller’s actions under replies and on the person’s latest message', async () => {
|
|
645
|
+
const { controller, transport } = conversationOf([
|
|
646
|
+
user('u1', 'Lisbon'),
|
|
647
|
+
reply('a1', 'Lisbon it is'),
|
|
648
|
+
user('u2', 'Porto'),
|
|
649
|
+
reply('a2', 'Porto it is'),
|
|
650
|
+
]);
|
|
651
|
+
await renderConversation(<AIConversation conversation={controller} />);
|
|
652
|
+
|
|
653
|
+
// Regenerating the latest reply only, and editing the person's latest message only.
|
|
654
|
+
expect(screen.getAllByRole('button', { name: 'Regenerate' })).toHaveLength(1);
|
|
655
|
+
expect(screen.getAllByRole('button', { name: 'Edit' })).toHaveLength(1);
|
|
656
|
+
|
|
657
|
+
fireEvent.press(screen.getAllByRole('button', { name: 'Good response' })[0]);
|
|
658
|
+
await layOut();
|
|
659
|
+
expect(transport.rate).toHaveBeenCalledWith(
|
|
660
|
+
expect.objectContaining({ role: 'assistant' }),
|
|
661
|
+
'positive',
|
|
662
|
+
);
|
|
663
|
+
expect(screen.getAllByRole('button', { name: 'Good response' })[0]).toHaveProp(
|
|
664
|
+
'accessibilityState',
|
|
665
|
+
expect.objectContaining({ selected: true }),
|
|
666
|
+
);
|
|
667
|
+
|
|
668
|
+
fireEvent.press(screen.getByRole('button', { name: 'Edit' }));
|
|
669
|
+
expect(controller.editingMessage?.id).toBe('u2');
|
|
670
|
+
expect(controller.composer.getLatestValue().text).toBe('Porto');
|
|
671
|
+
|
|
672
|
+
fireEvent.press(screen.getByRole('button', { name: 'Regenerate' }));
|
|
673
|
+
await layOut();
|
|
674
|
+
expect(transport.send).toHaveBeenCalledWith(
|
|
675
|
+
expect.objectContaining({ kind: 'regenerate', text: 'Porto' }),
|
|
676
|
+
);
|
|
677
|
+
// The agent is answering.
|
|
678
|
+
expect(screen.queryByRole('button', { name: 'Regenerate' })).toBeNull();
|
|
679
|
+
expect(screen.queryByRole('button', { name: 'Edit' })).toBeNull();
|
|
680
|
+
controller.dispose();
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
it('offers what the app allows', async () => {
|
|
684
|
+
const { controller } = conversationOf([user('u1', 'Lisbon'), reply('a1', 'Done')], {
|
|
685
|
+
actions: { edit: false, rate: false },
|
|
686
|
+
});
|
|
687
|
+
await renderConversation(<AIConversation conversation={controller} />);
|
|
688
|
+
|
|
689
|
+
expect(screen.queryByRole('button', { name: 'Edit' })).toBeNull();
|
|
690
|
+
expect(screen.queryByRole('button', { name: 'Good response' })).toBeNull();
|
|
691
|
+
expect(screen.getByRole('button', { name: 'Regenerate' })).toBeTruthy();
|
|
692
|
+
controller.dispose();
|
|
693
|
+
});
|
|
694
|
+
|
|
695
|
+
it('loads older messages through the controller while there are any', async () => {
|
|
696
|
+
const { controller, olderMessages } = conversationOf([user('u1', 'Hi'), reply('a1', 'Hello')]);
|
|
697
|
+
await renderConversation(<AIConversation conversation={controller} />);
|
|
698
|
+
expect(screen.queryByRole('progressbar', { name: 'Loading older messages' })).toBeNull();
|
|
699
|
+
|
|
700
|
+
await olderMessages(true);
|
|
701
|
+
|
|
702
|
+
expect(screen.getByRole('progressbar', { name: 'Loading older messages' })).toBeTruthy();
|
|
703
|
+
controller.dispose();
|
|
704
|
+
});
|
|
705
|
+
});
|