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,586 @@
|
|
|
1
|
+
import React, { type ReactElement } from 'react';
|
|
2
|
+
import { Pressable, StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { act, fireEvent, render, screen } from '@testing-library/react-native';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
AIConversation,
|
|
8
|
+
AIConversationController,
|
|
9
|
+
type AIMessage,
|
|
10
|
+
AIUIComponentView,
|
|
11
|
+
AIUIHost,
|
|
12
|
+
type AIUIRenderer,
|
|
13
|
+
AIUIView,
|
|
14
|
+
defineAIUIComponent,
|
|
15
|
+
fromStreamMessage,
|
|
16
|
+
parseAIUIComponentDefinition,
|
|
17
|
+
StreamTheme,
|
|
18
|
+
} from '../index';
|
|
19
|
+
import { forgetCallStates } from '../message-parts/callStates';
|
|
20
|
+
|
|
21
|
+
// Each test's questions start unanswered, though tests reuse calls.
|
|
22
|
+
afterEach(forgetCallStates);
|
|
23
|
+
|
|
24
|
+
jest.mock('../services/clipboard-service', () => ({ setClipboardString: jest.fn() }));
|
|
25
|
+
|
|
26
|
+
const user = (id: string, text: string): AIMessage => ({ id, role: 'user', text });
|
|
27
|
+
const reply = (
|
|
28
|
+
id: string,
|
|
29
|
+
text: string,
|
|
30
|
+
ui?: Record<string, unknown>,
|
|
31
|
+
extra: Record<string, unknown> = {},
|
|
32
|
+
): AIMessage =>
|
|
33
|
+
fromStreamMessage({
|
|
34
|
+
ai_generated: true,
|
|
35
|
+
ai_ui: ui,
|
|
36
|
+
attachments: [],
|
|
37
|
+
id,
|
|
38
|
+
text,
|
|
39
|
+
...extra,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Shows a document's text as a card, or nothing for the content `nothing`.
|
|
43
|
+
const cardRenderer: AIUIRenderer = {
|
|
44
|
+
createEngine: () => ({
|
|
45
|
+
view: (document) =>
|
|
46
|
+
document.content === 'nothing' ? null : <Text testID='card'>{String(document.content)}</Text>,
|
|
47
|
+
}),
|
|
48
|
+
format: 'a2ui',
|
|
49
|
+
supports: (version) => version === undefined || version === '1.0',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const makeHost = () => new AIUIHost({ renderers: [cardRenderer], send: jest.fn() });
|
|
53
|
+
|
|
54
|
+
const layoutOf = (height: number) => ({
|
|
55
|
+
nativeEvent: { layout: { height, width: 400, x: 0, y: 0 } },
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const settle = () => act(() => new Promise<void>((resolve) => setTimeout(resolve, 20)));
|
|
59
|
+
|
|
60
|
+
// The list renders its rows once it knows its size, and each one once it is measured.
|
|
61
|
+
const layOut = async () => {
|
|
62
|
+
const list = screen.queryByTestId('ai-conversation-list');
|
|
63
|
+
if (!list) return;
|
|
64
|
+
act(() => {
|
|
65
|
+
fireEvent(list, 'layout', layoutOf(800));
|
|
66
|
+
});
|
|
67
|
+
for (let pass = 0; pass < 10; pass++) {
|
|
68
|
+
const measured = screen.UNSAFE_root.findAll(
|
|
69
|
+
(node) => typeof node.type === 'string' && !!node.props.onLayout && node !== list,
|
|
70
|
+
);
|
|
71
|
+
act(() => {
|
|
72
|
+
for (const node of measured) node.props.onLayout(layoutOf(60));
|
|
73
|
+
});
|
|
74
|
+
await settle();
|
|
75
|
+
const waiting = screen.UNSAFE_root.findAll(
|
|
76
|
+
(node) => typeof node.type === 'string' && node.props.pointerEvents === 'none',
|
|
77
|
+
);
|
|
78
|
+
if (waiting.length === 0) return;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const renderConversation = async (ui: ReactElement) => {
|
|
83
|
+
const result = render(<StreamTheme>{ui}</StreamTheme>);
|
|
84
|
+
await layOut();
|
|
85
|
+
return {
|
|
86
|
+
...result,
|
|
87
|
+
rerender: async (next: ReactElement) => {
|
|
88
|
+
result.rerender(<StreamTheme>{next}</StreamTheme>);
|
|
89
|
+
await layOut();
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// The opacity of the generated UI's stage around `text`.
|
|
95
|
+
const stageOpacityOf = (text: string) => {
|
|
96
|
+
let node = screen.getByText(text).parent;
|
|
97
|
+
while (node) {
|
|
98
|
+
const style = StyleSheet.flatten(node.props.style);
|
|
99
|
+
if (style && style.transformOrigin === 'top') return style.opacity ?? 1;
|
|
100
|
+
node = node.parent;
|
|
101
|
+
}
|
|
102
|
+
return undefined;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
describe('AIConversation with generated UI', () => {
|
|
106
|
+
it('shows a reply’s UI in place of its text', async () => {
|
|
107
|
+
await renderConversation(
|
|
108
|
+
<AIConversation
|
|
109
|
+
messages={[
|
|
110
|
+
user('u1', 'Plan a weekend in Ohrid'),
|
|
111
|
+
reply('a1', "Here's a weekend in Ohrid.", { content: 'Ohrid plan', format: 'a2ui' }),
|
|
112
|
+
]}
|
|
113
|
+
ui={makeHost()}
|
|
114
|
+
/>,
|
|
115
|
+
);
|
|
116
|
+
expect(screen.getByTestId('card')).toHaveTextContent('Ohrid plan');
|
|
117
|
+
expect(screen.queryByText("Here's a weekend in Ohrid.")).toBeNull();
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('shows the text of a reply whose UI no renderer shows', async () => {
|
|
121
|
+
await renderConversation(
|
|
122
|
+
<AIConversation
|
|
123
|
+
messages={[
|
|
124
|
+
user('u1', 'Plan'),
|
|
125
|
+
reply('a1', 'In OpenUI', { content: 'root = Card()', format: 'openui' }),
|
|
126
|
+
user('u2', 'Again'),
|
|
127
|
+
reply('a2', 'A newer A2UI', { content: 'x', format: 'a2ui', version: '2.0' }),
|
|
128
|
+
user('u3', 'Once more'),
|
|
129
|
+
reply('a3', 'A newer field', { content: 'x', format: 'a2ui', v: 2 }),
|
|
130
|
+
user('u4', 'And'),
|
|
131
|
+
reply('a4', 'Shows nothing of its own', { content: 'nothing', format: 'a2ui' }),
|
|
132
|
+
]}
|
|
133
|
+
ui={makeHost()}
|
|
134
|
+
/>,
|
|
135
|
+
);
|
|
136
|
+
for (const text of ['In OpenUI', 'A newer A2UI', 'A newer field', 'Shows nothing of its own']) {
|
|
137
|
+
expect(screen.getByText(text)).toBeTruthy();
|
|
138
|
+
}
|
|
139
|
+
expect(screen.queryByTestId('card')).toBeNull();
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it('shows the text without a host', async () => {
|
|
143
|
+
await renderConversation(
|
|
144
|
+
<AIConversation
|
|
145
|
+
messages={[
|
|
146
|
+
user('u1', 'Plan'),
|
|
147
|
+
reply('a1', 'The words', { content: 'Ohrid plan', format: 'a2ui' }),
|
|
148
|
+
]}
|
|
149
|
+
/>,
|
|
150
|
+
);
|
|
151
|
+
expect(screen.getByText('The words')).toBeTruthy();
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it('stops thinking once a reply has UI to show, and keeps thinking while it has none', async () => {
|
|
155
|
+
const ui = makeHost();
|
|
156
|
+
const question = user('u1', 'Plan');
|
|
157
|
+
const { rerender } = await renderConversation(
|
|
158
|
+
<AIConversation
|
|
159
|
+
messages={[
|
|
160
|
+
question,
|
|
161
|
+
reply(
|
|
162
|
+
'a1',
|
|
163
|
+
'',
|
|
164
|
+
{ content: 'x', format: 'openui', status: 'streaming' },
|
|
165
|
+
{ generating: true },
|
|
166
|
+
),
|
|
167
|
+
]}
|
|
168
|
+
ui={ui}
|
|
169
|
+
/>,
|
|
170
|
+
);
|
|
171
|
+
expect(screen.getByRole('button', { name: 'Thinking...' })).toBeTruthy();
|
|
172
|
+
|
|
173
|
+
await rerender(
|
|
174
|
+
<AIConversation
|
|
175
|
+
messages={[
|
|
176
|
+
question,
|
|
177
|
+
reply(
|
|
178
|
+
'a1',
|
|
179
|
+
'',
|
|
180
|
+
{ content: 'Ohrid', format: 'a2ui', status: 'streaming' },
|
|
181
|
+
{ generating: true },
|
|
182
|
+
),
|
|
183
|
+
]}
|
|
184
|
+
ui={ui}
|
|
185
|
+
/>,
|
|
186
|
+
);
|
|
187
|
+
expect(screen.queryByRole('button', { name: 'Thinking...' })).toBeNull();
|
|
188
|
+
expect(screen.getByTestId('card')).toHaveTextContent('Ohrid');
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it('has the reply’s actions under a finished UI-only reply, not while its UI is written', async () => {
|
|
192
|
+
const ui = makeHost();
|
|
193
|
+
const question = user('u1', 'Plan');
|
|
194
|
+
const { rerender } = await renderConversation(
|
|
195
|
+
<AIConversation
|
|
196
|
+
messages={[
|
|
197
|
+
question,
|
|
198
|
+
reply('a1', '', { content: 'Ohrid', format: 'a2ui', status: 'streaming' }),
|
|
199
|
+
]}
|
|
200
|
+
ui={ui}
|
|
201
|
+
/>,
|
|
202
|
+
);
|
|
203
|
+
expect(screen.queryByRole('button', { name: /copy/i })).toBeNull();
|
|
204
|
+
|
|
205
|
+
await rerender(
|
|
206
|
+
<AIConversation
|
|
207
|
+
messages={[
|
|
208
|
+
question,
|
|
209
|
+
reply('a1', '', { content: 'Ohrid', format: 'a2ui', status: 'complete' }),
|
|
210
|
+
]}
|
|
211
|
+
ui={ui}
|
|
212
|
+
/>,
|
|
213
|
+
);
|
|
214
|
+
expect(screen.getByRole('button', { name: /copy/i })).toBeTruthy();
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it('keeps the UI views of rows it reuses for other replies', async () => {
|
|
218
|
+
const ui = makeHost();
|
|
219
|
+
const history = Array.from({ length: 40 }, (_, turn) => [
|
|
220
|
+
user(`u${turn}`, `Question ${turn}`),
|
|
221
|
+
reply(`a${turn}`, '', { content: `Card ${turn}`, format: 'a2ui' }),
|
|
222
|
+
]).flat();
|
|
223
|
+
await renderConversation(
|
|
224
|
+
<AIConversation
|
|
225
|
+
messages={[...history, user('ul', 'Latest'), reply('al', 'Latest.')]}
|
|
226
|
+
ui={ui}
|
|
227
|
+
/>,
|
|
228
|
+
);
|
|
229
|
+
const cards = screen.getAllByTestId('card');
|
|
230
|
+
expect(screen.queryByText('Card 0')).toBeNull();
|
|
231
|
+
|
|
232
|
+
// Scrolled to the start, the rows at the end show the oldest replies.
|
|
233
|
+
act(() => {
|
|
234
|
+
fireEvent.scroll(screen.getByTestId('ai-conversation-list'), {
|
|
235
|
+
nativeEvent: {
|
|
236
|
+
contentInset: { bottom: 0, left: 0, right: 0, top: 0 },
|
|
237
|
+
contentOffset: { x: 0, y: 0 },
|
|
238
|
+
contentSize: { height: 5000, width: 400 },
|
|
239
|
+
layoutMeasurement: { height: 800, width: 400 },
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
await layOut();
|
|
244
|
+
expect(screen.getByText('Card 0')).toBeTruthy();
|
|
245
|
+
expect(screen.queryByText('Card 39')).toBeNull();
|
|
246
|
+
const shown = screen.getAllByTestId('card');
|
|
247
|
+
expect(cards.filter((card) => !shown.includes(card))).toEqual([]);
|
|
248
|
+
}, 30000);
|
|
249
|
+
|
|
250
|
+
// The Reanimated mock doesn't run an animation, so only where each one starts shows.
|
|
251
|
+
it('shows a UI from history at once, and brings one being written in', async () => {
|
|
252
|
+
await renderConversation(
|
|
253
|
+
<AIConversation
|
|
254
|
+
messages={[
|
|
255
|
+
user('u1', 'Earlier'),
|
|
256
|
+
reply('a1', '', { content: 'From history', format: 'a2ui' }),
|
|
257
|
+
user('u2', 'Plan'),
|
|
258
|
+
reply('a2', '', { content: 'Being written', format: 'a2ui', status: 'streaming' }),
|
|
259
|
+
]}
|
|
260
|
+
ui={makeHost()}
|
|
261
|
+
/>,
|
|
262
|
+
);
|
|
263
|
+
expect(stageOpacityOf('From history')).toBe(1);
|
|
264
|
+
expect(stageOpacityOf('Being written')).toBe(0);
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
it('hands the replies’ documents to the host as they change', async () => {
|
|
268
|
+
const ui = makeHost();
|
|
269
|
+
const receive = jest.spyOn(ui, 'receive');
|
|
270
|
+
const messages = [user('u1', 'Plan'), reply('a1', '', { content: 'Ohrid', format: 'a2ui' })];
|
|
271
|
+
await renderConversation(<AIConversation messages={messages} ui={ui} />);
|
|
272
|
+
expect(receive).toHaveBeenCalledWith(messages);
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
it('shows a reply’s text when its UI throws, and keeps the rest of the conversation', async () => {
|
|
276
|
+
const Throws = () => {
|
|
277
|
+
throw new Error('The map had no places');
|
|
278
|
+
};
|
|
279
|
+
const throwing: AIUIRenderer = {
|
|
280
|
+
createEngine: () => ({
|
|
281
|
+
view: (document) =>
|
|
282
|
+
document.content === 'boom' ? (
|
|
283
|
+
<Throws />
|
|
284
|
+
) : (
|
|
285
|
+
<Text testID='card'>{String(document.content)}</Text>
|
|
286
|
+
),
|
|
287
|
+
}),
|
|
288
|
+
format: 'a2ui',
|
|
289
|
+
};
|
|
290
|
+
const onRenderError = jest.fn();
|
|
291
|
+
const ui = new AIUIHost({ onRenderError, renderers: [throwing], send: jest.fn() });
|
|
292
|
+
// React reports what a boundary caught.
|
|
293
|
+
const logged = jest.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
294
|
+
await renderConversation(
|
|
295
|
+
<AIConversation
|
|
296
|
+
messages={[
|
|
297
|
+
user('u1', 'Plan'),
|
|
298
|
+
reply('a1', 'A weekend by the lake', { content: 'boom', format: 'a2ui' }),
|
|
299
|
+
user('u2', 'Again'),
|
|
300
|
+
reply('a2', 'Another', { content: 'Ohrid plan', format: 'a2ui' }),
|
|
301
|
+
]}
|
|
302
|
+
ui={ui}
|
|
303
|
+
/>,
|
|
304
|
+
);
|
|
305
|
+
await settle();
|
|
306
|
+
expect(screen.getByText('A weekend by the lake')).toBeTruthy();
|
|
307
|
+
expect(screen.getByTestId('card')).toHaveTextContent('Ohrid plan');
|
|
308
|
+
expect(onRenderError).toHaveBeenCalledTimes(1);
|
|
309
|
+
expect(onRenderError).toHaveBeenCalledWith(expect.any(Error), 'a1');
|
|
310
|
+
logged.mockRestore();
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
it('tries a reply’s UI that failed while it was written again once it is written', async () => {
|
|
314
|
+
const Throws = () => {
|
|
315
|
+
throw new Error('Half a map');
|
|
316
|
+
};
|
|
317
|
+
const throwing: AIUIRenderer = {
|
|
318
|
+
createEngine: () => ({
|
|
319
|
+
view: (document) =>
|
|
320
|
+
document.isStreaming ? <Throws /> : <Text testID='card'>{String(document.content)}</Text>,
|
|
321
|
+
}),
|
|
322
|
+
format: 'a2ui',
|
|
323
|
+
};
|
|
324
|
+
const onRenderError = jest.fn();
|
|
325
|
+
const ui = new AIUIHost({ onRenderError, renderers: [throwing], send: jest.fn() });
|
|
326
|
+
const logged = jest.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
327
|
+
const { rerender } = await renderConversation(
|
|
328
|
+
<AIConversation
|
|
329
|
+
messages={[
|
|
330
|
+
user('u1', 'Plan'),
|
|
331
|
+
reply('a1', 'A weekend by the lake', {
|
|
332
|
+
content: 'Ohrid',
|
|
333
|
+
format: 'a2ui',
|
|
334
|
+
status: 'streaming',
|
|
335
|
+
}),
|
|
336
|
+
]}
|
|
337
|
+
ui={ui}
|
|
338
|
+
/>,
|
|
339
|
+
);
|
|
340
|
+
await settle();
|
|
341
|
+
expect(screen.getByText('A weekend by the lake')).toBeTruthy();
|
|
342
|
+
await rerender(
|
|
343
|
+
<AIConversation
|
|
344
|
+
messages={[
|
|
345
|
+
user('u1', 'Plan'),
|
|
346
|
+
reply('a1', 'A weekend by the lake', { content: 'Ohrid plan', format: 'a2ui' }),
|
|
347
|
+
]}
|
|
348
|
+
ui={ui}
|
|
349
|
+
/>,
|
|
350
|
+
);
|
|
351
|
+
await settle();
|
|
352
|
+
expect(screen.getByTestId('card')).toHaveTextContent('Ohrid plan');
|
|
353
|
+
expect(onRenderError).toHaveBeenCalledTimes(1);
|
|
354
|
+
logged.mockRestore();
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
it('leaves out only an app’s component that throws, and says so once the reply is written', async () => {
|
|
358
|
+
const definition = parseAIUIComponentDefinition({
|
|
359
|
+
description: 'A map.',
|
|
360
|
+
name: 'trip_map',
|
|
361
|
+
parameters: { properties: { title: { type: 'string' } }, required: ['title'] },
|
|
362
|
+
});
|
|
363
|
+
if (!definition) throw new Error('no definition');
|
|
364
|
+
const tripMap = defineAIUIComponent<{ title: string }>(definition, ({ args }) => {
|
|
365
|
+
if (args.title === 'nowhere') throw new Error('No places');
|
|
366
|
+
return <Text testID='map'>{args.title}</Text>;
|
|
367
|
+
});
|
|
368
|
+
const withMap: AIUIRenderer = {
|
|
369
|
+
createEngine: (host) => ({
|
|
370
|
+
view: (document, messageId) => (
|
|
371
|
+
<View>
|
|
372
|
+
<Text testID='card'>Plan</Text>
|
|
373
|
+
<AIUIComponentView
|
|
374
|
+
args={{ title: String(document.content) }}
|
|
375
|
+
component={tripMap}
|
|
376
|
+
context={{ emit: jest.fn(), host, isStreaming: document.isStreaming, messageId }}
|
|
377
|
+
/>
|
|
378
|
+
</View>
|
|
379
|
+
),
|
|
380
|
+
}),
|
|
381
|
+
format: 'a2ui',
|
|
382
|
+
};
|
|
383
|
+
const onRenderError = jest.fn();
|
|
384
|
+
const ui = new AIUIHost({ onRenderError, renderers: [withMap], send: jest.fn() });
|
|
385
|
+
const logged = jest.spyOn(console, 'error').mockImplementation(() => undefined);
|
|
386
|
+
const messages = (content: string, status: string) => [
|
|
387
|
+
user('u1', 'Plan'),
|
|
388
|
+
reply('a1', 'A weekend by the lake', { content, format: 'a2ui', status }),
|
|
389
|
+
];
|
|
390
|
+
const { rerender } = await renderConversation(
|
|
391
|
+
<AIConversation messages={messages('nowhere', 'streaming')} ui={ui} />,
|
|
392
|
+
);
|
|
393
|
+
await settle();
|
|
394
|
+
expect(screen.getByTestId('card')).toBeTruthy();
|
|
395
|
+
expect(screen.queryByTestId('map')).toBeNull();
|
|
396
|
+
expect(onRenderError).not.toHaveBeenCalled();
|
|
397
|
+
|
|
398
|
+
await rerender(<AIConversation messages={messages('Ohrid', 'streaming')} ui={ui} />);
|
|
399
|
+
await settle();
|
|
400
|
+
expect(screen.getByTestId('map')).toHaveTextContent('Ohrid');
|
|
401
|
+
|
|
402
|
+
await rerender(<AIConversation messages={messages('nowhere', 'complete')} ui={ui} />);
|
|
403
|
+
await settle();
|
|
404
|
+
expect(screen.getByTestId('card')).toBeTruthy();
|
|
405
|
+
expect(screen.queryByText('A weekend by the lake')).toBeNull();
|
|
406
|
+
expect(onRenderError).toHaveBeenCalledTimes(1);
|
|
407
|
+
expect(onRenderError).toHaveBeenCalledWith(expect.any(Error), 'a1');
|
|
408
|
+
logged.mockRestore();
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
it('shows the rows again when the host says what a reply shows changed', async () => {
|
|
412
|
+
let shows = false;
|
|
413
|
+
const late: AIUIRenderer = {
|
|
414
|
+
createEngine: () => ({
|
|
415
|
+
view: (document) => (shows ? <Text testID='card'>{String(document.content)}</Text> : null),
|
|
416
|
+
}),
|
|
417
|
+
format: 'a2ui',
|
|
418
|
+
};
|
|
419
|
+
const ui = new AIUIHost({ renderers: [late], send: jest.fn() });
|
|
420
|
+
await renderConversation(
|
|
421
|
+
<AIConversation
|
|
422
|
+
messages={[
|
|
423
|
+
user('u1', 'Plan'),
|
|
424
|
+
reply('a1', 'The words', { content: 'Ohrid', format: 'a2ui' }),
|
|
425
|
+
]}
|
|
426
|
+
ui={ui}
|
|
427
|
+
/>,
|
|
428
|
+
);
|
|
429
|
+
expect(screen.getByText('The words')).toBeTruthy();
|
|
430
|
+
shows = true;
|
|
431
|
+
ui.refresh();
|
|
432
|
+
await settle();
|
|
433
|
+
expect(screen.getByTestId('card')).toHaveTextContent('Ohrid');
|
|
434
|
+
expect(screen.queryByText('The words')).toBeNull();
|
|
435
|
+
});
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
describe('AIConversation with a controller and generated UI', () => {
|
|
439
|
+
const controllerWith = (messages: AIMessage[]) =>
|
|
440
|
+
new AIConversationController({
|
|
441
|
+
transport: {
|
|
442
|
+
connect: (feed) => feed.updateMessages(messages),
|
|
443
|
+
send: () => Promise.resolve(),
|
|
444
|
+
stop: () => Promise.resolve(),
|
|
445
|
+
},
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
it('shows a reply that shows only its UI rather than the agent thinking', async () => {
|
|
449
|
+
const controller = controllerWith([
|
|
450
|
+
user('u1', 'Plan'),
|
|
451
|
+
reply(
|
|
452
|
+
'a1',
|
|
453
|
+
'',
|
|
454
|
+
{ content: 'Ohrid', format: 'a2ui', status: 'streaming' },
|
|
455
|
+
{ generating: true },
|
|
456
|
+
),
|
|
457
|
+
]);
|
|
458
|
+
expect(controller.state.getLatestValue().status).toBe('submitted');
|
|
459
|
+
|
|
460
|
+
await renderConversation(<AIConversation conversation={controller} ui={makeHost()} />);
|
|
461
|
+
|
|
462
|
+
expect(screen.queryByRole('button', { name: 'Thinking...' })).toBeNull();
|
|
463
|
+
expect(screen.getByTestId('card')).toHaveTextContent('Ohrid');
|
|
464
|
+
controller.dispose();
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
it('shows the agent thinking while nothing reads the reply’s UI', async () => {
|
|
468
|
+
const controller = controllerWith([
|
|
469
|
+
user('u1', 'Plan'),
|
|
470
|
+
reply(
|
|
471
|
+
'a1',
|
|
472
|
+
'',
|
|
473
|
+
{ content: 'x', format: 'openui', status: 'streaming' },
|
|
474
|
+
{ generating: true },
|
|
475
|
+
),
|
|
476
|
+
]);
|
|
477
|
+
|
|
478
|
+
await renderConversation(<AIConversation conversation={controller} ui={makeHost()} />);
|
|
479
|
+
|
|
480
|
+
expect(screen.getByRole('button', { name: 'Thinking...' })).toBeTruthy();
|
|
481
|
+
controller.dispose();
|
|
482
|
+
});
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
describe('AIUIView', () => {
|
|
486
|
+
it('shows one reply’s UI outside a conversation, or nothing when no renderer shows it', () => {
|
|
487
|
+
const ui = makeHost();
|
|
488
|
+
const { rerender } = render(
|
|
489
|
+
<StreamTheme>
|
|
490
|
+
<AIUIView
|
|
491
|
+
document={{ content: 'Alone', format: 'a2ui', isStreaming: false }}
|
|
492
|
+
host={ui}
|
|
493
|
+
messageId='a1'
|
|
494
|
+
/>
|
|
495
|
+
</StreamTheme>,
|
|
496
|
+
);
|
|
497
|
+
expect(screen.getByTestId('card')).toHaveTextContent('Alone');
|
|
498
|
+
rerender(
|
|
499
|
+
<StreamTheme>
|
|
500
|
+
<AIUIView
|
|
501
|
+
document={{ content: 'x', format: 'openui', isStreaming: false }}
|
|
502
|
+
host={ui}
|
|
503
|
+
messageId='a1'
|
|
504
|
+
/>
|
|
505
|
+
</StreamTheme>,
|
|
506
|
+
);
|
|
507
|
+
expect(screen.queryByTestId('card')).toBeNull();
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
it('shows another reply’s UI in the same views, as it would in its own', () => {
|
|
511
|
+
const ui = makeHost();
|
|
512
|
+
const view = (messageId: string, content: string, isStreaming: boolean) => (
|
|
513
|
+
<StreamTheme>
|
|
514
|
+
<AIUIView
|
|
515
|
+
document={{ content, format: 'a2ui', isStreaming }}
|
|
516
|
+
host={ui}
|
|
517
|
+
messageId={messageId}
|
|
518
|
+
/>
|
|
519
|
+
</StreamTheme>
|
|
520
|
+
);
|
|
521
|
+
const { rerender } = render(view('a1', 'Being written', true));
|
|
522
|
+
const card = screen.getByTestId('card');
|
|
523
|
+
expect(stageOpacityOf('Being written')).toBe(0);
|
|
524
|
+
|
|
525
|
+
rerender(view('a2', 'From history', false));
|
|
526
|
+
expect(screen.getByTestId('card')).toBe(card);
|
|
527
|
+
expect(stageOpacityOf('From history')).toBe(1);
|
|
528
|
+
|
|
529
|
+
rerender(view('a3', 'Also being written', true));
|
|
530
|
+
expect(screen.getByTestId('card')).toBe(card);
|
|
531
|
+
expect(stageOpacityOf('Also being written')).toBe(0);
|
|
532
|
+
});
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
describe('AIUIComponentView', () => {
|
|
536
|
+
const definition = parseAIUIComponentDefinition({
|
|
537
|
+
description: 'One place of a plan.',
|
|
538
|
+
events: [{ description: 'Asks about the place.', name: 'ask_about' }],
|
|
539
|
+
name: 'place_card',
|
|
540
|
+
parameters: {
|
|
541
|
+
properties: { place_note: { type: 'string' }, title: { type: 'string' } },
|
|
542
|
+
required: ['title'],
|
|
543
|
+
'x-order': ['title', 'place_note'],
|
|
544
|
+
},
|
|
545
|
+
});
|
|
546
|
+
if (!definition) throw new Error('no definition');
|
|
547
|
+
const placeCard = defineAIUIComponent<{ placeNote?: string; title: string }>(
|
|
548
|
+
definition,
|
|
549
|
+
({ args, context }) => (
|
|
550
|
+
<Pressable
|
|
551
|
+
accessibilityRole='button'
|
|
552
|
+
onPress={() =>
|
|
553
|
+
context.emit('ask_about', `Tell me more about ${args.title}`, { title: args.title })
|
|
554
|
+
}
|
|
555
|
+
>
|
|
556
|
+
<Text>
|
|
557
|
+
{args.title}
|
|
558
|
+
{args.placeNote ? ` · ${args.placeNote}` : null}
|
|
559
|
+
</Text>
|
|
560
|
+
</Pressable>
|
|
561
|
+
),
|
|
562
|
+
);
|
|
563
|
+
|
|
564
|
+
it('shows an app’s component once its arguments fit, and tells the agent what was done', () => {
|
|
565
|
+
const emit = jest.fn();
|
|
566
|
+
const context = { emit, host: makeHost(), isStreaming: true, messageId: 'a1' };
|
|
567
|
+
const { rerender } = render(
|
|
568
|
+
<AIUIComponentView
|
|
569
|
+
args={{ place_note: 'Best at' }}
|
|
570
|
+
component={placeCard}
|
|
571
|
+
context={context}
|
|
572
|
+
/>,
|
|
573
|
+
);
|
|
574
|
+
expect(screen.queryByRole('button')).toBeNull();
|
|
575
|
+
|
|
576
|
+
rerender(
|
|
577
|
+
<AIUIComponentView
|
|
578
|
+
args={{ place_note: 'Best at sunset', title: 'Kaneo' }}
|
|
579
|
+
component={placeCard}
|
|
580
|
+
context={context}
|
|
581
|
+
/>,
|
|
582
|
+
);
|
|
583
|
+
fireEvent.press(screen.getByRole('button', { name: 'Kaneo · Best at sunset' }));
|
|
584
|
+
expect(emit).toHaveBeenCalledWith('ask_about', 'Tell me more about Kaneo', { title: 'Kaneo' });
|
|
585
|
+
});
|
|
586
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type Format = typeof import('../internal/format');
|
|
2
|
+
|
|
3
|
+
const loadFormat = () => {
|
|
4
|
+
let format: Format | undefined;
|
|
5
|
+
jest.isolateModules(() => {
|
|
6
|
+
format = require('../internal/format');
|
|
7
|
+
});
|
|
8
|
+
return format as Format;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
describe('formatCallDuration', () => {
|
|
12
|
+
afterEach(() => jest.restoreAllMocks());
|
|
13
|
+
|
|
14
|
+
it('writes narrow units', () => {
|
|
15
|
+
const { formatCallDuration, formatMinutesAndSeconds } = loadFormat();
|
|
16
|
+
expect(formatCallDuration(0.42)).toBe('0.4s');
|
|
17
|
+
expect(formatCallDuration(65)).toBe('1m 5s');
|
|
18
|
+
expect(formatMinutesAndSeconds(120)).toBe('2m');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('writes the same where Intl ignores the narrow width, as Hermes on iOS does', () => {
|
|
22
|
+
jest
|
|
23
|
+
.spyOn(Intl, 'NumberFormat')
|
|
24
|
+
.mockImplementation(
|
|
25
|
+
() => ({ format: (value: number) => `${value} sec` }) as unknown as Intl.NumberFormat,
|
|
26
|
+
);
|
|
27
|
+
const { formatCallDuration, formatMinutesAndSeconds } = loadFormat();
|
|
28
|
+
expect(formatCallDuration(0.42)).toBe('0.4s');
|
|
29
|
+
expect(formatCallDuration(65)).toBe('1m 5s');
|
|
30
|
+
expect(formatMinutesAndSeconds(7)).toBe('7s');
|
|
31
|
+
});
|
|
32
|
+
});
|