stream-chat-react-native-core 9.12.1 → 9.14.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/ai-components/conversation/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 +237 -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 +64 -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 +374 -0
- package/lib/commonjs/ai-components/conversation/AIConversation.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/index.js +15 -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 +53 -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/useConversationRows.js +117 -0
- package/lib/commonjs/ai-components/conversation/useConversationRows.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/controller/AIAgentError.js +13 -0
- package/lib/commonjs/ai-components/conversation-state/controller/AIAgentError.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/controller/AIConversationController.js +431 -0
- package/lib/commonjs/ai-components/conversation-state/controller/AIConversationController.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/controller/AIConversationExchange.js +89 -0
- package/lib/commonjs/ai-components/conversation-state/controller/AIConversationExchange.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/controller/index.js +48 -0
- package/lib/commonjs/ai-components/conversation-state/controller/index.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/controller/offers.js +35 -0
- package/lib/commonjs/ai-components/conversation-state/controller/offers.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/controller/types.js +13 -0
- package/lib/commonjs/ai-components/conversation-state/controller/types.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/controller/useAIConversationState.js +8 -0
- package/lib/commonjs/ai-components/conversation-state/controller/useAIConversationState.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/fromStreamMessage.js +67 -0
- package/lib/commonjs/ai-components/conversation-state/fromStreamMessage.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/index.js +37 -0
- package/lib/commonjs/ai-components/conversation-state/index.js.map +1 -0
- package/lib/commonjs/ai-components/conversation-state/types.js +4 -0
- package/lib/commonjs/ai-components/conversation-state/types.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 +197 -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/keyboard.js +40 -0
- package/lib/commonjs/ai-components/internal/keyboard.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 +64 -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 +4 -2
- 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 +146 -20
- package/lib/commonjs/ai-components/message-composer/ComposerView.js.map +1 -1
- package/lib/commonjs/ai-components/message-composer/EditingMessageChip.js +81 -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 +133 -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 +40 -1
- package/lib/commonjs/i18n/en.json +40 -1
- package/lib/commonjs/i18n/es.json +40 -1
- package/lib/commonjs/i18n/fr.json +40 -1
- package/lib/commonjs/i18n/he.json +40 -1
- package/lib/commonjs/i18n/hi.json +40 -1
- package/lib/commonjs/i18n/it.json +40 -1
- package/lib/commonjs/i18n/ja.json +40 -1
- package/lib/commonjs/i18n/ko.json +40 -1
- package/lib/commonjs/i18n/nl.json +40 -1
- package/lib/commonjs/i18n/pt-br.json +40 -1
- package/lib/commonjs/i18n/ru.json +40 -1
- package/lib/commonjs/i18n/tr.json +40 -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 +237 -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 +64 -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 +374 -0
- package/lib/module/ai-components/conversation/AIConversation.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/index.js +15 -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 +53 -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/useConversationRows.js +117 -0
- package/lib/module/ai-components/conversation/useConversationRows.js.map +1 -0
- package/lib/module/ai-components/conversation-state/controller/AIAgentError.js +13 -0
- package/lib/module/ai-components/conversation-state/controller/AIAgentError.js.map +1 -0
- package/lib/module/ai-components/conversation-state/controller/AIConversationController.js +431 -0
- package/lib/module/ai-components/conversation-state/controller/AIConversationController.js.map +1 -0
- package/lib/module/ai-components/conversation-state/controller/AIConversationExchange.js +89 -0
- package/lib/module/ai-components/conversation-state/controller/AIConversationExchange.js.map +1 -0
- package/lib/module/ai-components/conversation-state/controller/index.js +48 -0
- package/lib/module/ai-components/conversation-state/controller/index.js.map +1 -0
- package/lib/module/ai-components/conversation-state/controller/offers.js +35 -0
- package/lib/module/ai-components/conversation-state/controller/offers.js.map +1 -0
- package/lib/module/ai-components/conversation-state/controller/types.js +13 -0
- package/lib/module/ai-components/conversation-state/controller/types.js.map +1 -0
- package/lib/module/ai-components/conversation-state/controller/useAIConversationState.js +8 -0
- package/lib/module/ai-components/conversation-state/controller/useAIConversationState.js.map +1 -0
- package/lib/module/ai-components/conversation-state/fromStreamMessage.js +67 -0
- package/lib/module/ai-components/conversation-state/fromStreamMessage.js.map +1 -0
- package/lib/module/ai-components/conversation-state/index.js +37 -0
- package/lib/module/ai-components/conversation-state/index.js.map +1 -0
- package/lib/module/ai-components/conversation-state/types.js +4 -0
- package/lib/module/ai-components/conversation-state/types.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 +197 -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/keyboard.js +40 -0
- package/lib/module/ai-components/internal/keyboard.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 +64 -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 +4 -2
- 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 +146 -20
- package/lib/module/ai-components/message-composer/ComposerView.js.map +1 -1
- package/lib/module/ai-components/message-composer/EditingMessageChip.js +81 -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 +133 -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 +40 -1
- package/lib/module/i18n/en.json +40 -1
- package/lib/module/i18n/es.json +40 -1
- package/lib/module/i18n/fr.json +40 -1
- package/lib/module/i18n/he.json +40 -1
- package/lib/module/i18n/hi.json +40 -1
- package/lib/module/i18n/it.json +40 -1
- package/lib/module/i18n/ja.json +40 -1
- package/lib/module/i18n/ko.json +40 -1
- package/lib/module/i18n/nl.json +40 -1
- package/lib/module/i18n/pt-br.json +40 -1
- package/lib/module/i18n/ru.json +40 -1
- package/lib/module/i18n/tr.json +40 -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 +133 -0
- package/lib/typescript/ai-components/conversation/AIConversation.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/index.d.ts +3 -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/useConversationRows.d.ts +66 -0
- package/lib/typescript/ai-components/conversation/useConversationRows.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/controller/AIAgentError.d.ts +10 -0
- package/lib/typescript/ai-components/conversation-state/controller/AIAgentError.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/controller/AIConversationController.d.ts +173 -0
- package/lib/typescript/ai-components/conversation-state/controller/AIConversationController.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/controller/AIConversationExchange.d.ts +23 -0
- package/lib/typescript/ai-components/conversation-state/controller/AIConversationExchange.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/controller/index.d.ts +5 -0
- package/lib/typescript/ai-components/conversation-state/controller/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/controller/offers.d.ts +25 -0
- package/lib/typescript/ai-components/conversation-state/controller/offers.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/controller/types.d.ts +142 -0
- package/lib/typescript/ai-components/conversation-state/controller/types.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/controller/useAIConversationState.d.ts +9 -0
- package/lib/typescript/ai-components/conversation-state/controller/useAIConversationState.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/fromStreamMessage.d.ts +25 -0
- package/lib/typescript/ai-components/conversation-state/fromStreamMessage.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/index.d.ts +4 -0
- package/lib/typescript/ai-components/conversation-state/index.d.ts.map +1 -0
- package/lib/typescript/ai-components/conversation-state/types.d.ts +55 -0
- package/lib/typescript/ai-components/conversation-state/types.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 +76 -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/keyboard.d.ts +9 -0
- package/lib/typescript/ai-components/internal/keyboard.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 +1 -1
- 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 +39 -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 +40 -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 +40 -1
- package/lib/typescript/i18n/en.json +40 -1
- package/lib/typescript/i18n/es.json +40 -1
- package/lib/typescript/i18n/fr.json +40 -1
- package/lib/typescript/i18n/he.json +40 -1
- package/lib/typescript/i18n/hi.json +40 -1
- package/lib/typescript/i18n/it.json +40 -1
- package/lib/typescript/i18n/ja.json +40 -1
- package/lib/typescript/i18n/ko.json +40 -1
- package/lib/typescript/i18n/nl.json +40 -1
- package/lib/typescript/i18n/pt-br.json +40 -1
- package/lib/typescript/i18n/ru.json +40 -1
- package/lib/typescript/i18n/tr.json +40 -1
- package/lib/typescript/utils/i18n/Streami18n.d.ts +41 -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 +270 -0
- package/src/a2ui/__tests__/A2UIInstructions.test.ts +233 -0
- package/src/a2ui/__tests__/A2UIRenderer.test.tsx +1559 -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 +64 -3
- package/src/ai-components/StreamingMessageView.tsx +27 -3
- package/src/ai-components/__tests__/ComposerView.test.tsx +247 -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 +787 -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 +606 -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 +385 -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/__tests__/withoutKeyboardController.test.tsx +60 -0
- 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 +612 -0
- package/src/ai-components/conversation/entries.ts +177 -0
- package/src/ai-components/conversation/index.ts +2 -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 +52 -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/useConversationRows.ts +231 -0
- package/src/ai-components/conversation-state/controller/AIAgentError.ts +14 -0
- package/src/ai-components/conversation-state/controller/AIConversationController.ts +628 -0
- package/src/ai-components/conversation-state/controller/AIConversationExchange.ts +132 -0
- package/src/ai-components/conversation-state/controller/index.ts +4 -0
- package/src/ai-components/conversation-state/controller/offers.ts +53 -0
- package/src/ai-components/conversation-state/controller/types.ts +154 -0
- package/src/ai-components/conversation-state/controller/useAIConversationState.ts +21 -0
- package/src/ai-components/conversation-state/fromStreamMessage.ts +89 -0
- package/src/ai-components/conversation-state/index.ts +3 -0
- package/src/ai-components/conversation-state/types.ts +57 -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 +229 -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/keyboard.tsx +34 -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 +100 -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 +10 -5
- 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 +194 -30
- package/src/ai-components/message-composer/EditingMessageChip.tsx +62 -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 +145 -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 +40 -1
- package/src/i18n/en.json +40 -1
- package/src/i18n/es.json +40 -1
- package/src/i18n/fr.json +40 -1
- package/src/i18n/he.json +40 -1
- package/src/i18n/hi.json +40 -1
- package/src/i18n/it.json +40 -1
- package/src/i18n/ja.json +40 -1
- package/src/i18n/ko.json +40 -1
- package/src/i18n/nl.json +40 -1
- package/src/i18n/pt-br.json +40 -1
- package/src/i18n/ru.json +40 -1
- package/src/i18n/tr.json +40 -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,39 @@
|
|
|
1
|
+
import { Component, type ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type AIUIErrorBoundaryProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
onError: (error: unknown) => void;
|
|
6
|
+
/** Tries the children again when it changes, such as when what they show changed. */
|
|
7
|
+
resetKey?: unknown;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type AIUIErrorBoundaryState = { hasError: boolean; resetKey: unknown };
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Keeps generated UI that throws while it renders, such as an app's component given what it
|
|
14
|
+
* didn't expect, from taking what is around it down with it. It shows nothing and says so.
|
|
15
|
+
*/
|
|
16
|
+
export class AIUIErrorBoundary extends Component<AIUIErrorBoundaryProps, AIUIErrorBoundaryState> {
|
|
17
|
+
state: AIUIErrorBoundaryState = { hasError: false, resetKey: this.props.resetKey };
|
|
18
|
+
|
|
19
|
+
static getDerivedStateFromError() {
|
|
20
|
+
return { hasError: true };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static getDerivedStateFromProps(
|
|
24
|
+
props: AIUIErrorBoundaryProps,
|
|
25
|
+
state: AIUIErrorBoundaryState,
|
|
26
|
+
): Partial<AIUIErrorBoundaryState> | null {
|
|
27
|
+
return Object.is(props.resetKey, state.resetKey)
|
|
28
|
+
? null
|
|
29
|
+
: { hasError: false, resetKey: props.resetKey };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
componentDidCatch(error: unknown) {
|
|
33
|
+
this.props.onError(error);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
render() {
|
|
37
|
+
return this.state.hasError ? null : this.props.children;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
// What the generated UI layer and its renderers share. Free of React and of any renderer's
|
|
2
|
+
// packages.
|
|
3
|
+
|
|
4
|
+
/** Whether `value` is a JSON object, rather than an array, `null` or a scalar. */
|
|
5
|
+
export const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
6
|
+
typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Whether two JSON values hold the same. A message is a new object on every update while a reply
|
|
10
|
+
* streams, so what it carries is compared by value.
|
|
11
|
+
*/
|
|
12
|
+
export const isSameJSON = (a: unknown, b: unknown): boolean => {
|
|
13
|
+
if (Object.is(a, b)) return true;
|
|
14
|
+
if (Array.isArray(a)) {
|
|
15
|
+
return (
|
|
16
|
+
Array.isArray(b) &&
|
|
17
|
+
a.length === b.length &&
|
|
18
|
+
a.every((item, index) => isSameJSON(item, b[index]))
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
if (!isRecord(a) || !isRecord(b)) return false;
|
|
22
|
+
const keys = Object.keys(a);
|
|
23
|
+
return (
|
|
24
|
+
keys.length === Object.keys(b).length &&
|
|
25
|
+
keys.every((key) => Object.prototype.hasOwnProperty.call(b, key) && isSameJSON(a[key], b[key]))
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/** How many bytes `text` takes as UTF-8, as the agent's backend counts it. */
|
|
30
|
+
export const utf8ByteLength = (text: string) => {
|
|
31
|
+
let bytes = 0;
|
|
32
|
+
for (let index = 0; index < text.length; index++) {
|
|
33
|
+
const code = text.charCodeAt(index);
|
|
34
|
+
if (code < 0x80) bytes += 1;
|
|
35
|
+
else if (code < 0x800) bytes += 2;
|
|
36
|
+
else if (code >= 0xd800 && code <= 0xdbff && index + 1 < text.length) {
|
|
37
|
+
// A surrogate pair is one character of four bytes.
|
|
38
|
+
bytes += 4;
|
|
39
|
+
index++;
|
|
40
|
+
} else bytes += 3;
|
|
41
|
+
}
|
|
42
|
+
return bytes;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The type an app's component is placed by in a format's UI, such as `PlaceCard` for
|
|
47
|
+
* `place_card`: named as A2UI's and OpenUI's own components are.
|
|
48
|
+
*/
|
|
49
|
+
export const aiUITypeName = (name: string) =>
|
|
50
|
+
name
|
|
51
|
+
.split(/[_\- ]/)
|
|
52
|
+
.filter(Boolean)
|
|
53
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
54
|
+
.join('');
|
|
55
|
+
|
|
56
|
+
/** `text` as a sentence, ending in a full stop unless it ends otherwise. */
|
|
57
|
+
export const aiUISentence = (text: string) => {
|
|
58
|
+
const trimmed = text.trim();
|
|
59
|
+
return /[.!?]$/.test(trimmed) ? trimmed : `${trimmed}.`;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
// A link's scheme, then what follows it, with no whitespace in it.
|
|
63
|
+
const LINK = /^([A-Za-z][A-Za-z0-9+.-]*):(\S*)$/;
|
|
64
|
+
|
|
65
|
+
const hasControlCharacter = (text: string) => {
|
|
66
|
+
for (let index = 0; index < text.length; index++) {
|
|
67
|
+
const code = text.charCodeAt(index);
|
|
68
|
+
if (code < 0x20 || code === 0x7f) return true;
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The scheme of a link from a reply's UI, in lowercase, such as `https`, or `undefined` for text
|
|
75
|
+
* that isn't one: no scheme, whitespace or control characters in it, or a web link with no host.
|
|
76
|
+
* React Native's `URL` doesn't refuse what isn't a link, so it is read here.
|
|
77
|
+
*/
|
|
78
|
+
export const aiUILinkScheme = (link: string): string | undefined => {
|
|
79
|
+
const trimmed = link.trim();
|
|
80
|
+
const match = hasControlCharacter(trimmed) ? null : LINK.exec(trimmed);
|
|
81
|
+
if (!match) return undefined;
|
|
82
|
+
const scheme = match[1].toLowerCase();
|
|
83
|
+
const rest = match[2];
|
|
84
|
+
if ((scheme === 'http' || scheme === 'https') && !/^\/\/[^/?#]+/.test(rest)) return undefined;
|
|
85
|
+
return scheme;
|
|
86
|
+
};
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Linking } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { type AIUIAction, aiUIActionProblem } from './AIUIAction';
|
|
5
|
+
import type { AIUIComponent } from './AIUIComponent';
|
|
6
|
+
import { aiUIComponentDefinitionJSON } from './AIUIComponentDefinition';
|
|
7
|
+
import { type AIUIDocument, isSameAIUIDocument } from './AIUIDocument';
|
|
8
|
+
import { aiUILinkScheme } from './AIUIHelpers';
|
|
9
|
+
import { type AIUIEngine, type AIUIRenderer, aiUIRendererReads } from './AIUIRenderer';
|
|
10
|
+
|
|
11
|
+
import type { AIMessage } from '../conversation-state/types';
|
|
12
|
+
import type { AIToolCallPart } from '../message-parts/types';
|
|
13
|
+
import type { AIClientTool, AIClientToolDefinition } from '../tool-calls/AIClientToolRunner';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Why one of the app's tools didn't run for a reply's UI, or failed, in words that name the tool.
|
|
17
|
+
*/
|
|
18
|
+
export class AIUIToolError extends Error {
|
|
19
|
+
constructor(message: string) {
|
|
20
|
+
super(message);
|
|
21
|
+
this.name = 'AIUIToolError';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let toolRuns = 0;
|
|
26
|
+
|
|
27
|
+
export type AIUIHostOptions = {
|
|
28
|
+
/** The renderer of each format the agent writes, the first one listed asked first. */
|
|
29
|
+
renderers: AIUIRenderer[];
|
|
30
|
+
/**
|
|
31
|
+
* Sends what the person did to the agent, as their next message, such as
|
|
32
|
+
* `session.responses.create(action.label, { uiAction: aiUIActionJSON(action) })`.
|
|
33
|
+
*/
|
|
34
|
+
send: (action: AIUIAction) => Promise<unknown> | unknown;
|
|
35
|
+
/** The app's views the agent can place. */
|
|
36
|
+
components?: AIUIComponent[];
|
|
37
|
+
/** Tells the app that an action could not be sent. It is logged by default. */
|
|
38
|
+
onError?: (error: unknown, action: AIUIAction) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Tells the app that a reply's UI, or a part of it, failed to show: a reply's UI that throws
|
|
41
|
+
* shows the reply's text instead, and one of the app's components that throws leaves only
|
|
42
|
+
* itself out. It is logged by default.
|
|
43
|
+
*/
|
|
44
|
+
onRenderError?: (error: unknown, messageId: string) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Opens a link from a reply's UI. By default, web and email links open and others don't: the
|
|
47
|
+
* agent writes the links, so another could call someone or act in another app.
|
|
48
|
+
*/
|
|
49
|
+
open?: (url: string) => void;
|
|
50
|
+
/**
|
|
51
|
+
* The app's tools a reply's UI can run, the same ones an `AIClientToolRunner` takes. A tool
|
|
52
|
+
* whose definition doesn't say it is read-only (`annotations.readOnlyHint`) runs only when the
|
|
53
|
+
* person asks for it, such as with a tap, never by itself as a reply shows.
|
|
54
|
+
*/
|
|
55
|
+
tools?: AIClientTool[];
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const WEB_OR_EMAIL = new Set(['http', 'https', 'mailto']);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Whether a link is one a reply's UI may open by default: a web link with a host, or an email
|
|
62
|
+
* link.
|
|
63
|
+
*/
|
|
64
|
+
export const isWebOrEmailLink = (url: string) => {
|
|
65
|
+
const scheme = aiUILinkScheme(url);
|
|
66
|
+
return scheme !== undefined && WEB_OR_EMAIL.has(scheme);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const openWebOrEmailLink = (url: string) => {
|
|
70
|
+
if (!isWebOrEmailLink(url)) {
|
|
71
|
+
console.warn(`A reply's UI asked to open ${url}, which isn't a web or email link`);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
Linking.openURL(url.trim()).catch(() => undefined);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The generated UI of one conversation: the renderers of the formats the agent writes, the
|
|
79
|
+
* app's components and tools, what each reply's UI was left in, and where what the person does
|
|
80
|
+
* goes. Give it to `AIConversation` as `ui`; keep one per conversation, for as long as it shows.
|
|
81
|
+
*/
|
|
82
|
+
export class AIUIHost {
|
|
83
|
+
readonly components: AIUIComponent[];
|
|
84
|
+
readonly renderers: AIUIRenderer[];
|
|
85
|
+
|
|
86
|
+
private readonly engines = new Map<AIUIRenderer, AIUIEngine>();
|
|
87
|
+
private readonly failed = new Set<string>();
|
|
88
|
+
private lastSend: Promise<void> = Promise.resolve();
|
|
89
|
+
private readonly listeners = new Set<() => void>();
|
|
90
|
+
private readonly options: AIUIHostOptions;
|
|
91
|
+
private readonly received = new Map<string, AIUIDocument>();
|
|
92
|
+
private readonly states = new Map<string, unknown>();
|
|
93
|
+
private readonly tools: Map<string, AIClientTool>;
|
|
94
|
+
private refreshing = false;
|
|
95
|
+
private version = 0;
|
|
96
|
+
|
|
97
|
+
constructor(options: AIUIHostOptions) {
|
|
98
|
+
this.options = options;
|
|
99
|
+
this.renderers = options.renderers;
|
|
100
|
+
this.components = options.components ?? [];
|
|
101
|
+
this.tools = new Map();
|
|
102
|
+
for (const tool of options.tools ?? []) {
|
|
103
|
+
if (!this.tools.has(tool.definition.name)) this.tools.set(tool.definition.name, tool);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** The names of the app's tools a reply's UI can run with `runTool`, sorted. */
|
|
108
|
+
get toolNames() {
|
|
109
|
+
return [...this.tools.keys()].sort();
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** The app's tools a reply's UI can run, as the agent is told them, sorted by name. */
|
|
113
|
+
get toolDefinitions(): AIClientToolDefinition[] {
|
|
114
|
+
return this.toolNames.map((name) => this.tools.get(name)!.definition);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** The app's component the agent places by `name`. */
|
|
118
|
+
component(name: string) {
|
|
119
|
+
return this.components.find((component) => component.definition.name === name);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Whether one of its renderers reads `document`. The one that does can still show nothing of
|
|
124
|
+
* its own for a reply, which then shows its text, as `content` tells.
|
|
125
|
+
*/
|
|
126
|
+
canShow(document: AIUIDocument) {
|
|
127
|
+
return this.renderers.some((renderer) => aiUIRendererReads(renderer, document));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* The view of a reply's document from the first renderer that reads its format and version,
|
|
132
|
+
* or `null` when none shows anything of its own, so the reply shows its text. `AIUIView` puts
|
|
133
|
+
* it on screen; `AIConversation` does it for every reply.
|
|
134
|
+
*/
|
|
135
|
+
content(document: AIUIDocument, messageId: string): ReactNode | null {
|
|
136
|
+
if (this.failed.has(messageId)) return null;
|
|
137
|
+
const renderer = this.renderers.find((candidate) => aiUIRendererReads(candidate, document));
|
|
138
|
+
return renderer ? (this.engineOf(renderer).view(document, messageId) ?? null) : null;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Gives its renderers the UI of the conversation's replies, oldest first, as each arrives or
|
|
143
|
+
* changes, whether or not the reply is on screen, so a format whose later replies change an
|
|
144
|
+
* earlier one's UI follows them all. It also tells them when a reply leaves the conversation,
|
|
145
|
+
* or its UI does, such as when it is deleted. `AIConversation` does it: call it with the
|
|
146
|
+
* conversation's messages when you show replies yourself with `AIUIView`.
|
|
147
|
+
*/
|
|
148
|
+
receive(messages: AIMessage[]) {
|
|
149
|
+
const documents = new Map<string, AIUIDocument>();
|
|
150
|
+
for (const message of messages) {
|
|
151
|
+
if (message.role !== 'user' && message.uiDocument) {
|
|
152
|
+
documents.set(message.id, message.uiDocument);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const left: [string, AIUIDocument][] = [];
|
|
156
|
+
for (const [messageId, document] of [...this.received]) {
|
|
157
|
+
if (documents.has(messageId)) continue;
|
|
158
|
+
this.received.delete(messageId);
|
|
159
|
+
left.push([messageId, document]);
|
|
160
|
+
}
|
|
161
|
+
for (const [messageId, document] of documents) {
|
|
162
|
+
const before = this.received.get(messageId);
|
|
163
|
+
if (isSameAIUIDocument(before, document)) continue;
|
|
164
|
+
this.received.set(messageId, document);
|
|
165
|
+
// A reply whose UI failed while it was written gets one more try once it is written.
|
|
166
|
+
if (before && !document.isStreaming) this.failed.delete(messageId);
|
|
167
|
+
const renderer = this.renderers.find((candidate) => aiUIRendererReads(candidate, document));
|
|
168
|
+
if (renderer) this.engineOf(renderer).receive?.(document, messageId);
|
|
169
|
+
}
|
|
170
|
+
// Forgets the replies that left once the conversation has rendered without them, since
|
|
171
|
+
// this runs while it renders, and a render React throws away must not lose what a reply
|
|
172
|
+
// was left in.
|
|
173
|
+
if (left.length) {
|
|
174
|
+
queueMicrotask(() => {
|
|
175
|
+
for (const [messageId, document] of left) {
|
|
176
|
+
if (this.received.has(messageId)) continue;
|
|
177
|
+
this.states.delete(messageId);
|
|
178
|
+
this.failed.delete(messageId);
|
|
179
|
+
const renderer = this.renderers.find((candidate) =>
|
|
180
|
+
aiUIRendererReads(candidate, document),
|
|
181
|
+
);
|
|
182
|
+
if (renderer) this.engineOf(renderer).remove?.(messageId);
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Sends what the person did to the agent, after everything sent before it, so the agent gets
|
|
190
|
+
* a reply's actions in the order they happened. Resolves to whether it was sent: one the
|
|
191
|
+
* agent's backend would refuse, or that fails to send, goes to `onError`, resolves to
|
|
192
|
+
* `false`, and does not hold up the ones after it.
|
|
193
|
+
*/
|
|
194
|
+
send(action: AIUIAction): Promise<boolean> {
|
|
195
|
+
const report = (error: unknown) => {
|
|
196
|
+
if (this.options.onError) this.options.onError(error, action);
|
|
197
|
+
else console.error("Couldn't send what the person did in a reply's UI", error);
|
|
198
|
+
};
|
|
199
|
+
const problem = aiUIActionProblem(action);
|
|
200
|
+
if (problem) {
|
|
201
|
+
report(new Error(problem));
|
|
202
|
+
return Promise.resolve(false);
|
|
203
|
+
}
|
|
204
|
+
const sent = this.lastSend.then(async () => {
|
|
205
|
+
try {
|
|
206
|
+
await this.options.send(action);
|
|
207
|
+
return true;
|
|
208
|
+
} catch (error) {
|
|
209
|
+
report(error);
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
this.lastSend = sent.then(() => undefined);
|
|
214
|
+
return sent;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Shows a reply's text in place of its UI, which failed to show, and tells the app. It lasts
|
|
219
|
+
* while the reply is in the conversation, or, for a reply still being written, until it is
|
|
220
|
+
* written. `AIConversation` and `AIUIView` do it.
|
|
221
|
+
*/
|
|
222
|
+
fail(messageId: string, error: unknown) {
|
|
223
|
+
if (this.failed.has(messageId)) return;
|
|
224
|
+
this.failed.add(messageId);
|
|
225
|
+
if (this.options.onRenderError) this.options.onRenderError(error, messageId);
|
|
226
|
+
else console.error(`A reply's UI failed to show, so its text shows instead`, error);
|
|
227
|
+
this.refresh();
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Tells the app that a part of a reply's UI failed to show, such as one of the app's
|
|
232
|
+
* components that threw, while the rest of it still shows. `AIUIComponentView` calls it.
|
|
233
|
+
*/
|
|
234
|
+
reportRenderError(error: unknown, messageId: string) {
|
|
235
|
+
if (this.options.onRenderError) this.options.onRenderError(error, messageId);
|
|
236
|
+
else console.error(`A part of a reply's UI failed to show, so it is left out`, error);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Has the conversation show its replies again, because what one of them shows changed since
|
|
241
|
+
* it was last asked, such as a finished reply that turned out to show nothing of its own.
|
|
242
|
+
* Renderers call it; the conversation shows them again after the current render, however many
|
|
243
|
+
* times it is called in it.
|
|
244
|
+
*/
|
|
245
|
+
refresh() {
|
|
246
|
+
if (this.refreshing) return;
|
|
247
|
+
this.refreshing = true;
|
|
248
|
+
queueMicrotask(() => {
|
|
249
|
+
this.refreshing = false;
|
|
250
|
+
this.version++;
|
|
251
|
+
this.listeners.forEach((listener) => listener());
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** Calls `listener` each time the conversation should show its replies again. */
|
|
256
|
+
subscribe = (listener: () => void) => {
|
|
257
|
+
this.listeners.add(listener);
|
|
258
|
+
return () => {
|
|
259
|
+
this.listeners.delete(listener);
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
/** A number that changes each time the conversation should show its replies again. */
|
|
264
|
+
getVersion = () => this.version;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Runs one of the app's tools for a reply's UI, such as to load data on this device, and
|
|
268
|
+
* resolves to its output. A tool that isn't read-only runs only when `userInitiated`, from
|
|
269
|
+
* something the person did. Rejects with an `AIUIToolError` when the tool can't run here, fails,
|
|
270
|
+
* or gives output that isn't JSON.
|
|
271
|
+
*/
|
|
272
|
+
async runTool(
|
|
273
|
+
name: string,
|
|
274
|
+
args: Record<string, unknown> = {},
|
|
275
|
+
{ userInitiated = false }: { userInitiated?: boolean } = {},
|
|
276
|
+
): Promise<unknown> {
|
|
277
|
+
const tool = this.tools.get(name);
|
|
278
|
+
if (!tool) throw new AIUIToolError(`No tool named ${name}`);
|
|
279
|
+
if (!userInitiated && tool.definition.annotations?.readOnlyHint !== true) {
|
|
280
|
+
throw new AIUIToolError(
|
|
281
|
+
`${name} isn't read-only, so it runs only when the person asks for it`,
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
const call: AIToolCallPart = {
|
|
285
|
+
arguments: args,
|
|
286
|
+
executor: 'client',
|
|
287
|
+
id: `ui-${name}-${++toolRuns}`,
|
|
288
|
+
name,
|
|
289
|
+
status: 'awaiting_client',
|
|
290
|
+
};
|
|
291
|
+
let result;
|
|
292
|
+
try {
|
|
293
|
+
result = await tool.run(call);
|
|
294
|
+
} catch (error) {
|
|
295
|
+
throw new AIUIToolError(
|
|
296
|
+
`${name} failed${error instanceof Error && error.message ? `: ${error.message}` : ''}`,
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
if (result.failure !== undefined) throw new AIUIToolError(result.failure);
|
|
300
|
+
if (result.output === undefined) return undefined;
|
|
301
|
+
try {
|
|
302
|
+
const json = JSON.stringify(result.output);
|
|
303
|
+
if (json !== undefined) return JSON.parse(json) as unknown;
|
|
304
|
+
} catch {
|
|
305
|
+
// Not JSON, such as a value that refers to itself.
|
|
306
|
+
}
|
|
307
|
+
throw new AIUIToolError(`${name} gave output that isn't JSON`);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/** Opens a link from a reply's UI, as the host's `open` allows. */
|
|
311
|
+
open(url: string) {
|
|
312
|
+
if (aiUILinkScheme(url) === undefined) {
|
|
313
|
+
console.warn(`A reply's UI asked to open ${url}, which isn't a link`);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
(this.options.open ?? openWebOrEmailLink)(url.trim());
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/** The state a reply's UI was left in, such as a form's values, kept while the host is. */
|
|
320
|
+
state(messageId: string): unknown {
|
|
321
|
+
return this.states.get(messageId);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/** Keeps the state a reply's UI was left in. `undefined` forgets it. */
|
|
325
|
+
setState(messageId: string, state: unknown) {
|
|
326
|
+
if (state === undefined) this.states.delete(messageId);
|
|
327
|
+
else this.states.set(messageId, state);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* What the agent's backend needs to write UI this app shows: each format it reads, with what
|
|
332
|
+
* its renderer adds, such as the model's instructions, and the app's components and tools.
|
|
333
|
+
*/
|
|
334
|
+
async capabilities() {
|
|
335
|
+
return {
|
|
336
|
+
components: this.components.map(({ definition }) => aiUIComponentDefinitionJSON(definition)),
|
|
337
|
+
// The app's tools as Model Context Protocol tools.
|
|
338
|
+
tools: this.toolDefinitions,
|
|
339
|
+
renderers: await Promise.all(
|
|
340
|
+
this.renderers.map(async (renderer) => ({
|
|
341
|
+
...(await renderer.capabilities?.(this.components, this.toolDefinitions)),
|
|
342
|
+
format: renderer.format,
|
|
343
|
+
})),
|
|
344
|
+
),
|
|
345
|
+
v: 1,
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// The engine of a renderer, made the first time it is needed and kept as the host is.
|
|
350
|
+
private engineOf(renderer: AIUIRenderer) {
|
|
351
|
+
let engine = this.engines.get(renderer);
|
|
352
|
+
if (!engine) {
|
|
353
|
+
engine = renderer.createEngine(this);
|
|
354
|
+
this.engines.set(renderer, engine);
|
|
355
|
+
}
|
|
356
|
+
return engine;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { aiUILinkScheme } from './AIUIHelpers';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Decides what a reply's UI loads for an image, video or sound the agent linked to: the address
|
|
5
|
+
* to load, which may be another, or `null` not to load it. The agent writes these links, so one
|
|
6
|
+
* could track the person or reach their network.
|
|
7
|
+
*/
|
|
8
|
+
export type AIUIMediaURL = (url: string) => string | null | undefined;
|
|
9
|
+
|
|
10
|
+
// A host on this device or its network, as a link names it.
|
|
11
|
+
const PRIVATE_HOST =
|
|
12
|
+
/^(localhost|.*\.localhost|.*\.local|.*\.internal|0\.0\.0\.0|127\.\d+\.\d+\.\d+|10\.\d+\.\d+\.\d+|192\.168\.\d+\.\d+|169\.254\.\d+\.\d+|172\.(1[6-9]|2\d|3[01])\.\d+\.\d+|\[(::1?|f[cd][0-9a-f]*:.*|fe[89ab][0-9a-f]*:.*|::ffff:.*)\])$/i;
|
|
13
|
+
|
|
14
|
+
// The host of a web link, past any user info and before its port: `//user@host:443/path`.
|
|
15
|
+
const HOST = /^[a-z][a-z0-9+.-]*:\/\/(?:[^@/?#]*@)?(\[[^\]/?#]*\]|[^:/?#]*)/i;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Whether `url` is a public web link: http or https, to a host that isn't this device or its
|
|
19
|
+
* network, such as `localhost` or `192.168.1.1`.
|
|
20
|
+
*/
|
|
21
|
+
export const isPublicWebURL = (url: string) => {
|
|
22
|
+
const scheme = aiUILinkScheme(url);
|
|
23
|
+
if (scheme !== 'http' && scheme !== 'https') return false;
|
|
24
|
+
const host = HOST.exec(url.trim())?.[1]?.replace(/\.$/, '');
|
|
25
|
+
return !!host && !PRIVATE_HOST.test(host);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The media a reply's UI loads by default: public web links. Others, such as `data:` or `file:`
|
|
30
|
+
* URLs, or addresses on the person's network, don't load.
|
|
31
|
+
*/
|
|
32
|
+
export const aiUIPublicMediaURL: AIUIMediaURL = (url) => (isPublicWebURL(url) ? url : null);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The address to load for a link the agent wrote, as `mediaURL` decides it, or `undefined` not to
|
|
36
|
+
* load anything. Renderers call it before they draw an image, video or sound.
|
|
37
|
+
*/
|
|
38
|
+
export const aiUIMediaSource = (
|
|
39
|
+
value: unknown,
|
|
40
|
+
mediaURL: AIUIMediaURL = aiUIPublicMediaURL,
|
|
41
|
+
): string | undefined => {
|
|
42
|
+
if (typeof value !== 'string' || value.trim() === '') return undefined;
|
|
43
|
+
const decided = mediaURL(value.trim());
|
|
44
|
+
return typeof decided === 'string' && decided.trim() !== '' ? decided : undefined;
|
|
45
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { AIUIComponent } from './AIUIComponent';
|
|
4
|
+
import type { AIUIDocument, AIUIFormat } from './AIUIDocument';
|
|
5
|
+
import type { AIUIHost } from './AIUIHost';
|
|
6
|
+
|
|
7
|
+
import type { AIClientToolDefinition } from '../tool-calls/AIClientToolRunner';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Shows the documents of one conversation in a renderer's format. A host makes one per
|
|
11
|
+
* renderer, the first time the renderer receives or shows something, and keeps it as long as
|
|
12
|
+
* the host lives, so what a reply's UI holds, such as a form's values, survives scrolling.
|
|
13
|
+
*/
|
|
14
|
+
export type AIUIEngine = {
|
|
15
|
+
/**
|
|
16
|
+
* The view of a reply's document, or `null` when it shows nothing of its own, such as a reply
|
|
17
|
+
* that only changed an earlier one's UI, so the reply's text shows. It is called while the
|
|
18
|
+
* conversation renders, so keep what it makes for a reply and return it again.
|
|
19
|
+
*/
|
|
20
|
+
view: (document: AIUIDocument, messageId: string) => ReactNode | null;
|
|
21
|
+
/**
|
|
22
|
+
* Takes a reply's document as it arrives or changes, oldest reply first, whether or not the
|
|
23
|
+
* reply is on screen, so a format whose later replies change an earlier one's UI can follow
|
|
24
|
+
* them all. It comes while the conversation renders, before any reply's view is asked for:
|
|
25
|
+
* change what is already on screen afterwards, such as in a microtask.
|
|
26
|
+
*/
|
|
27
|
+
receive?: (document: AIUIDocument, messageId: string) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Forgets a reply that left the conversation, or whose UI did, such as one that was deleted,
|
|
30
|
+
* so the engine can let go of what it kept for it.
|
|
31
|
+
*/
|
|
32
|
+
remove?: (messageId: string) => void;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Reads one format of generated UI, such as A2UI. A plug-in of `AIUIHost`: the AI components
|
|
37
|
+
* know no format themselves.
|
|
38
|
+
*/
|
|
39
|
+
export type AIUIRenderer = {
|
|
40
|
+
/** Makes what shows the documents of one conversation. */
|
|
41
|
+
createEngine: (host: AIUIHost) => AIUIEngine;
|
|
42
|
+
/** The format it reads. */
|
|
43
|
+
format: AIUIFormat;
|
|
44
|
+
/**
|
|
45
|
+
* What the agent's backend needs to have its model write UI this renderer shows with
|
|
46
|
+
* `components`, such as the model's instructions, which may take loading the format's
|
|
47
|
+
* packages to write. None by default.
|
|
48
|
+
*/
|
|
49
|
+
capabilities?: (
|
|
50
|
+
components: AIUIComponent[],
|
|
51
|
+
/** The app's tools a reply's UI can run, which the agent can be told about too. */
|
|
52
|
+
tools: AIClientToolDefinition[],
|
|
53
|
+
) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
54
|
+
/** Whether it reads documents of `version`, or of no version. Every version by default. */
|
|
55
|
+
supports?: (version: string | undefined) => boolean;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** Whether `renderer` reads `document`: its format, in a version it supports. */
|
|
59
|
+
export const aiUIRendererReads = (renderer: AIUIRenderer, document: AIUIDocument) =>
|
|
60
|
+
renderer.format === document.format && (renderer.supports?.(document.version) ?? true);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React, { type ReactNode, useSyncExternalStore } from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type { AIUIDocument } from './AIUIDocument';
|
|
5
|
+
import { AIUIEntranceStage } from './AIUIEntrance';
|
|
6
|
+
import { AIUIErrorBoundary } from './AIUIErrorBoundary';
|
|
7
|
+
import type { AIUIHost } from './AIUIHost';
|
|
8
|
+
|
|
9
|
+
import { useTheme } from '../contexts';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A reply's generated UI as it shows in place of the reply's text: as wide as the reply, coming
|
|
13
|
+
* in as it first shows while the agent writes it. UI that throws while it renders shows nothing,
|
|
14
|
+
* and `onError` is told, such as to have the host show the reply's text. An app's component
|
|
15
|
+
* that throws only leaves itself out.
|
|
16
|
+
*/
|
|
17
|
+
export const AIUIGenerated = ({
|
|
18
|
+
children,
|
|
19
|
+
isStreaming,
|
|
20
|
+
messageId,
|
|
21
|
+
onError,
|
|
22
|
+
}: {
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
isStreaming: boolean;
|
|
25
|
+
messageId: string;
|
|
26
|
+
onError: (error: unknown) => void;
|
|
27
|
+
}) => {
|
|
28
|
+
const {
|
|
29
|
+
theme: { generatedUI },
|
|
30
|
+
} = useTheme();
|
|
31
|
+
return (
|
|
32
|
+
<AIUIEntranceStage
|
|
33
|
+
isStreaming={isStreaming}
|
|
34
|
+
resetKey={messageId}
|
|
35
|
+
style={[styles.generated, generatedUI?.container]}
|
|
36
|
+
>
|
|
37
|
+
<AIUIErrorBoundary onError={onError} resetKey={messageId}>
|
|
38
|
+
{children}
|
|
39
|
+
</AIUIErrorBoundary>
|
|
40
|
+
</AIUIEntranceStage>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const subscribeToNothing = () => () => undefined;
|
|
45
|
+
const noVersion = () => 0;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Shows the conversation's replies again whenever the host says what one of them shows changed,
|
|
49
|
+
* such as a finished reply that turned out to show nothing of its own.
|
|
50
|
+
*/
|
|
51
|
+
export const useAIUIHostRefresh = (host: AIUIHost | undefined) =>
|
|
52
|
+
useSyncExternalStore(
|
|
53
|
+
host ? host.subscribe : subscribeToNothing,
|
|
54
|
+
host ? host.getVersion : noVersion,
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
export type AIUIViewProps = {
|
|
58
|
+
document: AIUIDocument;
|
|
59
|
+
host: AIUIHost;
|
|
60
|
+
/** The reply the document belongs to. */
|
|
61
|
+
messageId: string;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* One reply's generated UI, for showing replies outside `AIConversation`. It shows nothing when
|
|
66
|
+
* none of the host's renderers shows the document, and the reply's text should show instead:
|
|
67
|
+
* `host.content(document, messageId) !== null` tells which, and `host.subscribe` when that may
|
|
68
|
+
* have changed. Give the host the conversation's messages with `host.receive(messages)` as they
|
|
69
|
+
* change.
|
|
70
|
+
*/
|
|
71
|
+
export const AIUIView = ({ document, host, messageId }: AIUIViewProps) => {
|
|
72
|
+
useAIUIHostRefresh(host);
|
|
73
|
+
const content = host.content(document, messageId);
|
|
74
|
+
return content === null ? null : (
|
|
75
|
+
<AIUIGenerated
|
|
76
|
+
isStreaming={document.isStreaming}
|
|
77
|
+
messageId={messageId}
|
|
78
|
+
onError={(error) => host.fail(messageId, error)}
|
|
79
|
+
>
|
|
80
|
+
{content}
|
|
81
|
+
</AIUIGenerated>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const styles = StyleSheet.create({
|
|
86
|
+
generated: { alignSelf: 'stretch' },
|
|
87
|
+
});
|