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,628 @@
|
|
|
1
|
+
import { StateStore } from '@stream-io/state-store';
|
|
2
|
+
|
|
3
|
+
import { AIAgentError } from './AIAgentError';
|
|
4
|
+
import { AIConversationExchange, hasEmptyContent } from './AIConversationExchange';
|
|
5
|
+
import { editActionOf, latestUserMessageIdOf, replyActionsOf } from './offers';
|
|
6
|
+
import {
|
|
7
|
+
type AIAgentActivity,
|
|
8
|
+
AIAgentActivityStates,
|
|
9
|
+
type AIConversationActions,
|
|
10
|
+
type AIConversationFeed,
|
|
11
|
+
type AIConversationRequest,
|
|
12
|
+
type AIConversationStatus,
|
|
13
|
+
type AIConversationTransport,
|
|
14
|
+
isAIConversationAnswering,
|
|
15
|
+
} from './types';
|
|
16
|
+
|
|
17
|
+
import { generateUUIDv4 } from '../../internal/uuid';
|
|
18
|
+
import type { AIMessageRating, AIReplyActionsProps } from '../../message/AIReplyActions';
|
|
19
|
+
import type { AIChatOption } from '../../message-composer/ChatOptions';
|
|
20
|
+
import type { MediaAsset } from '../../services/media-picker-service/AbstractMediaPickerService';
|
|
21
|
+
import { type ComposerState, createNewComposerStore } from '../../store/composer/store';
|
|
22
|
+
import type { AIToolApprover } from '../../tool-calls/AIToolApprover';
|
|
23
|
+
import type { AIMessage, AIPendingMessage } from '../types';
|
|
24
|
+
|
|
25
|
+
export type AIConversationControllerState<Message extends AIMessage = AIMessage> = {
|
|
26
|
+
/** The conversation as it shows, oldest message first. */
|
|
27
|
+
messages: readonly Message[];
|
|
28
|
+
/**
|
|
29
|
+
* The message the person sent last that is not in the conversation yet. It stays until its
|
|
30
|
+
* reply starts, and after it was stopped or failed, while `retry()` can send it again.
|
|
31
|
+
*/
|
|
32
|
+
pendingMessage: AIPendingMessage | undefined;
|
|
33
|
+
/** Where the latest exchange with the agent is. */
|
|
34
|
+
status: AIConversationStatus;
|
|
35
|
+
/**
|
|
36
|
+
* Why the latest request failed, or, as an `AIAgentError`, what the agent said when it couldn't
|
|
37
|
+
* answer or that it didn't answer in time. It stays until the next request, or until a reply
|
|
38
|
+
* starts after all.
|
|
39
|
+
*/
|
|
40
|
+
error: Error | undefined;
|
|
41
|
+
/** What the agent says it is doing besides what its reply shows, such as checking sources. */
|
|
42
|
+
activity: AIAgentActivity | undefined;
|
|
43
|
+
/** Whether the conversation has messages before the first one, which `loadOlderMessages` loads. */
|
|
44
|
+
hasOlderMessages: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* How the person rated replies, by the reply's id: the rating they gave on this device, or else
|
|
47
|
+
* the reply's own `rating`.
|
|
48
|
+
*/
|
|
49
|
+
ratings: Readonly<Record<string, AIMessageRating>>;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type AIConversationControllerOptions<Message extends AIMessage = AIMessage> = {
|
|
53
|
+
/** How the conversation reaches the agent and learns what it holds. Connected straight away. */
|
|
54
|
+
transport: AIConversationTransport<Message>;
|
|
55
|
+
/** What the conversation's views offer. All of them by default. */
|
|
56
|
+
actions?: AIConversationActions;
|
|
57
|
+
/** Who answers tool calls' questions and sign-ins on this device, which the conversation asks them. */
|
|
58
|
+
approver?: AIToolApprover;
|
|
59
|
+
/** What the person writes, such as a store the app fills itself. A new one by default. */
|
|
60
|
+
composer?: StateStore<ComposerState>;
|
|
61
|
+
/**
|
|
62
|
+
* How many milliseconds the controller waits, once the agent has the request, for the agent to
|
|
63
|
+
* start its reply or say what it is doing, before it shows an `AIAgentError`. While the agent
|
|
64
|
+
* says it is working, such as thinking, it waits as long as that takes. Five minutes by default;
|
|
65
|
+
* `null` or `Infinity` waits as long as it takes.
|
|
66
|
+
*/
|
|
67
|
+
replyTimeout?: number | null;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/** What the person sends: what `ComposerView` hands on. */
|
|
71
|
+
export type AIConversationSendData = {
|
|
72
|
+
text: string;
|
|
73
|
+
/** The files the person picked, on this device. */
|
|
74
|
+
attachments?: MediaAsset[];
|
|
75
|
+
/** The option the person picked in the composer. */
|
|
76
|
+
chatOption?: AIChatOption;
|
|
77
|
+
custom?: Record<string, unknown>;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const DEFAULT_REPLY_TIMEOUT = 5 * 60 * 1000;
|
|
81
|
+
// The longest `setTimeout` waits; anything longer waits as long as it takes.
|
|
82
|
+
const MAX_TIMEOUT = 2 ** 31 - 1;
|
|
83
|
+
|
|
84
|
+
const ALL_ACTIONS: Required<AIConversationActions> = { edit: true, rate: true, regenerate: true };
|
|
85
|
+
|
|
86
|
+
const isAbortError = (error: unknown) =>
|
|
87
|
+
(error as { name?: unknown } | null)?.name === 'AbortError';
|
|
88
|
+
|
|
89
|
+
const asError = (error: unknown) => (error instanceof Error ? error : new Error(String(error)));
|
|
90
|
+
|
|
91
|
+
const sameItems = <T>(a: readonly T[], b: readonly T[]) =>
|
|
92
|
+
a.length === b.length && a.every((item, index) => item === b[index]);
|
|
93
|
+
|
|
94
|
+
const sameRatings = (
|
|
95
|
+
a: Readonly<Record<string, AIMessageRating>>,
|
|
96
|
+
b: Readonly<Record<string, AIMessageRating>>,
|
|
97
|
+
) => {
|
|
98
|
+
const keys = Object.keys(a);
|
|
99
|
+
return keys.length === Object.keys(b).length && keys.every((key) => a[key] === b[key]);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// A rating the person gave a reply on this device, shown in place of the reply's own.
|
|
103
|
+
type RatingChange = {
|
|
104
|
+
shown: AIMessageRating | null;
|
|
105
|
+
// What the transport has, which the rating goes back to when it can't take a new one.
|
|
106
|
+
sent: AIMessageRating | null;
|
|
107
|
+
// Tells the latest rating of the reply apart from those before it.
|
|
108
|
+
attempt: number;
|
|
109
|
+
// Sends the latest rating, after those before it.
|
|
110
|
+
sending?: Promise<void>;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The state behind an AI conversation, and what the person does in it.
|
|
115
|
+
*
|
|
116
|
+
* It holds the conversation's messages, where the latest exchange with the agent is and why it
|
|
117
|
+
* failed, and it sends what the person asks through its `AIConversationTransport`. Give it to
|
|
118
|
+
* `AIConversation` and `ComposerView` as `conversation`, which show it and act on it: sending,
|
|
119
|
+
* stopping, regenerating and rating replies, and editing the person's latest message.
|
|
120
|
+
*
|
|
121
|
+
* ```tsx
|
|
122
|
+
* const [conversation] = useState(() => new AIConversationController({ transport }));
|
|
123
|
+
* useEffect(() => () => conversation.dispose(), [conversation]);
|
|
124
|
+
*
|
|
125
|
+
* <AIConversation conversation={conversation} />
|
|
126
|
+
* <ComposerView conversation={conversation} />
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* What the person sends shows straight away, and the agent thinks until its reply starts. While
|
|
130
|
+
* a reply is written again, or a message the person edited is answered again, the messages it
|
|
131
|
+
* replaces are left out of `messages` until the new reply starts.
|
|
132
|
+
*/
|
|
133
|
+
export class AIConversationController<Message extends AIMessage = AIMessage> {
|
|
134
|
+
/** The conversation's state, to follow with `useStateStore`. */
|
|
135
|
+
readonly state: StateStore<AIConversationControllerState<Message>>;
|
|
136
|
+
/** What the person is writing: `ComposerView` shows it, and editing a message fills it. */
|
|
137
|
+
readonly composer: StateStore<ComposerState>;
|
|
138
|
+
/** Who answers tool calls' questions and sign-ins on this device. */
|
|
139
|
+
readonly approver: AIToolApprover | undefined;
|
|
140
|
+
/** What the conversation's views offer the person to do with its messages. */
|
|
141
|
+
readonly actions: Required<AIConversationActions>;
|
|
142
|
+
|
|
143
|
+
private readonly transport: AIConversationTransport<Message>;
|
|
144
|
+
private readonly replyTimeout: number | null;
|
|
145
|
+
private readonly disconnect: (() => void) | undefined;
|
|
146
|
+
private disposed = false;
|
|
147
|
+
// The messages as the transport last told them, including those left out of `messages`.
|
|
148
|
+
private received: readonly Message[] = [];
|
|
149
|
+
// The latest request, until its reply starts or another request takes its place.
|
|
150
|
+
private exchange: AIConversationExchange<Message> | undefined;
|
|
151
|
+
// Counts the requests and stops, so the outcome of one that was overtaken is ignored.
|
|
152
|
+
private generation = 0;
|
|
153
|
+
// Replies stopped while they were written, which are finished whatever they say.
|
|
154
|
+
private stopped = new Set<string>();
|
|
155
|
+
private activity: AIAgentActivity | undefined;
|
|
156
|
+
// Whether what the agent says it is doing is ignored, after it was stopped, until it stops
|
|
157
|
+
// saying anything.
|
|
158
|
+
private ignoresActivity = false;
|
|
159
|
+
private error: Error | undefined;
|
|
160
|
+
private hasOlderMessages = false;
|
|
161
|
+
// The latest stop, which the next request waits for: the agent would stop that one too.
|
|
162
|
+
private stopping: Promise<void> | undefined;
|
|
163
|
+
// Ends the wait for the latest request's reply when the agent says nothing for too long.
|
|
164
|
+
private replyTimer: ReturnType<typeof setTimeout> | undefined;
|
|
165
|
+
private edited: Message | undefined;
|
|
166
|
+
private ratingChanges = new Map<string, RatingChange>();
|
|
167
|
+
private ratingAttempts = 0;
|
|
168
|
+
private isLoadingOlderMessages = false;
|
|
169
|
+
|
|
170
|
+
constructor({
|
|
171
|
+
actions,
|
|
172
|
+
approver,
|
|
173
|
+
composer,
|
|
174
|
+
replyTimeout = DEFAULT_REPLY_TIMEOUT,
|
|
175
|
+
transport,
|
|
176
|
+
}: AIConversationControllerOptions<Message>) {
|
|
177
|
+
this.transport = transport;
|
|
178
|
+
this.composer = composer ?? createNewComposerStore();
|
|
179
|
+
this.approver = approver;
|
|
180
|
+
this.actions = { ...ALL_ACTIONS, ...actions };
|
|
181
|
+
this.replyTimeout = replyTimeout;
|
|
182
|
+
this.state = new StateStore<AIConversationControllerState<Message>>({
|
|
183
|
+
activity: undefined,
|
|
184
|
+
error: undefined,
|
|
185
|
+
hasOlderMessages: false,
|
|
186
|
+
messages: [],
|
|
187
|
+
pendingMessage: undefined,
|
|
188
|
+
ratings: {},
|
|
189
|
+
status: 'ready',
|
|
190
|
+
});
|
|
191
|
+
const disconnect = transport.connect(this.makeFeed());
|
|
192
|
+
this.disconnect = typeof disconnect === 'function' ? disconnect : undefined;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* The person's message they are editing in the composer, which the next message they send
|
|
197
|
+
* replaces. The composer shows that they are editing it, with a button that cancels it.
|
|
198
|
+
*/
|
|
199
|
+
get editingMessage() {
|
|
200
|
+
return this.composer.getLatestValue().isEditing ? this.edited : undefined;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/** Stops following the transport and lets go of what is on its way. */
|
|
204
|
+
dispose() {
|
|
205
|
+
if (this.disposed) return;
|
|
206
|
+
this.disposed = true;
|
|
207
|
+
this.clearReplyTimer();
|
|
208
|
+
this.disconnect?.();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// What the person does
|
|
212
|
+
|
|
213
|
+
/** Sends a message, or the person's edit of the message they are editing. */
|
|
214
|
+
send({ attachments = [], chatOption, custom, text }: AIConversationSendData) {
|
|
215
|
+
if (text.trim() === '' && attachments.length === 0) return;
|
|
216
|
+
const editing = this.editingMessage;
|
|
217
|
+
this.edited = undefined;
|
|
218
|
+
if (this.composer.getLatestValue().isEditing) this.composer.partialNext({ isEditing: false });
|
|
219
|
+
this.start({
|
|
220
|
+
attachments,
|
|
221
|
+
chatOption,
|
|
222
|
+
custom,
|
|
223
|
+
kind: editing ? 'edit' : 'message',
|
|
224
|
+
message: editing,
|
|
225
|
+
messageId: generateUUIDv4(),
|
|
226
|
+
text,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Stops the reply the agent is writing. What it wrote so far stays. When the reply hasn't
|
|
232
|
+
* started yet, the person's message stays, and a reply that still arrives is finished whatever
|
|
233
|
+
* it says.
|
|
234
|
+
*/
|
|
235
|
+
stop() {
|
|
236
|
+
if (!isAIConversationAnswering(this.state.getLatestValue().status)) return;
|
|
237
|
+
const id = ++this.generation;
|
|
238
|
+
this.activity = undefined;
|
|
239
|
+
this.ignoresActivity = true;
|
|
240
|
+
if (this.exchange?.state === 'waiting') this.exchange.state = 'stopped';
|
|
241
|
+
const writing = this.writingReply;
|
|
242
|
+
if (writing) this.stopped.add(writing);
|
|
243
|
+
this.refresh();
|
|
244
|
+
this.stopping = (async () => {
|
|
245
|
+
try {
|
|
246
|
+
await this.transport.stop();
|
|
247
|
+
} catch (error) {
|
|
248
|
+
this.stopFailed(id, writing, error);
|
|
249
|
+
}
|
|
250
|
+
})();
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/** Asks the agent for a new reply in place of `reply`, and of those after it. */
|
|
254
|
+
regenerate(reply: Message) {
|
|
255
|
+
const index = this.indexOf(reply);
|
|
256
|
+
if (index < 0 || this.received[index].role === 'user') return;
|
|
257
|
+
this.start(this.regenerateRequest(index));
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** Puts a message of the person's in the composer to edit. The next message they send replaces it. */
|
|
261
|
+
edit(message: Message) {
|
|
262
|
+
if (message.role !== 'user') return;
|
|
263
|
+
this.edited = message;
|
|
264
|
+
this.composer.partialNext({ isEditing: true, text: message.text });
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** Stops editing a message, and empties the composer. */
|
|
268
|
+
cancelEditing() {
|
|
269
|
+
if (!this.editingMessage) return;
|
|
270
|
+
this.edited = undefined;
|
|
271
|
+
this.composer.partialNext({ isEditing: false, text: '' });
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Tries again after `error`: sends the request that failed again, with the same message id, or
|
|
276
|
+
* asks the agent again for the reply it couldn't write.
|
|
277
|
+
*/
|
|
278
|
+
retry() {
|
|
279
|
+
const { exchange } = this;
|
|
280
|
+
if (!exchange?.hasFailed) return;
|
|
281
|
+
this.start(exchange.retryRequest(this.received));
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/** Forgets `error`, and the request that failed. */
|
|
285
|
+
clearError() {
|
|
286
|
+
this.error = undefined;
|
|
287
|
+
if (this.exchange?.hasFailed) this.exchange = undefined;
|
|
288
|
+
this.refresh();
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Rates a reply, or takes the rating back with `null`. Ratings reach the transport in the order
|
|
293
|
+
* the person gives them, and the reply's rating goes back to the one the transport has if it
|
|
294
|
+
* can't take the new one.
|
|
295
|
+
*/
|
|
296
|
+
rate(reply: Message, rating: AIMessageRating | null) {
|
|
297
|
+
const current = this.state.getLatestValue().ratings[reply.id] ?? null;
|
|
298
|
+
if (current === rating) return;
|
|
299
|
+
const attempt = ++this.ratingAttempts;
|
|
300
|
+
const change = this.ratingChanges.get(reply.id) ?? {
|
|
301
|
+
attempt: 0,
|
|
302
|
+
sent: current,
|
|
303
|
+
shown: current,
|
|
304
|
+
};
|
|
305
|
+
const earlier = change.sending;
|
|
306
|
+
change.shown = rating;
|
|
307
|
+
change.attempt = attempt;
|
|
308
|
+
change.sending = (async () => {
|
|
309
|
+
await earlier;
|
|
310
|
+
await this.sendRating(rating, reply, attempt);
|
|
311
|
+
})();
|
|
312
|
+
this.ratingChanges.set(reply.id, change);
|
|
313
|
+
this.refresh();
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** Loads the messages before the first one, while there are any. */
|
|
317
|
+
loadOlderMessages = async () => {
|
|
318
|
+
if (!this.hasOlderMessages || this.isLoadingOlderMessages) return;
|
|
319
|
+
this.isLoadingOlderMessages = true;
|
|
320
|
+
try {
|
|
321
|
+
await this.transport.loadOlderMessages?.();
|
|
322
|
+
} catch {
|
|
323
|
+
// The person scrolls to the start again to try again.
|
|
324
|
+
} finally {
|
|
325
|
+
this.isLoadingOlderMessages = false;
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
// What the conversation's views offer
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* What the person can do with a finished reply: rate it, and write it again while it is the
|
|
333
|
+
* latest and the agent isn't answering.
|
|
334
|
+
*/
|
|
335
|
+
replyActions(reply: Message, isLatestReply: boolean): Omit<AIReplyActionsProps, 'text'> {
|
|
336
|
+
return replyActionsOf(this, this.state.getLatestValue(), reply, isLatestReply);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/** Edits a message of the person's, when it is their latest and the agent isn't answering. */
|
|
340
|
+
editAction(message: Message): (() => void) | undefined {
|
|
341
|
+
const { messages, status } = this.state.getLatestValue();
|
|
342
|
+
return editActionOf(
|
|
343
|
+
this,
|
|
344
|
+
{ latestUserMessageId: latestUserMessageIdOf(messages), status },
|
|
345
|
+
message,
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// What the transport says
|
|
350
|
+
|
|
351
|
+
private makeFeed(): AIConversationFeed<Message> {
|
|
352
|
+
const isDisposed = () => this.disposed;
|
|
353
|
+
return {
|
|
354
|
+
get isConnected() {
|
|
355
|
+
return !isDisposed();
|
|
356
|
+
},
|
|
357
|
+
updateActivity: (activity) => {
|
|
358
|
+
if (!this.disposed) this.receiveActivity(activity);
|
|
359
|
+
},
|
|
360
|
+
updateHasOlderMessages: (hasOlderMessages) => {
|
|
361
|
+
if (this.disposed || this.hasOlderMessages === hasOlderMessages) return;
|
|
362
|
+
this.hasOlderMessages = hasOlderMessages;
|
|
363
|
+
this.refresh();
|
|
364
|
+
},
|
|
365
|
+
updateMessages: (messages) => {
|
|
366
|
+
if (!this.disposed) this.receiveMessages(messages);
|
|
367
|
+
},
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
private receiveMessages(messages: readonly Message[]) {
|
|
372
|
+
this.received = messages;
|
|
373
|
+
const { exchange } = this;
|
|
374
|
+
const reply = exchange?.reply(messages);
|
|
375
|
+
if (exchange && reply) this.receiveReply(reply, exchange);
|
|
376
|
+
this.refresh();
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
private receiveActivity(activity: AIAgentActivity | undefined) {
|
|
380
|
+
if (!activity) {
|
|
381
|
+
this.ignoresActivity = false;
|
|
382
|
+
this.activity = undefined;
|
|
383
|
+
// The agent stopped saying it is working without starting its reply.
|
|
384
|
+
if (this.exchange?.state === 'waiting') this.waitForReply(this.exchange.id);
|
|
385
|
+
this.refresh();
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
if (this.ignoresActivity) return;
|
|
389
|
+
this.activity = activity;
|
|
390
|
+
if (activity.state === AIAgentActivityStates.error) {
|
|
391
|
+
this.agentCouldNotAnswer(new AIAgentError(activity.text));
|
|
392
|
+
} else {
|
|
393
|
+
// The agent is working on it, however long it thinks.
|
|
394
|
+
this.clearReplyTimer();
|
|
395
|
+
}
|
|
396
|
+
this.refresh();
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// Private
|
|
400
|
+
|
|
401
|
+
private start(request: AIConversationRequest<Message>) {
|
|
402
|
+
const id = ++this.generation;
|
|
403
|
+
this.error = undefined;
|
|
404
|
+
this.activity = undefined;
|
|
405
|
+
this.ignoresActivity = false;
|
|
406
|
+
this.stopped = new Set();
|
|
407
|
+
this.clearReplyTimer();
|
|
408
|
+
this.exchange = new AIConversationExchange(id, request, this.received);
|
|
409
|
+
this.refresh();
|
|
410
|
+
const previousStop = this.stopping;
|
|
411
|
+
void (async () => {
|
|
412
|
+
// The agent would stop a request that reaches it before the stop made before it.
|
|
413
|
+
await previousStop;
|
|
414
|
+
if (this.disposed) return;
|
|
415
|
+
try {
|
|
416
|
+
await this.transport.send(request);
|
|
417
|
+
this.requestSent(id);
|
|
418
|
+
} catch (error) {
|
|
419
|
+
this.requestFailed(id, error);
|
|
420
|
+
}
|
|
421
|
+
})();
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// The reply to the latest request arrived: once it shows something, or as soon as it arrives
|
|
425
|
+
// after the person stopped the request.
|
|
426
|
+
private receiveReply(reply: Message, exchange: AIConversationExchange<Message>) {
|
|
427
|
+
if (exchange.state === 'stopped') {
|
|
428
|
+
if (reply.isGenerating) this.stopped.add(reply.id);
|
|
429
|
+
this.exchange = undefined;
|
|
430
|
+
} else if (!hasEmptyContent(reply) || !reply.isGenerating) {
|
|
431
|
+
this.exchange = undefined;
|
|
432
|
+
this.clearReplyTimer();
|
|
433
|
+
if (exchange.hasFailed) {
|
|
434
|
+
// The agent answered after all.
|
|
435
|
+
this.error = undefined;
|
|
436
|
+
this.stopped.delete(reply.id);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
private requestSent(id: number) {
|
|
442
|
+
const { exchange } = this;
|
|
443
|
+
// The agent may already say it is working on it.
|
|
444
|
+
if (this.disposed || exchange?.id !== id || exchange.state !== 'waiting' || this.activity) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
this.waitForReply(id);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
private requestFailed(id: number, error: unknown) {
|
|
451
|
+
const { exchange } = this;
|
|
452
|
+
// Its reply started, so the agent had it, another request took its place, or it already
|
|
453
|
+
// failed.
|
|
454
|
+
if (this.disposed || exchange?.id !== id || exchange.hasFailed) return;
|
|
455
|
+
if (isAbortError(error)) {
|
|
456
|
+
this.exchange = undefined;
|
|
457
|
+
} else {
|
|
458
|
+
exchange.state = 'failed';
|
|
459
|
+
this.error = asError(error);
|
|
460
|
+
}
|
|
461
|
+
this.refresh();
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
// The agent goes on answering, and the composer offers to stop it again.
|
|
465
|
+
private stopFailed(id: number, writing: string | undefined, error: unknown) {
|
|
466
|
+
if (this.disposed || id !== this.generation || isAbortError(error)) return;
|
|
467
|
+
if (writing) this.stopped.delete(writing);
|
|
468
|
+
const { exchange } = this;
|
|
469
|
+
if (exchange?.state === 'stopped') {
|
|
470
|
+
exchange.state = 'waiting';
|
|
471
|
+
this.waitForReply(exchange.id);
|
|
472
|
+
}
|
|
473
|
+
this.ignoresActivity = false;
|
|
474
|
+
this.refresh();
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// The agent couldn't answer the latest request, or the latest message: what it was writing is
|
|
478
|
+
// finished, and `retry()` asks it again.
|
|
479
|
+
private agentCouldNotAnswer(error: AIAgentError) {
|
|
480
|
+
const writing = this.writingReply;
|
|
481
|
+
if (writing) this.stopped.add(writing);
|
|
482
|
+
const request = this.exchange ? undefined : this.answerAgainRequest;
|
|
483
|
+
if (request) {
|
|
484
|
+
this.exchange = new AIConversationExchange(++this.generation, request, this.received);
|
|
485
|
+
}
|
|
486
|
+
if (this.exchange) this.exchange.state = 'unanswered';
|
|
487
|
+
this.clearReplyTimer();
|
|
488
|
+
this.error = error;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
private waitForReply(id: number) {
|
|
492
|
+
this.clearReplyTimer();
|
|
493
|
+
const timeout = this.replyTimeout;
|
|
494
|
+
if (timeout === null || !Number.isFinite(timeout) || timeout > MAX_TIMEOUT) return;
|
|
495
|
+
this.replyTimer = setTimeout(() => this.replyTimedOut(id), Math.max(timeout, 0));
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
private clearReplyTimer() {
|
|
499
|
+
if (this.replyTimer !== undefined) clearTimeout(this.replyTimer);
|
|
500
|
+
this.replyTimer = undefined;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
private replyTimedOut(id: number) {
|
|
504
|
+
this.replyTimer = undefined;
|
|
505
|
+
const { exchange } = this;
|
|
506
|
+
if (this.disposed || exchange?.id !== id || exchange.state !== 'waiting') return;
|
|
507
|
+
this.agentCouldNotAnswer(new AIAgentError());
|
|
508
|
+
this.refresh();
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// Sends the latest rating of a reply. Those it replaced while one was on its way aren't.
|
|
512
|
+
private async sendRating(rating: AIMessageRating | null, reply: Message, attempt: number) {
|
|
513
|
+
if (this.disposed || this.ratingChanges.get(reply.id)?.attempt !== attempt) return;
|
|
514
|
+
try {
|
|
515
|
+
await this.transport.rate?.(reply, rating);
|
|
516
|
+
const change = this.ratingChanges.get(reply.id);
|
|
517
|
+
if (change) change.sent = rating;
|
|
518
|
+
} catch {
|
|
519
|
+
const change = this.ratingChanges.get(reply.id);
|
|
520
|
+
if (this.disposed || !change || change.attempt !== attempt) return;
|
|
521
|
+
change.shown = change.sent;
|
|
522
|
+
this.refresh();
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// Asks for a new reply in place of the one at `index`, to the person's message before it.
|
|
527
|
+
private regenerateRequest(index: number): AIConversationRequest<Message> {
|
|
528
|
+
const prompt = this.received
|
|
529
|
+
.slice(0, index)
|
|
530
|
+
.reverse()
|
|
531
|
+
.find((message) => message.role === 'user');
|
|
532
|
+
return {
|
|
533
|
+
attachments: [],
|
|
534
|
+
kind: 'regenerate',
|
|
535
|
+
message: this.received[index],
|
|
536
|
+
messageId: generateUUIDv4(),
|
|
537
|
+
text: prompt?.text ?? '',
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
// Asks again for the latest message's reply: the reply written again, or one to the person's
|
|
542
|
+
// message, which has none.
|
|
543
|
+
private get answerAgainRequest(): AIConversationRequest<Message> | undefined {
|
|
544
|
+
const last = this.received.length - 1;
|
|
545
|
+
if (last < 0) return undefined;
|
|
546
|
+
if (this.received[last].role !== 'user') return this.regenerateRequest(last);
|
|
547
|
+
return {
|
|
548
|
+
attachments: [],
|
|
549
|
+
kind: 'regenerate',
|
|
550
|
+
messageId: generateUUIDv4(),
|
|
551
|
+
text: this.received[last].text,
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
// The latest reply, while the agent writes it.
|
|
556
|
+
private get writingReply() {
|
|
557
|
+
const last = this.received[this.received.length - 1];
|
|
558
|
+
return last && last.role !== 'user' && last.isGenerating ? last.id : undefined;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
private indexOf(message: Message) {
|
|
562
|
+
return this.received.findIndex((item) => item.id === message.id);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
// Works out what the conversation shows and where it is, after anything changes.
|
|
566
|
+
private refresh() {
|
|
567
|
+
const current = this.state.getLatestValue();
|
|
568
|
+
const replaced = this.exchange?.state === 'waiting' ? this.exchange.replaced : undefined;
|
|
569
|
+
let messages: readonly Message[] =
|
|
570
|
+
!replaced && this.stopped.size === 0
|
|
571
|
+
? this.received
|
|
572
|
+
: this.received.filter(
|
|
573
|
+
(message) =>
|
|
574
|
+
// A reply stopped before it showed anything has nothing to show, and the
|
|
575
|
+
// conversation would think it is still on its way.
|
|
576
|
+
!replaced?.has(message.id) &&
|
|
577
|
+
!(this.stopped.has(message.id) && hasEmptyContent(message)),
|
|
578
|
+
);
|
|
579
|
+
if (sameItems(messages, current.messages)) messages = current.messages;
|
|
580
|
+
const shownPending = this.exchange?.shownPending;
|
|
581
|
+
const pendingMessage =
|
|
582
|
+
current.pendingMessage?.id === shownPending?.id ? current.pendingMessage : shownPending;
|
|
583
|
+
const nextRatings = this.currentRatings();
|
|
584
|
+
const ratings = sameRatings(nextRatings, current.ratings) ? current.ratings : nextRatings;
|
|
585
|
+
const next: AIConversationControllerState<Message> = {
|
|
586
|
+
activity: this.activity,
|
|
587
|
+
error: this.error,
|
|
588
|
+
hasOlderMessages: this.hasOlderMessages,
|
|
589
|
+
messages,
|
|
590
|
+
pendingMessage,
|
|
591
|
+
ratings,
|
|
592
|
+
status: this.currentStatus(messages),
|
|
593
|
+
};
|
|
594
|
+
const changed = (Object.keys(next) as (keyof typeof next)[]).some(
|
|
595
|
+
(key) => next[key] !== current[key],
|
|
596
|
+
);
|
|
597
|
+
if (changed) this.state.next(next);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
private currentRatings() {
|
|
601
|
+
const ratings: Record<string, AIMessageRating> = {};
|
|
602
|
+
for (const message of this.received) {
|
|
603
|
+
if (message.role !== 'user' && message.rating) ratings[message.id] = message.rating;
|
|
604
|
+
}
|
|
605
|
+
for (const [id, change] of this.ratingChanges) {
|
|
606
|
+
if (change.shown) ratings[id] = change.shown;
|
|
607
|
+
else delete ratings[id];
|
|
608
|
+
}
|
|
609
|
+
return ratings;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
private currentStatus(messages: readonly Message[]): AIConversationStatus {
|
|
613
|
+
if (this.exchange?.state === 'waiting') return 'submitted';
|
|
614
|
+
const last = messages[messages.length - 1];
|
|
615
|
+
if (last && last.role !== 'user' && last.isGenerating && !this.stopped.has(last.id)) {
|
|
616
|
+
return hasEmptyContent(last) ? 'submitted' : 'streaming';
|
|
617
|
+
}
|
|
618
|
+
// The agent is working on the person's latest message, whose reply isn't here yet.
|
|
619
|
+
if (
|
|
620
|
+
this.activity &&
|
|
621
|
+
this.activity.state !== AIAgentActivityStates.error &&
|
|
622
|
+
(!last || last.role === 'user')
|
|
623
|
+
) {
|
|
624
|
+
return 'submitted';
|
|
625
|
+
}
|
|
626
|
+
return this.error ? 'error' : 'ready';
|
|
627
|
+
}
|
|
628
|
+
}
|