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,117 @@
|
|
|
1
|
+
import type { AIUIJSONSchema, AIUIParameter } from './AIUIComponentDefinition';
|
|
2
|
+
import { aiUIParametersOf } from './AIUIComponentDefinition';
|
|
3
|
+
import { isRecord } from './AIUIHelpers';
|
|
4
|
+
|
|
5
|
+
// Thrown inside decoding only, so a value that does not fit stops it at once.
|
|
6
|
+
class DoesNotFit extends Error {}
|
|
7
|
+
|
|
8
|
+
const RFC_3339 = /^\d{4}-\d{2}-\d{2}[Tt ]\d{2}:\d{2}:\d{2}(\.\d+)?([Zz]|[+-]\d{2}:\d{2})$/;
|
|
9
|
+
const DAY = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A date the agent wrote: an RFC 3339 moment, or a whole day as `yyyy-MM-dd` that the calendar
|
|
13
|
+
* has, which is that day's start where the person is. Anything else is not a date.
|
|
14
|
+
*/
|
|
15
|
+
export const aiUIDate = (text: string): Date | undefined => {
|
|
16
|
+
if (RFC_3339.test(text)) {
|
|
17
|
+
const moment = new Date(text);
|
|
18
|
+
return Number.isNaN(moment.getTime()) ? undefined : moment;
|
|
19
|
+
}
|
|
20
|
+
const day = DAY.exec(text);
|
|
21
|
+
if (!day) return undefined;
|
|
22
|
+
const [year, month, date] = [Number(day[1]), Number(day[2]), Number(day[3])];
|
|
23
|
+
const start = new Date(year, month - 1, date);
|
|
24
|
+
start.setFullYear(year);
|
|
25
|
+
return start.getFullYear() === year && start.getMonth() === month - 1 && start.getDate() === date
|
|
26
|
+
? start
|
|
27
|
+
: undefined;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** `place_name` as `placeName`, the way the agent's snake_case reads in JavaScript. */
|
|
31
|
+
export const aiUICamelCase = (key: string) => {
|
|
32
|
+
const [, leading = '', middle = '', trailing = ''] = /^(_*)(.*?)(_*)$/.exec(key) ?? [];
|
|
33
|
+
if (!middle.includes('_')) return key;
|
|
34
|
+
const [first = '', ...rest] = middle.split('_').filter(Boolean);
|
|
35
|
+
return (
|
|
36
|
+
leading +
|
|
37
|
+
first +
|
|
38
|
+
rest.map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join('') +
|
|
39
|
+
trailing
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const camelCased = (value: unknown): unknown => {
|
|
44
|
+
if (Array.isArray(value)) return value.map(camelCased);
|
|
45
|
+
if (!isRecord(value)) return value;
|
|
46
|
+
return Object.fromEntries(
|
|
47
|
+
Object.entries(value).map(([key, item]) => [aiUICamelCase(key), camelCased(item)]),
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const decodeObject = (value: unknown, parameters: AIUIParameter[]) => {
|
|
52
|
+
if (!isRecord(value)) throw new DoesNotFit();
|
|
53
|
+
const declared = new Set(parameters.map(({ name }) => name));
|
|
54
|
+
const decoded: Record<string, unknown> = {};
|
|
55
|
+
for (const [key, item] of Object.entries(value)) {
|
|
56
|
+
if (!declared.has(key)) decoded[aiUICamelCase(key)] = camelCased(item);
|
|
57
|
+
}
|
|
58
|
+
for (const { isRequired, name, type } of parameters) {
|
|
59
|
+
const item = value[name];
|
|
60
|
+
if (item === undefined || item === null) {
|
|
61
|
+
if (isRequired) throw new DoesNotFit();
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
decoded[aiUICamelCase(name)] = decodeValue(item, type);
|
|
65
|
+
}
|
|
66
|
+
return decoded;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const decodeValue = (value: unknown, schema: AIUIJSONSchema): unknown => {
|
|
70
|
+
switch (schema.type) {
|
|
71
|
+
case 'string': {
|
|
72
|
+
if (typeof value !== 'string') throw new DoesNotFit();
|
|
73
|
+
if (Array.isArray(schema.enum) && !schema.enum.includes(value)) throw new DoesNotFit();
|
|
74
|
+
if (schema.format === 'date' || schema.format === 'date-time') {
|
|
75
|
+
const date = aiUIDate(value);
|
|
76
|
+
if (!date) throw new DoesNotFit();
|
|
77
|
+
return date;
|
|
78
|
+
}
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
case 'number':
|
|
82
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) throw new DoesNotFit();
|
|
83
|
+
return value;
|
|
84
|
+
case 'integer':
|
|
85
|
+
if (!Number.isInteger(value)) throw new DoesNotFit();
|
|
86
|
+
return value;
|
|
87
|
+
case 'boolean':
|
|
88
|
+
if (typeof value !== 'boolean') throw new DoesNotFit();
|
|
89
|
+
return value;
|
|
90
|
+
case 'array': {
|
|
91
|
+
if (!Array.isArray(value)) throw new DoesNotFit();
|
|
92
|
+
const items = isRecord(schema.items) ? schema.items : {};
|
|
93
|
+
return value.map((item) => decodeValue(item, items));
|
|
94
|
+
}
|
|
95
|
+
case 'object':
|
|
96
|
+
return decodeObject(value, aiUIParametersOf(schema));
|
|
97
|
+
default:
|
|
98
|
+
return camelCased(value);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The arguments the agent wrote for a component, as its view reads them: keys in camelCase,
|
|
104
|
+
* dates as `Date`s. `undefined` while they do not fit its parameters, such as while they are
|
|
105
|
+
* still streaming in: a required one is missing, or one is of the wrong type.
|
|
106
|
+
*/
|
|
107
|
+
export const decodeAIUIArguments = <Arguments = Record<string, unknown>>(
|
|
108
|
+
args: Record<string, unknown>,
|
|
109
|
+
parameters: AIUIParameter[],
|
|
110
|
+
): Arguments | undefined => {
|
|
111
|
+
try {
|
|
112
|
+
return decodeObject(args, parameters) as Arguments;
|
|
113
|
+
} catch (error) {
|
|
114
|
+
if (error instanceof DoesNotFit) return undefined;
|
|
115
|
+
throw error;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React, { type ComponentType, useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { decodeAIUIArguments } from './AIUIArguments';
|
|
4
|
+
import type { AIUIComponentDefinition } from './AIUIComponentDefinition';
|
|
5
|
+
import { AIUIEntrance } from './AIUIEntrance';
|
|
6
|
+
import { AIUIErrorBoundary } from './AIUIErrorBoundary';
|
|
7
|
+
import type { AIUIHost } from './AIUIHost';
|
|
8
|
+
|
|
9
|
+
/** Where an app's component is shown, and how it tells the agent what the person did. */
|
|
10
|
+
export type AIUIComponentContext = {
|
|
11
|
+
/**
|
|
12
|
+
* Tells the agent about one of the component's events, as the person's next message.
|
|
13
|
+
* `label` is what the person did, in their words, such as "Tell me more about St. Naum".
|
|
14
|
+
*/
|
|
15
|
+
emit: (event: string, label: string, payload?: Record<string, unknown>) => void;
|
|
16
|
+
/** The conversation's host, for running the app's tools and opening links. */
|
|
17
|
+
host: AIUIHost;
|
|
18
|
+
/** Whether the agent is still writing the reply's UI, so the arguments may still change. */
|
|
19
|
+
isStreaming: boolean;
|
|
20
|
+
/** The reply the component is in. */
|
|
21
|
+
messageId: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type AIUIComponentProps<Arguments> = {
|
|
25
|
+
/** What the agent filled in: keys in camelCase, dates as `Date`s. */
|
|
26
|
+
args: Arguments;
|
|
27
|
+
context: AIUIComponentContext;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* One of the app's views that the agent can place in a reply's UI, in whichever format it
|
|
32
|
+
* writes, such as a map or a card over the app's own data.
|
|
33
|
+
*/
|
|
34
|
+
export type AIUIComponent = {
|
|
35
|
+
Component: ComponentType<AIUIComponentProps<never>>;
|
|
36
|
+
/** Its description, the same on every platform and for the agent. */
|
|
37
|
+
definition: AIUIComponentDefinition;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* One of the app's components, with what its view reads from the agent's arguments. The view
|
|
42
|
+
* gets them only once they fit the definition's parameters, so it can rely on their types.
|
|
43
|
+
*
|
|
44
|
+
* A conversation reuses its views: one scrolled out of sight shows another reply's UI next, so
|
|
45
|
+
* state the view keeps of its own has to start afresh for a new `context.messageId`.
|
|
46
|
+
*/
|
|
47
|
+
export const defineAIUIComponent = <Arguments,>(
|
|
48
|
+
definition: AIUIComponentDefinition,
|
|
49
|
+
Component: ComponentType<AIUIComponentProps<Arguments>>,
|
|
50
|
+
): AIUIComponent => ({
|
|
51
|
+
// The arguments are checked against `definition` before the view gets them.
|
|
52
|
+
Component: Component as unknown as ComponentType<AIUIComponentProps<never>>,
|
|
53
|
+
definition,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// What an app's component was given, to try it again once that changes or the reply is written.
|
|
57
|
+
const attemptOf = (args: Record<string, unknown>, isStreaming: boolean) => {
|
|
58
|
+
try {
|
|
59
|
+
return `${isStreaming}\u0000${JSON.stringify(args)}`;
|
|
60
|
+
} catch {
|
|
61
|
+
return args;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* An app's component for the arguments the agent wrote, coming in as it shows, or nothing
|
|
67
|
+
* while they don't fit its parameters, such as while they are still streaming in. Renderers
|
|
68
|
+
* place the app's components with it. One that throws leaves only itself out of the reply's
|
|
69
|
+
* UI, is tried again when its arguments change, and is reported once the reply is written.
|
|
70
|
+
*/
|
|
71
|
+
export const AIUIComponentView = ({
|
|
72
|
+
args,
|
|
73
|
+
component,
|
|
74
|
+
context,
|
|
75
|
+
}: {
|
|
76
|
+
args: Record<string, unknown>;
|
|
77
|
+
component: AIUIComponent;
|
|
78
|
+
context: AIUIComponentContext;
|
|
79
|
+
}) => {
|
|
80
|
+
const { host, isStreaming, messageId } = context;
|
|
81
|
+
// Worked out again only when the arguments change, for a renderer that keeps the same object
|
|
82
|
+
// while they don't, as the A2UI renderer does.
|
|
83
|
+
const decoded = useMemo(
|
|
84
|
+
() => decodeAIUIArguments(args, component.definition.parameters),
|
|
85
|
+
[args, component],
|
|
86
|
+
);
|
|
87
|
+
const resetKey = useMemo(
|
|
88
|
+
() => (decoded === undefined ? undefined : attemptOf(decoded, isStreaming)),
|
|
89
|
+
[decoded, isStreaming],
|
|
90
|
+
);
|
|
91
|
+
if (decoded === undefined) return null;
|
|
92
|
+
const { Component } = component;
|
|
93
|
+
return (
|
|
94
|
+
<AIUIErrorBoundary
|
|
95
|
+
onError={(error) => {
|
|
96
|
+
// While the reply streams, what the component was given may still be incomplete.
|
|
97
|
+
if (!isStreaming) host.reportRenderError(error, messageId);
|
|
98
|
+
}}
|
|
99
|
+
resetKey={resetKey}
|
|
100
|
+
>
|
|
101
|
+
<AIUIEntrance>
|
|
102
|
+
<Component args={decoded as never} context={context} />
|
|
103
|
+
</AIUIEntrance>
|
|
104
|
+
</AIUIErrorBoundary>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { isRecord } from './AIUIHelpers';
|
|
2
|
+
|
|
3
|
+
/** A JSON Schema, as a component's parameters are described to the agent. */
|
|
4
|
+
export type AIUIJSONSchema = Record<string, unknown>;
|
|
5
|
+
|
|
6
|
+
/** Something the agent fills in for a component. */
|
|
7
|
+
export type AIUIParameter = {
|
|
8
|
+
/** Whether the agent must fill it in. */
|
|
9
|
+
isRequired: boolean;
|
|
10
|
+
/** The name the agent fills it in by, such as `title`. */
|
|
11
|
+
name: string;
|
|
12
|
+
/** What it holds, as a JSON Schema, such as `AIUIParameterType.string`. */
|
|
13
|
+
type: AIUIJSONSchema;
|
|
14
|
+
/** What it is, for the agent. */
|
|
15
|
+
description?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** Something a component reports when the person uses it, such as tapping a place. */
|
|
19
|
+
export type AIUIComponentEvent = {
|
|
20
|
+
/** When it happens, for the agent. */
|
|
21
|
+
description: string;
|
|
22
|
+
/** The name it is reported by, such as `ask_about`. */
|
|
23
|
+
name: string;
|
|
24
|
+
/** What it carries, in order. */
|
|
25
|
+
parameters: AIUIParameter[];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An app's component as the agent knows it: its name, what it shows, what the agent fills in
|
|
30
|
+
* and what it reports. It is portable JSON, the same on every platform, so one description
|
|
31
|
+
* (such as a `UIComponents.json` shared with the iOS and Android apps) serves them all.
|
|
32
|
+
*/
|
|
33
|
+
export type AIUIComponentDefinition = {
|
|
34
|
+
/** What it shows and when to use it, for the agent. */
|
|
35
|
+
description: string;
|
|
36
|
+
/** What it reports when the person uses it. */
|
|
37
|
+
events: AIUIComponentEvent[];
|
|
38
|
+
/** The name the agent places it by, such as `place_card`. */
|
|
39
|
+
name: string;
|
|
40
|
+
/**
|
|
41
|
+
* What the agent fills in, in order: a format such as OpenUI Lang passes arguments by
|
|
42
|
+
* position.
|
|
43
|
+
*/
|
|
44
|
+
parameters: AIUIParameter[];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/** The types a parameter commonly has, as JSON Schemas. */
|
|
48
|
+
export const AIUIParameterType = {
|
|
49
|
+
/** A list of values of one type. */
|
|
50
|
+
array: (items: AIUIJSONSchema): AIUIJSONSchema => ({ items, type: 'array' }),
|
|
51
|
+
boolean: { type: 'boolean' } as AIUIJSONSchema,
|
|
52
|
+
/** A day, such as `2026-11-14`. */
|
|
53
|
+
date: { format: 'date', type: 'string' } as AIUIJSONSchema,
|
|
54
|
+
/** A moment, such as `2026-11-14T09:30:00Z`. */
|
|
55
|
+
dateTime: { format: 'date-time', type: 'string' } as AIUIJSONSchema,
|
|
56
|
+
/** One of a fixed set of strings. */
|
|
57
|
+
enumeration: (values: string[]): AIUIJSONSchema => ({ enum: values, type: 'string' }),
|
|
58
|
+
integer: { type: 'integer' } as AIUIJSONSchema,
|
|
59
|
+
number: { type: 'number' } as AIUIJSONSchema,
|
|
60
|
+
/** An object with named fields, in order. */
|
|
61
|
+
object: (fields: AIUIParameter[]): AIUIJSONSchema => aiUIObjectSchema(fields),
|
|
62
|
+
string: { type: 'string' } as AIUIJSONSchema,
|
|
63
|
+
/** A link, such as an image's. */
|
|
64
|
+
url: { format: 'uri', type: 'string' } as AIUIJSONSchema,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** A parameter the agent must fill in. */
|
|
68
|
+
export const requiredAIUIParameter = (
|
|
69
|
+
name: string,
|
|
70
|
+
type: AIUIJSONSchema,
|
|
71
|
+
description?: string,
|
|
72
|
+
): AIUIParameter => ({ description, isRequired: true, name, type });
|
|
73
|
+
|
|
74
|
+
/** A parameter the agent may leave out. */
|
|
75
|
+
export const optionalAIUIParameter = (
|
|
76
|
+
name: string,
|
|
77
|
+
type: AIUIJSONSchema,
|
|
78
|
+
description?: string,
|
|
79
|
+
): AIUIParameter => ({ description, isRequired: false, name, type });
|
|
80
|
+
|
|
81
|
+
// The key that keeps the order of an object's fields, which JSON objects don't have.
|
|
82
|
+
const ORDER_KEY = 'x-order';
|
|
83
|
+
|
|
84
|
+
const strings = (value: unknown) =>
|
|
85
|
+
Array.isArray(value) ? value.filter((item): item is string => typeof item === 'string') : [];
|
|
86
|
+
|
|
87
|
+
/** Parameters as a JSON Schema object, the way a tool's are described, keeping their order. */
|
|
88
|
+
export const aiUIObjectSchema = (parameters: AIUIParameter[]): AIUIJSONSchema => ({
|
|
89
|
+
[ORDER_KEY]: parameters.map(({ name }) => name),
|
|
90
|
+
properties: Object.fromEntries(
|
|
91
|
+
parameters.map(({ description, name, type }) => [
|
|
92
|
+
name,
|
|
93
|
+
description === undefined ? type : { ...type, description },
|
|
94
|
+
]),
|
|
95
|
+
),
|
|
96
|
+
required: parameters.filter(({ isRequired }) => isRequired).map(({ name }) => name),
|
|
97
|
+
type: 'object',
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
/** The fields of a JSON Schema object, in the order it keeps, then by name. */
|
|
101
|
+
export const aiUIParametersOf = (schema: unknown): AIUIParameter[] => {
|
|
102
|
+
if (!isRecord(schema)) return [];
|
|
103
|
+
const properties = isRecord(schema.properties) ? schema.properties : {};
|
|
104
|
+
const required = new Set(strings(schema.required));
|
|
105
|
+
const ordered = strings(schema[ORDER_KEY]).filter((name) => name in properties);
|
|
106
|
+
const rest = Object.keys(properties)
|
|
107
|
+
.filter((name) => !ordered.includes(name))
|
|
108
|
+
.sort();
|
|
109
|
+
return [...ordered, ...rest].flatMap((name) => {
|
|
110
|
+
const field = properties[name];
|
|
111
|
+
if (!isRecord(field)) return [];
|
|
112
|
+
const { description, ...type } = field;
|
|
113
|
+
return [
|
|
114
|
+
{
|
|
115
|
+
description: typeof description === 'string' ? description : undefined,
|
|
116
|
+
isRequired: required.has(name),
|
|
117
|
+
name,
|
|
118
|
+
type,
|
|
119
|
+
},
|
|
120
|
+
];
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Reads a component's portable JSON, such as one entry of a `UIComponents.json`, or returns
|
|
126
|
+
* `undefined` for one without a name.
|
|
127
|
+
*/
|
|
128
|
+
export const parseAIUIComponentDefinition = (
|
|
129
|
+
json: unknown,
|
|
130
|
+
): AIUIComponentDefinition | undefined => {
|
|
131
|
+
if (!isRecord(json) || typeof json.name !== 'string' || json.name === '') {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
const events = Array.isArray(json.events) ? json.events : [];
|
|
135
|
+
return {
|
|
136
|
+
description: typeof json.description === 'string' ? json.description : '',
|
|
137
|
+
events: events.flatMap((event) =>
|
|
138
|
+
isRecord(event) && typeof event.name === 'string'
|
|
139
|
+
? [
|
|
140
|
+
{
|
|
141
|
+
description: typeof event.description === 'string' ? event.description : '',
|
|
142
|
+
name: event.name,
|
|
143
|
+
parameters: aiUIParametersOf(event.parameters),
|
|
144
|
+
},
|
|
145
|
+
]
|
|
146
|
+
: [],
|
|
147
|
+
),
|
|
148
|
+
name: json.name,
|
|
149
|
+
parameters: aiUIParametersOf(json.parameters),
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/** A component's portable JSON, as `parseAIUIComponentDefinition` reads it back. */
|
|
154
|
+
export const aiUIComponentDefinitionJSON = (definition: AIUIComponentDefinition) => ({
|
|
155
|
+
description: definition.description,
|
|
156
|
+
events: definition.events.map(({ description, name, parameters }) => ({
|
|
157
|
+
description,
|
|
158
|
+
name,
|
|
159
|
+
...(parameters.length ? { parameters: aiUIObjectSchema(parameters) } : {}),
|
|
160
|
+
})),
|
|
161
|
+
name: definition.name,
|
|
162
|
+
parameters: aiUIObjectSchema(definition.parameters),
|
|
163
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { isRecord, isSameJSON } from './AIUIHelpers';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The format a reply's UI is written in, such as `a2ui` or `openui`. Formats are an open set:
|
|
5
|
+
* a renderer says which one it reads.
|
|
6
|
+
*/
|
|
7
|
+
export type AIUIFormat = 'a2ui' | 'openui' | (string & {});
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The UI an agent wrote for a reply, which shows in place of the reply's text.
|
|
11
|
+
*/
|
|
12
|
+
export type AIUIDocument = {
|
|
13
|
+
/** The document in its format's own shape: a program's text, or JSON. */
|
|
14
|
+
content: unknown;
|
|
15
|
+
/** The format it is written in. */
|
|
16
|
+
format: AIUIFormat;
|
|
17
|
+
/** Whether the agent is still writing it. */
|
|
18
|
+
isStreaming: boolean;
|
|
19
|
+
/** The format's version, when the agent names one. */
|
|
20
|
+
version?: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A reply's `ai_ui` field as the agents router writes it. An app that reads it from its Stream
|
|
25
|
+
* messages types it there with `ai_ui?: AIUIDocumentJSON` in its `CustomMessageData`.
|
|
26
|
+
*/
|
|
27
|
+
export type AIUIDocumentJSON = {
|
|
28
|
+
/** The document in its format's own shape: usually text, such as A2UI's JSON lines. */
|
|
29
|
+
content: unknown;
|
|
30
|
+
format: AIUIFormat;
|
|
31
|
+
/** `streaming` while the agent writes it, then `complete`. */
|
|
32
|
+
status?: 'streaming' | 'complete' | (string & {});
|
|
33
|
+
/** The version of the field's own layout; a newer one than this SDK reads shows the text. */
|
|
34
|
+
v?: number;
|
|
35
|
+
version?: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** The custom field of a message that holds its document. */
|
|
39
|
+
export const AI_UI_CUSTOM_DATA_KEY = 'ai_ui';
|
|
40
|
+
/** The newest version of the `ai_ui` field this SDK reads. */
|
|
41
|
+
export const AI_UI_SUPPORTED_VERSION = 1;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Reads the document of a message's `ai_ui` field, or returns `undefined` when it carries none
|
|
45
|
+
* this SDK can read: no format, no content, or a field newer than this SDK, which can lay its
|
|
46
|
+
* documents out differently. The reply then shows its text.
|
|
47
|
+
*/
|
|
48
|
+
export const parseAIUIDocument = (field: unknown): AIUIDocument | undefined => {
|
|
49
|
+
if (!isRecord(field)) return undefined;
|
|
50
|
+
const { content, format, status, v, version } = field;
|
|
51
|
+
if (typeof format !== 'string' || format === '') return undefined;
|
|
52
|
+
if (content === undefined || content === null) return undefined;
|
|
53
|
+
if (typeof v === 'number' && v > AI_UI_SUPPORTED_VERSION) return undefined;
|
|
54
|
+
return {
|
|
55
|
+
content,
|
|
56
|
+
format,
|
|
57
|
+
isStreaming: status === 'streaming',
|
|
58
|
+
...(typeof version === 'string' && version !== '' ? { version } : {}),
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/** The content of a document when it is text, such as an OpenUI program or A2UI's JSON lines. */
|
|
63
|
+
export const aiUIDocumentText = (document: AIUIDocument) =>
|
|
64
|
+
typeof document.content === 'string' ? document.content : undefined;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Whether two documents are the same, content included. A message is a new object on every
|
|
68
|
+
* update while a reply streams, so a document is compared by what it holds.
|
|
69
|
+
*/
|
|
70
|
+
export const isSameAIUIDocument = (a: AIUIDocument | undefined, b: AIUIDocument | undefined) =>
|
|
71
|
+
a === b ||
|
|
72
|
+
(!!a &&
|
|
73
|
+
!!b &&
|
|
74
|
+
a.format === b.format &&
|
|
75
|
+
a.version === b.version &&
|
|
76
|
+
a.isStreaming === b.isStreaming &&
|
|
77
|
+
isSameJSON(a.content, b.content));
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
createContext,
|
|
3
|
+
type ReactNode,
|
|
4
|
+
useContext,
|
|
5
|
+
useEffect,
|
|
6
|
+
useLayoutEffect,
|
|
7
|
+
useMemo,
|
|
8
|
+
useRef,
|
|
9
|
+
useState,
|
|
10
|
+
} from 'react';
|
|
11
|
+
import { Platform, type StyleProp, StyleSheet, View, type ViewStyle } from 'react-native';
|
|
12
|
+
import Animated, {
|
|
13
|
+
Easing,
|
|
14
|
+
ReduceMotion,
|
|
15
|
+
useAnimatedStyle,
|
|
16
|
+
useSharedValue,
|
|
17
|
+
withDelay,
|
|
18
|
+
withSpring,
|
|
19
|
+
withTiming,
|
|
20
|
+
} from 'react-native-reanimated';
|
|
21
|
+
|
|
22
|
+
import { useReduceMotion } from '../voice-visualization/useReduceMotion';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Spaces out the parts of a reply's UI that come in together, so they come in one after another
|
|
26
|
+
* rather than at once.
|
|
27
|
+
*/
|
|
28
|
+
export class AIUICascade {
|
|
29
|
+
/** How long after the part before it a part comes in, in seconds. */
|
|
30
|
+
static readonly step = 0.1;
|
|
31
|
+
/** The longest a part waits for the parts before it, in seconds. */
|
|
32
|
+
static readonly longestWait = 0.4;
|
|
33
|
+
|
|
34
|
+
private next = 0;
|
|
35
|
+
|
|
36
|
+
/** How long a part that comes in at `now`, in seconds, waits for the parts before it. */
|
|
37
|
+
delay(now = (typeof performance === 'undefined' ? Date.now() : performance.now()) / 1000) {
|
|
38
|
+
const start = Math.min(Math.max(now, this.next), now + AIUICascade.longestWait);
|
|
39
|
+
this.next = start + AIUICascade.step;
|
|
40
|
+
return start - now;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
type AIUIStage = {
|
|
45
|
+
cascade: AIUICascade;
|
|
46
|
+
/** Whether what shows now comes in with the part around it, rather than on its own. */
|
|
47
|
+
isCarried: boolean;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const AIUIStageContext = createContext<AIUIStage | undefined>(undefined);
|
|
51
|
+
|
|
52
|
+
// A spring with a response of 0.7 and a damping of 0.88. It settles in about as long.
|
|
53
|
+
const SPRING = { dampingRatio: 0.88, duration: 700 };
|
|
54
|
+
// With reduced motion a part only fades, which the system setting would otherwise skip.
|
|
55
|
+
const FADE = {
|
|
56
|
+
duration: 300,
|
|
57
|
+
easing: Easing.out(Easing.ease),
|
|
58
|
+
reduceMotion: ReduceMotion.Never,
|
|
59
|
+
};
|
|
60
|
+
// How far a part rises into place, how small it starts, and how far out of focus.
|
|
61
|
+
const RISE = 16;
|
|
62
|
+
const START_SCALE = 0.97;
|
|
63
|
+
const START_BLUR = 8;
|
|
64
|
+
// A blur only Android 12 and later draws; elsewhere a part comes in without it.
|
|
65
|
+
const CAN_BLUR = Platform.OS === 'android' && Number(Platform.Version) >= 31;
|
|
66
|
+
|
|
67
|
+
// Shows its content, bringing it in after the cascade's delay when it starts hidden.
|
|
68
|
+
const useEntrance = (
|
|
69
|
+
startsHidden: boolean,
|
|
70
|
+
cascade: AIUICascade | undefined,
|
|
71
|
+
resetKey?: unknown,
|
|
72
|
+
) => {
|
|
73
|
+
const reduceMotion = useReduceMotion();
|
|
74
|
+
const [shownFor, setShownFor] = useState(resetKey);
|
|
75
|
+
const [hasShownState, setHasShown] = useState(!startsHidden);
|
|
76
|
+
const isReset = !Object.is(shownFor, resetKey);
|
|
77
|
+
if (isReset) {
|
|
78
|
+
setShownFor(resetKey);
|
|
79
|
+
setHasShown(!startsHidden);
|
|
80
|
+
}
|
|
81
|
+
const hasShown = isReset ? !startsHidden : hasShownState;
|
|
82
|
+
const progress = useSharedValue(startsHidden ? 0 : 1);
|
|
83
|
+
const progressFor = useRef(resetKey);
|
|
84
|
+
useLayoutEffect(() => {
|
|
85
|
+
if (Object.is(progressFor.current, resetKey)) return;
|
|
86
|
+
progressFor.current = resetKey;
|
|
87
|
+
progress.value = startsHidden ? 0 : 1;
|
|
88
|
+
});
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (hasShown) return;
|
|
91
|
+
const delay = (cascade?.delay() ?? 0) * 1000;
|
|
92
|
+
progress.value = withDelay(delay, reduceMotion ? withTiming(1, FADE) : withSpring(1, SPRING));
|
|
93
|
+
setHasShown(true);
|
|
94
|
+
}, [cascade, hasShown, progress, reduceMotion]);
|
|
95
|
+
const style = useAnimatedStyle(() => {
|
|
96
|
+
const shown = Math.min(progress.value, 1);
|
|
97
|
+
if (reduceMotion) return { opacity: shown };
|
|
98
|
+
return {
|
|
99
|
+
opacity: shown,
|
|
100
|
+
transform: [
|
|
101
|
+
{ translateY: (1 - progress.value) * RISE },
|
|
102
|
+
{ scale: START_SCALE + (1 - START_SCALE) * progress.value },
|
|
103
|
+
],
|
|
104
|
+
// Back in focus as it settles: a blur this small draws nothing.
|
|
105
|
+
...(CAN_BLUR ? { filter: [{ blur: Math.max(0, 1 - shown) * START_BLUR }] } : {}),
|
|
106
|
+
};
|
|
107
|
+
}, [reduceMotion]);
|
|
108
|
+
return { hasShown, style };
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* A reply's generated UI as a whole: it comes in when it first shows while the agent writes it,
|
|
113
|
+
* and shows at once when it was written before, such as a reply from history.
|
|
114
|
+
*/
|
|
115
|
+
export const AIUIEntranceStage = ({
|
|
116
|
+
children,
|
|
117
|
+
isStreaming,
|
|
118
|
+
resetKey,
|
|
119
|
+
style,
|
|
120
|
+
}: {
|
|
121
|
+
children: ReactNode;
|
|
122
|
+
/** Whether the agent is writing the UI as it first shows. */
|
|
123
|
+
isStreaming: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Which reply's UI it shows: when it changes, it shows the UI as one mounted for it would, as
|
|
126
|
+
* when a list reuses it for another reply.
|
|
127
|
+
*/
|
|
128
|
+
resetKey?: unknown;
|
|
129
|
+
style?: StyleProp<ViewStyle>;
|
|
130
|
+
}) => {
|
|
131
|
+
const [held, setHeld] = useState(() => ({
|
|
132
|
+
cascade: new AIUICascade(),
|
|
133
|
+
isLive: isStreaming,
|
|
134
|
+
resetKey,
|
|
135
|
+
}));
|
|
136
|
+
let shown = held;
|
|
137
|
+
if (!Object.is(held.resetKey, resetKey)) {
|
|
138
|
+
shown = { cascade: new AIUICascade(), isLive: isStreaming, resetKey };
|
|
139
|
+
setHeld(shown);
|
|
140
|
+
}
|
|
141
|
+
const { cascade, isLive } = shown;
|
|
142
|
+
const { hasShown, style: entrance } = useEntrance(isLive, cascade, resetKey);
|
|
143
|
+
const stage = useMemo(
|
|
144
|
+
() => ({ cascade, isCarried: !isLive || !hasShown }),
|
|
145
|
+
[cascade, hasShown, isLive],
|
|
146
|
+
);
|
|
147
|
+
return (
|
|
148
|
+
<AIUIStageContext.Provider value={stage}>
|
|
149
|
+
<Animated.View style={[styles.entrance, entrance, style]}>{children}</Animated.View>
|
|
150
|
+
</AIUIStageContext.Provider>
|
|
151
|
+
);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Whether a part of a reply's generated UI comes in, as it was when the part first showed: a
|
|
156
|
+
* part that shows at once, such as one of a reply from history, can show in a plain view. A part
|
|
157
|
+
* mounted before it has anything to show passes `shows` as false until it does.
|
|
158
|
+
*/
|
|
159
|
+
export const useAIUIComesIn = (shows = true) => {
|
|
160
|
+
const stage = useContext(AIUIStageContext);
|
|
161
|
+
const [comesIn, setComesIn] = useState<boolean | undefined>(() =>
|
|
162
|
+
shows ? !!stage && !stage.isCarried : undefined,
|
|
163
|
+
);
|
|
164
|
+
if (comesIn !== undefined || !shows) return comesIn ?? false;
|
|
165
|
+
const now = !!stage && !stage.isCarried;
|
|
166
|
+
setComesIn(now);
|
|
167
|
+
return now;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* What a part of a reply's generated UI needs to come in when it shows, for a renderer that
|
|
172
|
+
* animates a view of its own rather than wrap the part in `AIUIEntrance`: the animated `style`
|
|
173
|
+
* for that view, and `scope`, to wrap what the part shows in, so what shows with it comes in
|
|
174
|
+
* with it. The same entrance as `AIUIEntrance`'s.
|
|
175
|
+
*/
|
|
176
|
+
export const useAIUIEntrance = () => {
|
|
177
|
+
const stage = useContext(AIUIStageContext);
|
|
178
|
+
const { hasShown, style } = useEntrance(!!stage && !stage.isCarried, stage?.cascade);
|
|
179
|
+
const inner = useMemo(
|
|
180
|
+
() => stage && { cascade: stage.cascade, isCarried: stage.isCarried || !hasShown },
|
|
181
|
+
[hasShown, stage],
|
|
182
|
+
);
|
|
183
|
+
const scope = useMemo(
|
|
184
|
+
() => (children: ReactNode) => (
|
|
185
|
+
<AIUIStageContext.Provider value={inner}>{children}</AIUIStageContext.Provider>
|
|
186
|
+
),
|
|
187
|
+
[inner],
|
|
188
|
+
);
|
|
189
|
+
return { scope, style: [styles.entrance, style] };
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Brings a part of a reply's generated UI in when it shows, such as when the agent writes it:
|
|
194
|
+
* the part fades in, rising into place and, on Android 12 and later, coming into focus, after the
|
|
195
|
+
* parts that came in just before it. What shows together with the reply's UI, or with a part
|
|
196
|
+
* around it, comes in with that, so a reply written before it showed shows at once. With reduced
|
|
197
|
+
* motion it only fades.
|
|
198
|
+
*
|
|
199
|
+
* Renderers give it to each part they place. Every app component has it.
|
|
200
|
+
*/
|
|
201
|
+
export const AIUIEntrance = ({
|
|
202
|
+
children,
|
|
203
|
+
style,
|
|
204
|
+
}: {
|
|
205
|
+
children: ReactNode;
|
|
206
|
+
style?: StyleProp<ViewStyle>;
|
|
207
|
+
}) => {
|
|
208
|
+
const comesIn = useAIUIComesIn();
|
|
209
|
+
return comesIn ? (
|
|
210
|
+
<EnteringPart style={style}>{children}</EnteringPart>
|
|
211
|
+
) : (
|
|
212
|
+
<View style={[styles.entrance, style]}>{children}</View>
|
|
213
|
+
);
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const EnteringPart = ({
|
|
217
|
+
children,
|
|
218
|
+
style,
|
|
219
|
+
}: {
|
|
220
|
+
children: ReactNode;
|
|
221
|
+
style?: StyleProp<ViewStyle>;
|
|
222
|
+
}) => {
|
|
223
|
+
const { scope, style: entrance } = useAIUIEntrance();
|
|
224
|
+
return <Animated.View style={[entrance, style]}>{scope(children)}</Animated.View>;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
const styles = StyleSheet.create({
|
|
228
|
+
entrance: { transformOrigin: 'top' },
|
|
229
|
+
});
|