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,590 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
type ComponentType,
|
|
3
|
+
createContext,
|
|
4
|
+
memo,
|
|
5
|
+
type ReactNode,
|
|
6
|
+
useContext,
|
|
7
|
+
useMemo,
|
|
8
|
+
useState,
|
|
9
|
+
} from 'react';
|
|
10
|
+
import { type LayoutChangeEvent, StyleSheet, View } from 'react-native';
|
|
11
|
+
import Animated, { Easing, FadeIn } from 'react-native-reanimated';
|
|
12
|
+
|
|
13
|
+
import type { LegendListRenderItemProps } from '@legendapp/list/react-native';
|
|
14
|
+
|
|
15
|
+
import type {
|
|
16
|
+
AIConversationController,
|
|
17
|
+
AIConversationControllerState,
|
|
18
|
+
} from './controller/AIConversationController';
|
|
19
|
+
import { editActionOf, replyActionsOf } from './controller/offers';
|
|
20
|
+
import { useAIConversationState } from './controller/useAIConversationState';
|
|
21
|
+
import type { AIConversationEntry } from './entries';
|
|
22
|
+
import { AIChatList } from './list/AIChatList';
|
|
23
|
+
import type { AIMessage, AIPendingMessage } from './types';
|
|
24
|
+
import { type ConversationRow, type RowPosition, useConversationRows } from './useConversationRows';
|
|
25
|
+
|
|
26
|
+
import { useTheme } from '../contexts';
|
|
27
|
+
import type { AIUIHost } from '../generative-ui/AIUIHost';
|
|
28
|
+
import { AIUIGenerated, useAIUIHostRefresh } from '../generative-ui/AIUIView';
|
|
29
|
+
import { primitives } from '../internal/tokens';
|
|
30
|
+
import { AIAssistantMessage } from '../message/AIAssistantMessage';
|
|
31
|
+
import type { AIMessageAttachmentData } from '../message/AIMessageAttachment';
|
|
32
|
+
import { AIReplyActions, type AIReplyActionsProps } from '../message/AIReplyActions';
|
|
33
|
+
import { AIUserMessage } from '../message/AIUserMessage';
|
|
34
|
+
import type { AIMessagePartData } from '../message-parts/types';
|
|
35
|
+
import { AIThinking } from '../reasoning/AIReasoning';
|
|
36
|
+
import { type AIThinkingClock, AIThinkingTurnContext } from '../reasoning/thinkingClock';
|
|
37
|
+
import { type AIToolApprover, AIToolApproverProvider } from '../tool-calls/AIToolApprover';
|
|
38
|
+
|
|
39
|
+
export type AIConversationUserMessageProps = {
|
|
40
|
+
/** What the person sent with it, such as images and files. */
|
|
41
|
+
attachments: AIMessageAttachmentData[];
|
|
42
|
+
/** What the person wrote. */
|
|
43
|
+
text: string;
|
|
44
|
+
/** The message, or `undefined` for one on its way. */
|
|
45
|
+
message?: AIMessage;
|
|
46
|
+
/** Edits the message: a `conversation` offers it on the person's latest message. */
|
|
47
|
+
onEdit?: () => void;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type AIConversationAssistantMessageProps = {
|
|
51
|
+
attachments: AIMessageAttachmentData[];
|
|
52
|
+
isGenerating: boolean;
|
|
53
|
+
message: AIMessage;
|
|
54
|
+
parts: AIMessagePartData[];
|
|
55
|
+
text: string;
|
|
56
|
+
approver?: AIToolApprover;
|
|
57
|
+
/**
|
|
58
|
+
* Called when the answer starts or stops being typed out. The reply's actions wait until it is
|
|
59
|
+
* done. A view that never calls it has its actions shown once the reply is finished.
|
|
60
|
+
*/
|
|
61
|
+
onWritingChange?: (isWriting: boolean) => void;
|
|
62
|
+
reasoningText?: (stepId: string) => string | undefined;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export type AIConversationReplyActionsProps = {
|
|
66
|
+
/** Whether it is the reply that ends the conversation, which can be asked for again. */
|
|
67
|
+
isLatestReply: boolean;
|
|
68
|
+
message: AIMessage;
|
|
69
|
+
text: string;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export type AIConversationProps = {
|
|
73
|
+
/**
|
|
74
|
+
* The conversation's state and what the person does in it. The conversation shows its messages,
|
|
75
|
+
* the message on its way and the agent thinking, loads older messages through it, and offers
|
|
76
|
+
* its actions: editing the person's latest message, and rating and regenerating replies. It
|
|
77
|
+
* takes the place of `messages`, `pendingMessage`, `isThinking`, `loadOlderMessages` and
|
|
78
|
+
* `replyActions`, and gives its `approver` unless one is passed.
|
|
79
|
+
*/
|
|
80
|
+
conversation?: AIConversationController;
|
|
81
|
+
/** The conversation, oldest message first. Required without `conversation`. */
|
|
82
|
+
messages?: AIMessage[];
|
|
83
|
+
/** Who answers tool calls' questions and sign-ins on this device, to ask them. */
|
|
84
|
+
approver?: AIToolApprover;
|
|
85
|
+
/**
|
|
86
|
+
* The view of the agent's replies. Defaults to `AIAssistantMessage`.
|
|
87
|
+
*
|
|
88
|
+
* The list reuses its rows: a view scrolled out of sight renders another reply next, so state a
|
|
89
|
+
* view keeps of its own has to start afresh for a new `message.id` (such as with a `key`).
|
|
90
|
+
* The same holds for `UserMessage` and `ReplyActions`.
|
|
91
|
+
*/
|
|
92
|
+
AssistantMessage?: ComponentType<AIConversationAssistantMessageProps>;
|
|
93
|
+
/**
|
|
94
|
+
* Room left under the latest turn, for a composer floating over the bottom of the conversation.
|
|
95
|
+
* The question of a new turn pins to the top of what is visible above it.
|
|
96
|
+
*/
|
|
97
|
+
bottomInset?: number;
|
|
98
|
+
/** What the conversation shows while there are no messages, centered in it. */
|
|
99
|
+
emptyContent?: ReactNode;
|
|
100
|
+
/** A view under the latest turn's messages, such as what the agent is doing, or an error with a way to retry. */
|
|
101
|
+
footer?: ReactNode;
|
|
102
|
+
/**
|
|
103
|
+
* How far above the bottom of the screen the composer sits, such as above a tab bar. The
|
|
104
|
+
* keyboard comes up over the conversation, which makes room for it below the latest turn (the
|
|
105
|
+
* room the pinned question leaves takes it first), and covers it only as far as it rises past
|
|
106
|
+
* this. Defaults to the bottom safe area. Needs a `KeyboardProvider` from
|
|
107
|
+
* react-native-keyboard-controller above it.
|
|
108
|
+
*/
|
|
109
|
+
keyboardOffset?: number;
|
|
110
|
+
/**
|
|
111
|
+
* Whether the agent is answering the latest message and its reply shows nothing yet.
|
|
112
|
+
* Meanwhile the latest turn ends with `AIThinking`, and the reply's first reasoning step takes
|
|
113
|
+
* over its seconds. The conversation also knows it is while `pendingMessage` waits, and while
|
|
114
|
+
* the latest reply is being written but shows nothing.
|
|
115
|
+
*/
|
|
116
|
+
isThinking?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Loads the messages before the first one, which the conversation asks for as the person
|
|
119
|
+
* scrolls to its start. It shows a spinner meanwhile, and what is on screen stays in place as
|
|
120
|
+
* they arrive. Pass `undefined` once there are none left.
|
|
121
|
+
*/
|
|
122
|
+
loadOlderMessages?: () => Promise<void> | void;
|
|
123
|
+
/**
|
|
124
|
+
* A message the person sent that is not in `messages` yet. Keep passing it until its reply
|
|
125
|
+
* starts: the conversation stops showing it once its copy arrives.
|
|
126
|
+
*/
|
|
127
|
+
pendingMessage?: AIPendingMessage | null;
|
|
128
|
+
/** The actions under each finished reply. Defaults to `AIReplyActions`; `null` shows none. */
|
|
129
|
+
ReplyActions?: ComponentType<AIConversationReplyActionsProps> | null;
|
|
130
|
+
/**
|
|
131
|
+
* What the default `AIReplyActions` offers for a reply besides copy and share, such as its
|
|
132
|
+
* rating and how to rate or regenerate it. Every message renders again when it changes, so keep
|
|
133
|
+
* it the same between renders (`useCallback`) unless what it returns changed.
|
|
134
|
+
*/
|
|
135
|
+
replyActions?: (
|
|
136
|
+
message: AIMessage,
|
|
137
|
+
context: { isLatestReply: boolean },
|
|
138
|
+
) => Omit<AIReplyActionsProps, 'text'> | undefined;
|
|
139
|
+
/**
|
|
140
|
+
* Shows the UI the agent writes for its replies (`AIMessage.uiDocument`) in place of their
|
|
141
|
+
* text, with the renderers of the formats it writes, such as A2UI. A reply whose UI none of
|
|
142
|
+
* them shows shows its text. Keep one host per conversation, for as long as it shows.
|
|
143
|
+
*
|
|
144
|
+
* The list reuses its rows for the UI too: an app's component keeping state of its own has to
|
|
145
|
+
* start afresh for a new `context.messageId`.
|
|
146
|
+
*/
|
|
147
|
+
ui?: AIUIHost;
|
|
148
|
+
/** The view of the person's messages. Defaults to `AIUserMessage`. */
|
|
149
|
+
UserMessage?: ComponentType<AIConversationUserMessageProps>;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const DefaultUserMessage = ({ attachments, onEdit, text }: AIConversationUserMessageProps) => (
|
|
153
|
+
<AIUserMessage attachments={attachments} onEdit={onEdit} text={text} />
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
const DefaultAssistantMessage = ({
|
|
157
|
+
approver,
|
|
158
|
+
attachments,
|
|
159
|
+
isGenerating,
|
|
160
|
+
message,
|
|
161
|
+
onWritingChange,
|
|
162
|
+
parts,
|
|
163
|
+
reasoningText,
|
|
164
|
+
text,
|
|
165
|
+
}: AIConversationAssistantMessageProps) => (
|
|
166
|
+
<AIAssistantMessage
|
|
167
|
+
approver={approver}
|
|
168
|
+
attachments={attachments}
|
|
169
|
+
id={message.id}
|
|
170
|
+
isGenerating={isGenerating}
|
|
171
|
+
onWritingChange={onWritingChange}
|
|
172
|
+
parts={parts}
|
|
173
|
+
reasoningText={reasoningText}
|
|
174
|
+
text={text}
|
|
175
|
+
/>
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
// What every row reads, rather than each row's item carrying it: a row renders again only when
|
|
179
|
+
// its item is a new object, or when this changes.
|
|
180
|
+
// The tallest each row of the latest turn has been, by row key. The turn never shrinks while it is
|
|
181
|
+
// the latest: the room the list leaves under it to keep its question at the top follows a row that
|
|
182
|
+
// shrinks (a sign-in going, reasoning folding, the thinking going) only a frame later, and in that
|
|
183
|
+
// frame the question would be pulled down. Below a pinned turn there is room anyway, so it looks
|
|
184
|
+
// the same, and the room stays the list's, which the keyboard takes before it lifts anything.
|
|
185
|
+
type TurnFloor = { heights: Map<string, number>; turnKey: string | undefined };
|
|
186
|
+
|
|
187
|
+
type ConversationContextValue = {
|
|
188
|
+
AssistantMessage: ComponentType<AIConversationAssistantMessageProps>;
|
|
189
|
+
clock: AIThinkingClock;
|
|
190
|
+
turnFloor: TurnFloor;
|
|
191
|
+
ReplyActions: ComponentType<AIConversationReplyActionsProps> | null;
|
|
192
|
+
UserMessage: ComponentType<AIConversationUserMessageProps>;
|
|
193
|
+
approver?: AIToolApprover;
|
|
194
|
+
editAction?: EditAction;
|
|
195
|
+
replyActions?: AIConversationProps['replyActions'];
|
|
196
|
+
ui?: AIUIHost;
|
|
197
|
+
/** Changes each time the host says what a reply shows changed, so the rows render again. */
|
|
198
|
+
uiVersion: number;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
// How the person edits one of their messages, when they can.
|
|
202
|
+
type EditAction = (message: AIMessage) => (() => void) | undefined;
|
|
203
|
+
|
|
204
|
+
const ConversationContext = createContext<ConversationContextValue | undefined>(undefined);
|
|
205
|
+
|
|
206
|
+
// From the design tokens: turns 8 apart, each with 16 above it, its messages 16 apart, and 16
|
|
207
|
+
// around the whole.
|
|
208
|
+
const ROW_GAPS: Record<RowPosition, number> = {
|
|
209
|
+
message: primitives.spacingMd,
|
|
210
|
+
turn: primitives.spacingXs + primitives.spacingMd,
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
type EntryViewProps = {
|
|
214
|
+
AssistantMessage: ComponentType<AIConversationAssistantMessageProps>;
|
|
215
|
+
entry: AIConversationEntry;
|
|
216
|
+
editAction?: EditAction;
|
|
217
|
+
ReplyActions: ComponentType<AIConversationReplyActionsProps> | null;
|
|
218
|
+
UserMessage: ComponentType<AIConversationUserMessageProps>;
|
|
219
|
+
approver?: AIToolApprover;
|
|
220
|
+
thinkingSince?: number;
|
|
221
|
+
ui?: AIUIHost;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const NO_MESSAGES: AIMessage[] = [];
|
|
225
|
+
|
|
226
|
+
const REPLY_ACTIONS_IN = FadeIn.duration(200).easing(Easing.out(Easing.ease));
|
|
227
|
+
|
|
228
|
+
const useReplyWriting = (messageId: string | undefined, isGenerating: boolean) => {
|
|
229
|
+
const [writing, setWriting] = useState<string>();
|
|
230
|
+
const [watched, setWatched] = useState<string>();
|
|
231
|
+
const isWriting = !!messageId && writing === messageId;
|
|
232
|
+
if (messageId && (isGenerating || isWriting) && watched !== messageId) setWatched(messageId);
|
|
233
|
+
const onWritingChange = useMemo(
|
|
234
|
+
() => (value: boolean) =>
|
|
235
|
+
setWriting((current) => (value ? messageId : current === messageId ? undefined : current)),
|
|
236
|
+
[messageId],
|
|
237
|
+
);
|
|
238
|
+
return { isWriting, onWritingChange, wasWatched: !!messageId && watched === messageId };
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
const EntryView = ({
|
|
242
|
+
approver,
|
|
243
|
+
AssistantMessage,
|
|
244
|
+
editAction,
|
|
245
|
+
entry,
|
|
246
|
+
ReplyActions,
|
|
247
|
+
thinkingSince,
|
|
248
|
+
ui,
|
|
249
|
+
UserMessage,
|
|
250
|
+
}: EntryViewProps) => {
|
|
251
|
+
const { message, pending } = entry;
|
|
252
|
+
const isReply = message?.role !== 'user';
|
|
253
|
+
const isGenerating = !!message?.isGenerating;
|
|
254
|
+
const { isWriting, onWritingChange, wasWatched } = useReplyWriting(
|
|
255
|
+
isReply ? message?.id : undefined,
|
|
256
|
+
isGenerating,
|
|
257
|
+
);
|
|
258
|
+
if (!message) {
|
|
259
|
+
return pending ? (
|
|
260
|
+
<UserMessage attachments={pending.attachments ?? []} text={pending.text} />
|
|
261
|
+
) : null;
|
|
262
|
+
}
|
|
263
|
+
if (message.role === 'user') {
|
|
264
|
+
return (
|
|
265
|
+
<UserMessage
|
|
266
|
+
attachments={
|
|
267
|
+
entry.sentAttachments.length ? entry.sentAttachments : (message.attachments ?? [])
|
|
268
|
+
}
|
|
269
|
+
message={message}
|
|
270
|
+
onEdit={editAction?.(message)}
|
|
271
|
+
text={message.text}
|
|
272
|
+
/>
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
// The UI the agent generated for the reply, when one of the host's renderers shows it. It
|
|
276
|
+
// shows in place of the reply's text, after the reply's steps.
|
|
277
|
+
const { uiDocument } = message;
|
|
278
|
+
const generated = ui && uiDocument ? ui.content(uiDocument, message.id) : null;
|
|
279
|
+
const showsUI = !!uiDocument && generated !== null && generated !== undefined;
|
|
280
|
+
// A finished reply has its actions under it whether it answers in text or in UI, once the
|
|
281
|
+
// UI is written.
|
|
282
|
+
const hasAnswer = message.text !== '' || showsUI;
|
|
283
|
+
const isWritingUI = showsUI && uiDocument.isStreaming;
|
|
284
|
+
return (
|
|
285
|
+
<View style={styles.reply}>
|
|
286
|
+
<AssistantMessage
|
|
287
|
+
approver={approver}
|
|
288
|
+
attachments={message.attachments ?? []}
|
|
289
|
+
isGenerating={isGenerating}
|
|
290
|
+
message={message}
|
|
291
|
+
onWritingChange={onWritingChange}
|
|
292
|
+
parts={message.parts ?? []}
|
|
293
|
+
reasoningText={message.reasoningText}
|
|
294
|
+
text={showsUI ? '' : message.text}
|
|
295
|
+
/>
|
|
296
|
+
{showsUI ? (
|
|
297
|
+
<AIUIGenerated
|
|
298
|
+
isStreaming={uiDocument.isStreaming}
|
|
299
|
+
messageId={message.id}
|
|
300
|
+
onError={(error) => ui?.fail(message.id, error)}
|
|
301
|
+
>
|
|
302
|
+
{generated}
|
|
303
|
+
</AIUIGenerated>
|
|
304
|
+
) : null}
|
|
305
|
+
{thinkingSince !== undefined ? <AIThinking since={thinkingSince} /> : null}
|
|
306
|
+
{ReplyActions && !isGenerating && !isWriting && hasAnswer && !isWritingUI ? (
|
|
307
|
+
<Animated.View entering={wasWatched ? REPLY_ACTIONS_IN : undefined}>
|
|
308
|
+
<ReplyActions isLatestReply={entry.isLatestReply} message={message} text={message.text} />
|
|
309
|
+
</Animated.View>
|
|
310
|
+
) : null}
|
|
311
|
+
</View>
|
|
312
|
+
);
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
const Row = memo(({ row }: { row: ConversationRow }) => {
|
|
316
|
+
const context = useContext(ConversationContext);
|
|
317
|
+
const {
|
|
318
|
+
theme: { conversation },
|
|
319
|
+
} = useTheme();
|
|
320
|
+
const clock = context?.clock;
|
|
321
|
+
const turn = useMemo(
|
|
322
|
+
() => (clock ? { clock, firstStepId: row.firstStepId, key: row.turnKey } : undefined),
|
|
323
|
+
[clock, row.firstStepId, row.turnKey],
|
|
324
|
+
);
|
|
325
|
+
// Only the latest turn's rows keep a floor, read here so a row reused for another starts from
|
|
326
|
+
// that row's floor. A plain view and state rather than an animated style: every row of a list
|
|
327
|
+
// that scrolls fast mounts and is reused all the time, and an animated style costs each of them
|
|
328
|
+
// a worklet sent to the UI thread. The floor only rises, long before a row shrinks, so it can
|
|
329
|
+
// follow a frame after the row grows.
|
|
330
|
+
const turnFloor = context?.turnFloor;
|
|
331
|
+
const isHeld = !!turnFloor && row.turnKey === turnFloor.turnKey;
|
|
332
|
+
const floor = isHeld ? (turnFloor?.heights.get(row.key) ?? 0) : 0;
|
|
333
|
+
const [, setFloorRaised] = useState(0);
|
|
334
|
+
const onLayout = isHeld
|
|
335
|
+
? ({ nativeEvent }: LayoutChangeEvent) => {
|
|
336
|
+
const height = nativeEvent.layout.height;
|
|
337
|
+
if (height <= (turnFloor?.heights.get(row.key) ?? 0)) return;
|
|
338
|
+
turnFloor?.heights.set(row.key, height);
|
|
339
|
+
setFloorRaised((count) => count + 1);
|
|
340
|
+
}
|
|
341
|
+
: undefined;
|
|
342
|
+
// The same element while only the floor changes, so raising it renders nothing inside.
|
|
343
|
+
const content = useMemo(
|
|
344
|
+
() =>
|
|
345
|
+
context ? (
|
|
346
|
+
<AIThinkingTurnContext.Provider value={turn}>
|
|
347
|
+
{row.kind === 'entry' ? (
|
|
348
|
+
<EntryView
|
|
349
|
+
approver={context.approver}
|
|
350
|
+
AssistantMessage={context.AssistantMessage}
|
|
351
|
+
editAction={context.editAction}
|
|
352
|
+
entry={row.entry}
|
|
353
|
+
ReplyActions={context.ReplyActions}
|
|
354
|
+
thinkingSince={row.thinkingSince}
|
|
355
|
+
ui={context.ui}
|
|
356
|
+
UserMessage={context.UserMessage}
|
|
357
|
+
/>
|
|
358
|
+
) : (
|
|
359
|
+
<>
|
|
360
|
+
{row.isThinking ? <AIThinking /> : null}
|
|
361
|
+
{row.footer}
|
|
362
|
+
</>
|
|
363
|
+
)}
|
|
364
|
+
</AIThinkingTurnContext.Provider>
|
|
365
|
+
) : null,
|
|
366
|
+
[context, row, turn],
|
|
367
|
+
);
|
|
368
|
+
if (!context) return null;
|
|
369
|
+
return (
|
|
370
|
+
<View
|
|
371
|
+
onLayout={onLayout}
|
|
372
|
+
style={[
|
|
373
|
+
styles.row,
|
|
374
|
+
{ paddingTop: row.kind === 'entry' ? ROW_GAPS[row.position] : primitives.spacingMd },
|
|
375
|
+
floor > 0 ? { minHeight: floor } : null,
|
|
376
|
+
conversation?.row,
|
|
377
|
+
]}
|
|
378
|
+
>
|
|
379
|
+
{content}
|
|
380
|
+
</View>
|
|
381
|
+
);
|
|
382
|
+
});
|
|
383
|
+
Row.displayName = 'AIConversationRow';
|
|
384
|
+
|
|
385
|
+
const renderRow = ({ item }: LegendListRenderItemProps<ConversationRow>) => <Row row={item} />;
|
|
386
|
+
|
|
387
|
+
const keyOf = (row: ConversationRow) => row.key;
|
|
388
|
+
|
|
389
|
+
// A row reused for another takes one of its kind, which renders the same views, and the list
|
|
390
|
+
// estimates a row it hasn't measured from the others of its kind. A person's message with photos
|
|
391
|
+
// or files is a kind of its own, several times taller than one with only text. A row never
|
|
392
|
+
// changes kind, which would remount it: a reply gains steps and UI as it is written, so replies
|
|
393
|
+
// are one kind.
|
|
394
|
+
const typeOf = (row: ConversationRow) => {
|
|
395
|
+
if (row.kind === 'tail') return 'tail';
|
|
396
|
+
const { entry } = row;
|
|
397
|
+
if (!entry.isFromUser) return 'assistant';
|
|
398
|
+
const hasAttachments =
|
|
399
|
+
entry.sentAttachments.length > 0 ||
|
|
400
|
+
!!entry.pending?.attachments?.length ||
|
|
401
|
+
!!entry.message?.attachments?.length;
|
|
402
|
+
return hasAttachments ? 'user-attachments' : 'user';
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
// `AIReplyActions` with what the conversation's `replyActions` offers for the reply.
|
|
406
|
+
const DefaultConversationReplyActions = ({
|
|
407
|
+
isLatestReply,
|
|
408
|
+
message,
|
|
409
|
+
text,
|
|
410
|
+
}: AIConversationReplyActionsProps) => {
|
|
411
|
+
const offered = useContext(ConversationContext)?.replyActions;
|
|
412
|
+
return <AIReplyActions {...offered?.(message, { isLatestReply })} text={text} />;
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* The conversation with an AI agent, laid out by turn: each of the person's questions starts a
|
|
417
|
+
* turn, with the agent's reply under it.
|
|
418
|
+
*
|
|
419
|
+
* - A new question pins to the top of what is visible, and the reply writes out below it,
|
|
420
|
+
* without moving what is on screen. The latest turn is at least as tall as the conversation.
|
|
421
|
+
* - It opens at the end; older messages load as the person scrolls to the start, and what is on
|
|
422
|
+
* screen stays in place as they arrive.
|
|
423
|
+
* - A button scrolls back to the latest message when the end is out of view.
|
|
424
|
+
* - A message the person sent shows at once (`pendingMessage`) and the agent thinks under it
|
|
425
|
+
* (`AIThinking`) until its reply shows something.
|
|
426
|
+
*/
|
|
427
|
+
export const AIConversation = (props: AIConversationProps) =>
|
|
428
|
+
props.conversation ? (
|
|
429
|
+
<ControlledConversation {...props} conversation={props.conversation} />
|
|
430
|
+
) : (
|
|
431
|
+
<ConversationView {...props} />
|
|
432
|
+
);
|
|
433
|
+
|
|
434
|
+
const controlledSelector = ({
|
|
435
|
+
hasOlderMessages,
|
|
436
|
+
messages,
|
|
437
|
+
pendingMessage,
|
|
438
|
+
ratings,
|
|
439
|
+
status,
|
|
440
|
+
}: AIConversationControllerState) => ({
|
|
441
|
+
hasOlderMessages,
|
|
442
|
+
messages,
|
|
443
|
+
pendingMessage,
|
|
444
|
+
ratings,
|
|
445
|
+
status,
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
// The conversation as its controller has it. The controller knows when its agent is thinking,
|
|
449
|
+
// including after a stop or a failure that leaves the person's message on its way.
|
|
450
|
+
const ControlledConversation = ({
|
|
451
|
+
conversation,
|
|
452
|
+
...props
|
|
453
|
+
}: AIConversationProps & { conversation: AIConversationController }) => {
|
|
454
|
+
const { hasOlderMessages, messages, pendingMessage, ratings, status } = useAIConversationState(
|
|
455
|
+
conversation,
|
|
456
|
+
controlledSelector,
|
|
457
|
+
);
|
|
458
|
+
const replyActions = useMemo(
|
|
459
|
+
() =>
|
|
460
|
+
(message: AIMessage, { isLatestReply }: { isLatestReply: boolean }) =>
|
|
461
|
+
replyActionsOf(conversation, { ratings, status }, message, isLatestReply),
|
|
462
|
+
[conversation, ratings, status],
|
|
463
|
+
);
|
|
464
|
+
const editAction = useMemo<EditAction>(
|
|
465
|
+
() => (message) => editActionOf(conversation, { messages, status }, message),
|
|
466
|
+
[conversation, messages, status],
|
|
467
|
+
);
|
|
468
|
+
const { ui } = props;
|
|
469
|
+
// A reply that shows only its UI has started, which the controller can't tell without the
|
|
470
|
+
// host that reads it.
|
|
471
|
+
const last = messages[messages.length - 1];
|
|
472
|
+
const showsReply =
|
|
473
|
+
!!last && last.role !== 'user' && !!last.uiDocument && !!ui?.canShow(last.uiDocument);
|
|
474
|
+
return (
|
|
475
|
+
<ConversationView
|
|
476
|
+
{...props}
|
|
477
|
+
approver={props.approver ?? conversation.approver}
|
|
478
|
+
editAction={editAction}
|
|
479
|
+
isThinking={status === 'submitted' && !showsReply}
|
|
480
|
+
isThinkingKnown
|
|
481
|
+
loadOlderMessages={hasOlderMessages ? conversation.loadOlderMessages : undefined}
|
|
482
|
+
messages={messages as AIMessage[]}
|
|
483
|
+
pendingMessage={pendingMessage}
|
|
484
|
+
replyActions={props.replyActions ?? replyActions}
|
|
485
|
+
/>
|
|
486
|
+
);
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
type ConversationViewProps = AIConversationProps & {
|
|
490
|
+
editAction?: EditAction;
|
|
491
|
+
// Whether `isThinking` alone says whether the agent is thinking.
|
|
492
|
+
isThinkingKnown?: boolean;
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
const ConversationView = ({
|
|
496
|
+
approver,
|
|
497
|
+
AssistantMessage = DefaultAssistantMessage,
|
|
498
|
+
bottomInset = 0,
|
|
499
|
+
editAction,
|
|
500
|
+
emptyContent,
|
|
501
|
+
footer,
|
|
502
|
+
isThinking = false,
|
|
503
|
+
isThinkingKnown,
|
|
504
|
+
keyboardOffset,
|
|
505
|
+
loadOlderMessages,
|
|
506
|
+
messages = NO_MESSAGES,
|
|
507
|
+
pendingMessage,
|
|
508
|
+
ReplyActions: ReplyActionsProp,
|
|
509
|
+
replyActions,
|
|
510
|
+
ui,
|
|
511
|
+
UserMessage = DefaultUserMessage,
|
|
512
|
+
}: ConversationViewProps) => {
|
|
513
|
+
// Every reply's UI reaches its renderer before any row asks for its view, oldest first,
|
|
514
|
+
// whether or not the row is on screen. Only what arrived or changed is passed on. The rows
|
|
515
|
+
// show again when the host says what one of them shows changed.
|
|
516
|
+
const uiVersion = useAIUIHostRefresh(ui);
|
|
517
|
+
ui?.receive(messages);
|
|
518
|
+
const canShowUI = useMemo(() => (ui ? ui.canShow.bind(ui) : undefined), [ui]);
|
|
519
|
+
const { anchorKey, clock, rows } = useConversationRows({
|
|
520
|
+
canShowUI,
|
|
521
|
+
footer,
|
|
522
|
+
isThinking,
|
|
523
|
+
isThinkingKnown,
|
|
524
|
+
messages,
|
|
525
|
+
pendingMessage,
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
const ReplyActions =
|
|
529
|
+
ReplyActionsProp === undefined ? DefaultConversationReplyActions : ReplyActionsProp;
|
|
530
|
+
|
|
531
|
+
const latestTurnKey = useMemo(
|
|
532
|
+
() => rows.find((row) => row.key === anchorKey)?.turnKey,
|
|
533
|
+
[anchorKey, rows],
|
|
534
|
+
);
|
|
535
|
+
const turnFloor = useMemo<TurnFloor>(
|
|
536
|
+
() => ({ heights: new Map(), turnKey: latestTurnKey }),
|
|
537
|
+
[latestTurnKey],
|
|
538
|
+
);
|
|
539
|
+
|
|
540
|
+
const contextValue = useMemo<ConversationContextValue>(
|
|
541
|
+
() => ({
|
|
542
|
+
approver,
|
|
543
|
+
AssistantMessage,
|
|
544
|
+
clock,
|
|
545
|
+
editAction,
|
|
546
|
+
ReplyActions,
|
|
547
|
+
replyActions,
|
|
548
|
+
turnFloor,
|
|
549
|
+
ui,
|
|
550
|
+
uiVersion,
|
|
551
|
+
UserMessage,
|
|
552
|
+
}),
|
|
553
|
+
[
|
|
554
|
+
approver,
|
|
555
|
+
AssistantMessage,
|
|
556
|
+
clock,
|
|
557
|
+
editAction,
|
|
558
|
+
ReplyActions,
|
|
559
|
+
replyActions,
|
|
560
|
+
turnFloor,
|
|
561
|
+
ui,
|
|
562
|
+
uiVersion,
|
|
563
|
+
UserMessage,
|
|
564
|
+
],
|
|
565
|
+
);
|
|
566
|
+
|
|
567
|
+
return (
|
|
568
|
+
<AIToolApproverProvider approver={approver}>
|
|
569
|
+
<ConversationContext.Provider value={contextValue}>
|
|
570
|
+
<AIChatList
|
|
571
|
+
anchorKey={anchorKey}
|
|
572
|
+
bottomInset={bottomInset}
|
|
573
|
+
data={rows}
|
|
574
|
+
emptyContent={emptyContent}
|
|
575
|
+
getItemType={typeOf}
|
|
576
|
+
keyboardOffset={keyboardOffset}
|
|
577
|
+
keyExtractor={keyOf}
|
|
578
|
+
loadOlderMessages={loadOlderMessages}
|
|
579
|
+
renderItem={renderRow}
|
|
580
|
+
testID='ai-conversation'
|
|
581
|
+
/>
|
|
582
|
+
</ConversationContext.Provider>
|
|
583
|
+
</AIToolApproverProvider>
|
|
584
|
+
);
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
const styles = StyleSheet.create({
|
|
588
|
+
reply: { gap: 8 },
|
|
589
|
+
row: { paddingHorizontal: primitives.spacingMd },
|
|
590
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agent couldn't answer: it said so, with what it said as `agentMessage`, or it didn't start
|
|
3
|
+
* its reply in time.
|
|
4
|
+
*/
|
|
5
|
+
export class AIAgentError extends Error {
|
|
6
|
+
/** What the agent said about it, if anything. */
|
|
7
|
+
readonly agentMessage?: string;
|
|
8
|
+
|
|
9
|
+
constructor(agentMessage?: string) {
|
|
10
|
+
super(agentMessage || 'The agent couldn’t answer. Try again.');
|
|
11
|
+
this.name = 'AIAgentError';
|
|
12
|
+
this.agentMessage = agentMessage || undefined;
|
|
13
|
+
}
|
|
14
|
+
}
|