@stack-spot/ai-chat-widget 0.11.0 → 1.0.0-dev.1768324407795
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/CHANGELOG.md +972 -0
- package/README.md +1 -0
- package/dist/StackspotAIWidget.d.ts +48 -7
- package/dist/StackspotAIWidget.d.ts.map +1 -1
- package/dist/StackspotAIWidget.js +22 -23
- package/dist/StackspotAIWidget.js.map +1 -1
- package/dist/app-metadata.json +175 -0
- package/dist/assets/placeholder.png +0 -0
- package/dist/chat-interceptors/CustomInputs.d.ts +4 -1
- package/dist/chat-interceptors/CustomInputs.d.ts.map +1 -1
- package/dist/chat-interceptors/CustomInputs.js +10 -1
- package/dist/chat-interceptors/CustomInputs.js.map +1 -1
- package/dist/chat-interceptors/quick-command-questions.d.ts +10 -0
- package/dist/chat-interceptors/quick-command-questions.d.ts.map +1 -1
- package/dist/chat-interceptors/quick-command-questions.js +12 -2
- package/dist/chat-interceptors/quick-command-questions.js.map +1 -1
- package/dist/chat-interceptors/quick-commands.d.ts +11 -0
- package/dist/chat-interceptors/quick-commands.d.ts.map +1 -1
- package/dist/chat-interceptors/quick-commands.js +241 -48
- package/dist/chat-interceptors/quick-commands.js.map +1 -1
- package/dist/chat-interceptors/send-message.d.ts +26 -1
- package/dist/chat-interceptors/send-message.d.ts.map +1 -1
- package/dist/chat-interceptors/send-message.js +227 -26
- package/dist/chat-interceptors/send-message.js.map +1 -1
- package/dist/components/AdaptiveTextArea.d.ts +15 -3
- package/dist/components/AdaptiveTextArea.d.ts.map +1 -1
- package/dist/components/AdaptiveTextArea.js +22 -10
- package/dist/components/AdaptiveTextArea.js.map +1 -1
- package/dist/components/AgentCard/AgentCardCreate.d.ts +4 -0
- package/dist/components/AgentCard/AgentCardCreate.d.ts.map +1 -0
- package/dist/components/AgentCard/AgentCardCreate.js +33 -0
- package/dist/components/AgentCard/AgentCardCreate.js.map +1 -0
- package/dist/components/AgentCard/dictionary.d.ts +23 -0
- package/dist/components/AgentCard/dictionary.d.ts.map +1 -0
- package/dist/components/AgentCard/dictionary.js +23 -0
- package/dist/components/AgentCard/dictionary.js.map +1 -0
- package/dist/components/AgentCard/index.d.ts +5 -0
- package/dist/components/AgentCard/index.d.ts.map +1 -0
- package/dist/components/AgentCard/index.js +55 -0
- package/dist/components/AgentCard/index.js.map +1 -0
- package/dist/components/AnimatedOpacity.d.ts +8 -0
- package/dist/components/AnimatedOpacity.d.ts.map +1 -0
- package/dist/components/AnimatedOpacity.js +46 -0
- package/dist/components/AnimatedOpacity.js.map +1 -0
- package/dist/components/AutoFocus.d.ts +23 -0
- package/dist/components/AutoFocus.d.ts.map +1 -0
- package/dist/components/AutoFocus.js +23 -0
- package/dist/components/AutoFocus.js.map +1 -0
- package/dist/components/ButtonFavorite.d.ts +40 -0
- package/dist/components/ButtonFavorite.d.ts.map +1 -0
- package/dist/components/ButtonFavorite.js +25 -0
- package/dist/components/ButtonFavorite.js.map +1 -0
- package/dist/components/Code.d.ts +2 -1
- package/dist/components/Code.d.ts.map +1 -1
- package/dist/components/Code.js +52 -24
- package/dist/components/Code.js.map +1 -1
- package/dist/components/ComponentNavigator.d.ts +38 -0
- package/dist/components/ComponentNavigator.d.ts.map +1 -0
- package/dist/components/ComponentNavigator.js +31 -0
- package/dist/components/ComponentNavigator.js.map +1 -0
- package/dist/components/Fading.d.ts +32 -0
- package/dist/components/Fading.d.ts.map +1 -0
- package/dist/components/Fading.js +33 -0
- package/dist/components/Fading.js.map +1 -0
- package/dist/components/FadingOverflow.d.ts +25 -0
- package/dist/components/FadingOverflow.d.ts.map +1 -1
- package/dist/components/FadingOverflow.js +16 -8
- package/dist/components/FadingOverflow.js.map +1 -1
- package/dist/components/FileDescription.d.ts +10 -0
- package/dist/components/FileDescription.d.ts.map +1 -0
- package/dist/components/FileDescription.js +84 -0
- package/dist/components/FileDescription.js.map +1 -0
- package/dist/components/HistoryList.d.ts +15 -0
- package/dist/components/HistoryList.d.ts.map +1 -1
- package/dist/components/HistoryList.js +6 -2
- package/dist/components/HistoryList.js.map +1 -1
- package/dist/components/ListResource.d.ts +29 -0
- package/dist/components/ListResource.d.ts.map +1 -0
- package/dist/components/ListResource.js +17 -0
- package/dist/components/ListResource.js.map +1 -0
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/Markdown.js +2 -2
- package/dist/components/Markdown.js.map +1 -1
- package/dist/components/Modal.d.ts +9 -0
- package/dist/components/Modal.d.ts.map +1 -0
- package/dist/components/Modal.js +56 -0
- package/dist/components/Modal.js.map +1 -0
- package/dist/components/QuickStartButton.d.ts +2 -4
- package/dist/components/QuickStartButton.d.ts.map +1 -1
- package/dist/components/QuickStartButton.js +7 -39
- package/dist/components/QuickStartButton.js.map +1 -1
- package/dist/components/RightPanelContentList.d.ts +10 -0
- package/dist/components/RightPanelContentList.d.ts.map +1 -0
- package/dist/components/RightPanelContentList.js +7 -0
- package/dist/components/RightPanelContentList.js.map +1 -0
- package/dist/components/RightPanelForm.d.ts +3 -0
- package/dist/components/RightPanelForm.d.ts.map +1 -1
- package/dist/components/RightPanelForm.js +57 -17
- package/dist/components/RightPanelForm.js.map +1 -1
- package/dist/components/RightPanelTabs.d.ts +4 -4
- package/dist/components/RightPanelTabs.d.ts.map +1 -1
- package/dist/components/RightPanelTabs.js +7 -16
- package/dist/components/RightPanelTabs.js.map +1 -1
- package/dist/components/Selector/index.d.ts +54 -0
- package/dist/components/Selector/index.d.ts.map +1 -0
- package/dist/components/Selector/index.js +143 -0
- package/dist/components/Selector/index.js.map +1 -0
- package/dist/components/Selector/styled.d.ts +4 -0
- package/dist/components/Selector/styled.d.ts.map +1 -0
- package/dist/components/Selector/styled.js +157 -0
- package/dist/components/Selector/styled.js.map +1 -0
- package/dist/components/StackedBadge.d.ts +14 -0
- package/dist/components/StackedBadge.d.ts.map +1 -0
- package/dist/components/StackedBadge.js +56 -0
- package/dist/components/StackedBadge.js.map +1 -0
- package/dist/components/TabManager.d.ts +6 -0
- package/dist/components/TabManager.d.ts.map +1 -1
- package/dist/components/TabManager.js +16 -28
- package/dist/components/TabManager.js.map +1 -1
- package/dist/components/ToolBadge.d.ts +9 -0
- package/dist/components/ToolBadge.d.ts.map +1 -0
- package/dist/components/ToolBadge.js +34 -0
- package/dist/components/ToolBadge.js.map +1 -0
- package/dist/components/WorkspaceTabNavigator.d.ts +17 -0
- package/dist/components/WorkspaceTabNavigator.d.ts.map +1 -0
- package/dist/components/WorkspaceTabNavigator.js +93 -0
- package/dist/components/WorkspaceTabNavigator.js.map +1 -0
- package/dist/components/form/DescribedCheckboxGroup.d.ts +30 -2
- package/dist/components/form/DescribedCheckboxGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedCheckboxGroup.js +75 -21
- package/dist/components/form/DescribedCheckboxGroup.js.map +1 -1
- package/dist/components/form/DescribedRadioGroup.d.ts +31 -2
- package/dist/components/form/DescribedRadioGroup.d.ts.map +1 -1
- package/dist/components/form/DescribedRadioGroup.js +65 -16
- package/dist/components/form/DescribedRadioGroup.js.map +1 -1
- package/dist/components/form/dictionary.d.ts +19 -0
- package/dist/components/form/dictionary.d.ts.map +1 -0
- package/dist/components/form/dictionary.js +19 -0
- package/dist/components/form/dictionary.js.map +1 -0
- package/dist/components/form/styled.d.ts.map +1 -1
- package/dist/components/form/styled.js +1 -2
- package/dist/components/form/styled.js.map +1 -1
- package/dist/components/form/types.d.ts +42 -0
- package/dist/components/form/types.d.ts.map +1 -1
- package/dist/context/AIWidgetProvider.d.ts +19 -0
- package/dist/context/AIWidgetProvider.d.ts.map +1 -1
- package/dist/context/AIWidgetProvider.js +19 -0
- package/dist/context/AIWidgetProvider.js.map +1 -1
- package/dist/context/hooks.d.ts +61 -4
- package/dist/context/hooks.d.ts.map +1 -1
- package/dist/context/hooks.js +83 -13
- package/dist/context/hooks.js.map +1 -1
- package/dist/features.d.ts +72 -10
- package/dist/features.d.ts.map +1 -1
- package/dist/features.js +23 -8
- package/dist/features.js.map +1 -1
- package/dist/hooks/midnight-update-view.d.ts +5 -0
- package/dist/hooks/midnight-update-view.d.ts.map +1 -0
- package/dist/hooks/midnight-update-view.js +30 -0
- package/dist/hooks/midnight-update-view.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/layout.css +95 -28
- package/dist/regex.d.ts +3 -0
- package/dist/regex.d.ts.map +1 -0
- package/dist/regex.js +3 -0
- package/dist/regex.js.map +1 -0
- package/dist/right-panel/DefaultPanel.d.ts +3 -0
- package/dist/right-panel/DefaultPanel.d.ts.map +1 -1
- package/dist/right-panel/DefaultPanel.js +5 -4
- package/dist/right-panel/DefaultPanel.js.map +1 -1
- package/dist/right-panel/RightPanel.d.ts +3 -0
- package/dist/right-panel/RightPanel.d.ts.map +1 -1
- package/dist/right-panel/RightPanel.js +3 -0
- package/dist/right-panel/RightPanel.js.map +1 -1
- package/dist/right-panel/RightPanelProvider.d.ts +15 -0
- package/dist/right-panel/RightPanelProvider.d.ts.map +1 -1
- package/dist/right-panel/RightPanelProvider.js.map +1 -1
- package/dist/right-panel/constants.d.ts +2 -0
- package/dist/right-panel/constants.d.ts.map +1 -0
- package/dist/right-panel/constants.js +2 -0
- package/dist/right-panel/constants.js.map +1 -0
- package/dist/right-panel/hooks.d.ts +6 -0
- package/dist/right-panel/hooks.d.ts.map +1 -1
- package/dist/right-panel/hooks.js +8 -1
- package/dist/right-panel/hooks.js.map +1 -1
- package/dist/state/ChatEntry.d.ts +182 -8
- package/dist/state/ChatEntry.d.ts.map +1 -1
- package/dist/state/ChatEntry.js +26 -3
- package/dist/state/ChatEntry.js.map +1 -1
- package/dist/state/ChatState.d.ts +116 -14
- package/dist/state/ChatState.d.ts.map +1 -1
- package/dist/state/ChatState.js +49 -8
- package/dist/state/ChatState.js.map +1 -1
- package/dist/state/ChatTabsController.d.ts +50 -1
- package/dist/state/ChatTabsController.d.ts.map +1 -1
- package/dist/state/ChatTabsController.js +77 -8
- package/dist/state/ChatTabsController.js.map +1 -1
- package/dist/state/ObservableState.d.ts +14 -0
- package/dist/state/ObservableState.d.ts.map +1 -1
- package/dist/state/ObservableState.js +14 -0
- package/dist/state/ObservableState.js.map +1 -1
- package/dist/state/WidgetState.d.ts +62 -2
- package/dist/state/WidgetState.d.ts.map +1 -1
- package/dist/state/WidgetState.js +49 -2
- package/dist/state/WidgetState.js.map +1 -1
- package/dist/state/constants.d.ts +5 -0
- package/dist/state/constants.d.ts.map +1 -0
- package/dist/state/constants.js +10 -0
- package/dist/state/constants.js.map +1 -0
- package/dist/state/types.d.ts +10 -1
- package/dist/state/types.d.ts.map +1 -1
- package/dist/types.d.ts +20 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/chat.d.ts +11 -4
- package/dist/utils/chat.d.ts.map +1 -1
- package/dist/utils/chat.js +13 -11
- package/dist/utils/chat.js.map +1 -1
- package/dist/utils/check-is-trial.d.ts +2 -0
- package/dist/utils/check-is-trial.d.ts.map +1 -0
- package/dist/utils/check-is-trial.js +6 -0
- package/dist/utils/check-is-trial.js.map +1 -0
- package/dist/utils/copy-to-clipboard.d.ts +6 -0
- package/dist/utils/copy-to-clipboard.d.ts.map +1 -0
- package/dist/utils/copy-to-clipboard.js +30 -0
- package/dist/utils/copy-to-clipboard.js.map +1 -0
- package/dist/utils/date.d.ts +26 -2
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/date.js +28 -3
- package/dist/utils/date.js.map +1 -1
- package/dist/utils/download.d.ts +5 -0
- package/dist/utils/download.d.ts.map +1 -1
- package/dist/utils/download.js +5 -0
- package/dist/utils/download.js.map +1 -1
- package/dist/utils/error.d.ts +2 -0
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/error.js +54 -0
- package/dist/utils/error.js.map +1 -0
- package/dist/utils/knowledge-source.d.ts +12 -2
- package/dist/utils/knowledge-source.d.ts.map +1 -1
- package/dist/utils/knowledge-source.js +16 -0
- package/dist/utils/knowledge-source.js.map +1 -1
- package/dist/utils/planning-tool.d.ts +17 -0
- package/dist/utils/planning-tool.d.ts.map +1 -0
- package/dist/utils/planning-tool.js +32 -0
- package/dist/utils/planning-tool.js.map +1 -0
- package/dist/utils/programming-languages.d.ts.map +1 -1
- package/dist/utils/programming-languages.js +10 -0
- package/dist/utils/programming-languages.js.map +1 -1
- package/dist/utils/string.d.ts +5 -0
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/string.js +5 -1
- package/dist/utils/string.js.map +1 -1
- package/dist/utils/tools.d.ts +23 -0
- package/dist/utils/tools.d.ts.map +1 -0
- package/dist/utils/tools.js +23 -0
- package/dist/utils/tools.js.map +1 -0
- package/dist/utils/update-tool-step.d.ts +3 -0
- package/dist/utils/update-tool-step.d.ts.map +1 -0
- package/dist/utils/update-tool-step.js +23 -0
- package/dist/utils/update-tool-step.js.map +1 -0
- package/dist/utils/upload/FileUpload.d.ts +21 -0
- package/dist/utils/upload/FileUpload.d.ts.map +1 -0
- package/dist/utils/upload/FileUpload.js +54 -0
- package/dist/utils/upload/FileUpload.js.map +1 -0
- package/dist/utils/upload/UploadManager.d.ts +42 -0
- package/dist/utils/upload/UploadManager.d.ts.map +1 -0
- package/dist/utils/upload/UploadManager.js +138 -0
- package/dist/utils/upload/UploadManager.js.map +1 -0
- package/dist/utils/upload/context.d.ts +15 -0
- package/dist/utils/upload/context.d.ts.map +1 -0
- package/dist/utils/upload/context.js +37 -0
- package/dist/utils/upload/context.js.map +1 -0
- package/dist/utils/upload/errors.d.ts +17 -0
- package/dist/utils/upload/errors.d.ts.map +1 -0
- package/dist/utils/upload/errors.js +27 -0
- package/dist/utils/upload/errors.js.map +1 -0
- package/dist/utils/upload/types.d.ts +7 -0
- package/dist/utils/upload/types.d.ts.map +1 -0
- package/dist/{components/Tooltip → utils/upload}/types.js.map +1 -1
- package/dist/utils/upload/use-paste-upload.d.ts +8 -0
- package/dist/utils/upload/use-paste-upload.d.ts.map +1 -0
- package/dist/utils/upload/use-paste-upload.js +19 -0
- package/dist/utils/upload/use-paste-upload.js.map +1 -0
- package/dist/utils/upload/utils.d.ts +4 -0
- package/dist/utils/upload/utils.d.ts.map +1 -0
- package/dist/utils/upload/utils.js +10 -0
- package/dist/utils/upload/utils.js.map +1 -0
- package/dist/utils/url.d.ts +2 -0
- package/dist/utils/url.d.ts.map +1 -0
- package/dist/utils/url.js +8 -0
- package/dist/utils/url.js.map +1 -0
- package/dist/views/Agents/AgentDescription.d.ts +4 -0
- package/dist/views/Agents/AgentDescription.d.ts.map +1 -0
- package/dist/views/Agents/AgentDescription.js +38 -0
- package/dist/views/Agents/AgentDescription.js.map +1 -0
- package/dist/views/Agents/AgentsPanel.d.ts +5 -0
- package/dist/views/Agents/AgentsPanel.d.ts.map +1 -0
- package/dist/views/Agents/AgentsPanel.js +45 -0
- package/dist/views/Agents/AgentsPanel.js.map +1 -0
- package/dist/views/Agents/AgentsTab.d.ts +11 -0
- package/dist/views/Agents/AgentsTab.d.ts.map +1 -0
- package/dist/views/Agents/AgentsTab.js +82 -0
- package/dist/views/Agents/AgentsTab.js.map +1 -0
- package/dist/views/Agents/dictionary.d.ts +2 -0
- package/dist/views/Agents/dictionary.d.ts.map +1 -0
- package/dist/views/Agents/dictionary.js +43 -0
- package/dist/views/Agents/dictionary.js.map +1 -0
- package/dist/views/Agents/index.d.ts +5 -0
- package/dist/views/Agents/index.d.ts.map +1 -0
- package/dist/views/Agents/index.js +21 -0
- package/dist/views/Agents/index.js.map +1 -0
- package/dist/views/Agents/styled.d.ts +3 -0
- package/dist/views/Agents/styled.d.ts.map +1 -0
- package/dist/views/Agents/styled.js +68 -0
- package/dist/views/Agents/styled.js.map +1 -0
- package/dist/views/Agents/useAgentFavorites.d.ts +8 -0
- package/dist/views/Agents/useAgentFavorites.d.ts.map +1 -0
- package/dist/views/Agents/useAgentFavorites.js +59 -0
- package/dist/views/Agents/useAgentFavorites.js.map +1 -0
- package/dist/views/Chat/AgentInfo.d.ts +5 -1
- package/dist/views/Chat/AgentInfo.d.ts.map +1 -1
- package/dist/views/Chat/AgentInfo.js +6 -5
- package/dist/views/Chat/AgentInfo.js.map +1 -1
- package/dist/views/Chat/ButtonExecutionDetail.d.ts +5 -0
- package/dist/views/Chat/ButtonExecutionDetail.d.ts.map +1 -0
- package/dist/views/Chat/ButtonExecutionDetail.js +34 -0
- package/dist/views/Chat/ButtonExecutionDetail.js.map +1 -0
- package/dist/views/Chat/ChatMessage.d.ts +56 -4
- package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.js +160 -24
- package/dist/views/Chat/ChatMessage.js.map +1 -1
- package/dist/views/Chat/ChatMessages.d.ts +6 -2
- package/dist/views/Chat/ChatMessages.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessages.js +5 -2
- package/dist/views/Chat/ChatMessages.js.map +1 -1
- package/dist/views/Chat/StepsList.d.ts +14 -0
- package/dist/views/Chat/StepsList.d.ts.map +1 -0
- package/dist/views/Chat/StepsList.js +192 -0
- package/dist/views/Chat/StepsList.js.map +1 -0
- package/dist/views/Chat/chat-scroll.d.ts +1 -1
- package/dist/views/Chat/chat-scroll.js +1 -1
- package/dist/views/Chat/events.d.ts +22 -0
- package/dist/views/Chat/events.d.ts.map +1 -0
- package/dist/views/Chat/events.js +67 -0
- package/dist/views/Chat/events.js.map +1 -0
- package/dist/views/Chat/index.d.ts +9 -2
- package/dist/views/Chat/index.d.ts.map +1 -1
- package/dist/views/Chat/index.js +5 -2
- package/dist/views/Chat/index.js.map +1 -1
- package/dist/views/Chat/styled.d.ts +3 -1
- package/dist/views/Chat/styled.d.ts.map +1 -1
- package/dist/views/Chat/styled.js +152 -31
- package/dist/views/Chat/styled.js.map +1 -1
- package/dist/views/ChatHistory/ChatHistoryPanel.d.ts +4 -4
- package/dist/views/ChatHistory/ChatHistoryPanel.d.ts.map +1 -1
- package/dist/views/ChatHistory/ChatHistoryPanel.js +6 -2
- package/dist/views/ChatHistory/ChatHistoryPanel.js.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.d.ts +4 -3
- package/dist/views/ChatHistory/HistoryItem.d.ts.map +1 -1
- package/dist/views/ChatHistory/HistoryItem.js +16 -37
- package/dist/views/ChatHistory/HistoryItem.js.map +1 -1
- package/dist/views/ChatHistory/dictionary.d.ts +1 -1
- package/dist/views/ChatHistory/index.d.ts +4 -4
- package/dist/views/ChatHistory/index.d.ts.map +1 -1
- package/dist/views/ChatHistory/index.js +6 -3
- package/dist/views/ChatHistory/index.js.map +1 -1
- package/dist/views/ChatHistory/styled.d.ts.map +1 -1
- package/dist/views/ChatHistory/styled.js +3 -5
- package/dist/views/ChatHistory/styled.js.map +1 -1
- package/dist/views/ChatHistory/utils.d.ts +17 -2
- package/dist/views/ChatHistory/utils.d.ts.map +1 -1
- package/dist/views/ChatHistory/utils.js +140 -9
- package/dist/views/ChatHistory/utils.js.map +1 -1
- package/dist/views/ChatTabSelection.d.ts +6 -4
- package/dist/views/ChatTabSelection.d.ts.map +1 -1
- package/dist/views/ChatTabSelection.js +40 -15
- package/dist/views/ChatTabSelection.js.map +1 -1
- package/dist/views/Editor.d.ts +3 -0
- package/dist/views/Editor.d.ts.map +1 -1
- package/dist/views/Editor.js +23 -16
- package/dist/views/Editor.js.map +1 -1
- package/dist/views/Home/BuiltInAgent.d.ts +6 -0
- package/dist/views/Home/BuiltInAgent.d.ts.map +1 -0
- package/dist/views/Home/BuiltInAgent.js +37 -0
- package/dist/views/Home/BuiltInAgent.js.map +1 -0
- package/dist/views/Home/CustomAgent.d.ts +5 -0
- package/dist/views/Home/CustomAgent.d.ts.map +1 -0
- package/dist/views/Home/CustomAgent.js +23 -0
- package/dist/views/Home/CustomAgent.js.map +1 -0
- package/dist/views/Home/index.d.ts +8 -0
- package/dist/views/Home/index.d.ts.map +1 -0
- package/dist/views/Home/index.js +34 -0
- package/dist/views/Home/index.js.map +1 -0
- package/dist/views/Home/styled.d.ts +2 -0
- package/dist/views/Home/styled.d.ts.map +1 -0
- package/dist/views/Home/styled.js +74 -0
- package/dist/views/Home/styled.js.map +1 -0
- package/dist/views/Home/types.d.ts +16 -0
- package/dist/views/Home/types.d.ts.map +1 -0
- package/dist/views/Home/types.js +2 -0
- package/dist/views/Home/types.js.map +1 -0
- package/dist/views/KSDocument.d.ts +3 -0
- package/dist/views/KSDocument.d.ts.map +1 -1
- package/dist/views/KSDocument.js +7 -4
- package/dist/views/KSDocument.js.map +1 -1
- package/dist/views/KnowledgeSources.d.ts +12 -0
- package/dist/views/KnowledgeSources.d.ts.map +1 -1
- package/dist/views/KnowledgeSources.js +123 -33
- package/dist/views/KnowledgeSources.js.map +1 -1
- package/dist/views/MessageInput/AgentSelector.d.ts +5 -0
- package/dist/views/MessageInput/AgentSelector.d.ts.map +1 -0
- package/dist/views/MessageInput/AgentSelector.js +66 -0
- package/dist/views/MessageInput/AgentSelector.js.map +1 -0
- package/dist/views/MessageInput/ButtonAgent.d.ts +2 -0
- package/dist/views/MessageInput/ButtonAgent.d.ts.map +1 -0
- package/dist/views/MessageInput/ButtonAgent.js +35 -0
- package/dist/views/MessageInput/ButtonAgent.js.map +1 -0
- package/dist/views/MessageInput/ButtonBar.d.ts +13 -0
- package/dist/views/MessageInput/ButtonBar.d.ts.map +1 -0
- package/dist/views/MessageInput/ButtonBar.js +15 -0
- package/dist/views/MessageInput/ButtonBar.js.map +1 -0
- package/dist/views/MessageInput/ContextBar.d.ts +9 -0
- package/dist/views/MessageInput/ContextBar.d.ts.map +1 -0
- package/dist/views/MessageInput/ContextBar.js +51 -0
- package/dist/views/MessageInput/ContextBar.js.map +1 -0
- package/dist/views/MessageInput/ModelSwitcher/index.d.ts +2 -0
- package/dist/views/MessageInput/ModelSwitcher/index.d.ts.map +1 -0
- package/dist/views/MessageInput/ModelSwitcher/index.js +25 -0
- package/dist/views/MessageInput/ModelSwitcher/index.js.map +1 -0
- package/dist/views/MessageInput/ModelSwitcher/utils.d.ts +30 -0
- package/dist/views/MessageInput/ModelSwitcher/utils.d.ts.map +1 -0
- package/dist/views/MessageInput/ModelSwitcher/utils.js +91 -0
- package/dist/views/MessageInput/ModelSwitcher/utils.js.map +1 -0
- package/dist/views/MessageInput/QuickCommandSelector.d.ts +5 -0
- package/dist/views/MessageInput/QuickCommandSelector.d.ts.map +1 -0
- package/dist/views/MessageInput/QuickCommandSelector.js +104 -0
- package/dist/views/MessageInput/QuickCommandSelector.js.map +1 -0
- package/dist/views/MessageInput/SelectContent.d.ts +2 -0
- package/dist/views/MessageInput/SelectContent.d.ts.map +1 -0
- package/dist/views/MessageInput/SelectContent.js +84 -0
- package/dist/views/MessageInput/SelectContent.js.map +1 -0
- package/dist/views/MessageInput/UploadBar.d.ts +2 -0
- package/dist/views/MessageInput/UploadBar.d.ts.map +1 -0
- package/dist/views/MessageInput/UploadBar.js +74 -0
- package/dist/views/MessageInput/UploadBar.js.map +1 -0
- package/dist/views/MessageInput/UploadDragNDrop.d.ts +14 -0
- package/dist/views/MessageInput/UploadDragNDrop.d.ts.map +1 -0
- package/dist/views/MessageInput/UploadDragNDrop.js +51 -0
- package/dist/views/MessageInput/UploadDragNDrop.js.map +1 -0
- package/dist/views/MessageInput/chat-entry-history.d.ts +11 -0
- package/dist/views/MessageInput/chat-entry-history.d.ts.map +1 -0
- package/dist/views/MessageInput/chat-entry-history.js +78 -0
- package/dist/views/MessageInput/chat-entry-history.js.map +1 -0
- package/dist/views/MessageInput/dictionary.d.ts +1 -1
- package/dist/views/MessageInput/dictionary.d.ts.map +1 -1
- package/dist/views/MessageInput/dictionary.js +52 -10
- package/dist/views/MessageInput/dictionary.js.map +1 -1
- package/dist/views/MessageInput/index.d.ts +9 -6
- package/dist/views/MessageInput/index.d.ts.map +1 -1
- package/dist/views/MessageInput/index.js +112 -20
- package/dist/views/MessageInput/index.js.map +1 -1
- package/dist/views/MessageInput/styled.d.ts +13 -1
- package/dist/views/MessageInput/styled.d.ts.map +1 -1
- package/dist/views/MessageInput/styled.js +223 -85
- package/dist/views/MessageInput/styled.js.map +1 -1
- package/dist/views/MinimizedHeader.d.ts +4 -0
- package/dist/views/MinimizedHeader.d.ts.map +1 -1
- package/dist/views/MinimizedHeader.js +9 -7
- package/dist/views/MinimizedHeader.js.map +1 -1
- package/dist/views/Resources.d.ts +2 -0
- package/dist/views/Resources.d.ts.map +1 -0
- package/dist/views/Resources.js +69 -0
- package/dist/views/Resources.js.map +1 -0
- package/dist/views/Stacks.d.ts +12 -0
- package/dist/views/Stacks.d.ts.map +1 -1
- package/dist/views/Stacks.js +117 -21
- package/dist/views/Stacks.js.map +1 -1
- package/dist/views/Steps/FlowChart/HandleGroup.d.ts +10 -0
- package/dist/views/Steps/FlowChart/HandleGroup.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/HandleGroup.js +4 -0
- package/dist/views/Steps/FlowChart/HandleGroup.js.map +1 -0
- package/dist/views/Steps/FlowChart/NodeDynamic.d.ts +15 -0
- package/dist/views/Steps/FlowChart/NodeDynamic.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/NodeDynamic.js +41 -0
- package/dist/views/Steps/FlowChart/NodeDynamic.js.map +1 -0
- package/dist/views/Steps/FlowChart/NodeStep.d.ts +10 -0
- package/dist/views/Steps/FlowChart/NodeStep.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/NodeStep.js +13 -0
- package/dist/views/Steps/FlowChart/NodeStep.js.map +1 -0
- package/dist/views/Steps/FlowChart/hooks.d.ts +7 -0
- package/dist/views/Steps/FlowChart/hooks.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/hooks.js +31 -0
- package/dist/views/Steps/FlowChart/hooks.js.map +1 -0
- package/dist/views/Steps/FlowChart/index.d.ts +12 -0
- package/dist/views/Steps/FlowChart/index.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/index.js +78 -0
- package/dist/views/Steps/FlowChart/index.js.map +1 -0
- package/dist/views/Steps/FlowChart/layout.d.ts +8 -0
- package/dist/views/Steps/FlowChart/layout.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/layout.js +59 -0
- package/dist/views/Steps/FlowChart/layout.js.map +1 -0
- package/dist/views/Steps/FlowChart/styled.d.ts +14 -0
- package/dist/views/Steps/FlowChart/styled.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/styled.js +156 -0
- package/dist/views/Steps/FlowChart/styled.js.map +1 -0
- package/dist/views/Steps/FlowChart/types.d.ts +25 -0
- package/dist/views/Steps/FlowChart/types.d.ts.map +1 -0
- package/dist/views/Steps/FlowChart/types.js +2 -0
- package/dist/views/Steps/FlowChart/types.js.map +1 -0
- package/dist/views/Steps/StepModal.d.ts +10 -0
- package/dist/views/Steps/StepModal.d.ts.map +1 -0
- package/dist/views/Steps/StepModal.js +139 -0
- package/dist/views/Steps/StepModal.js.map +1 -0
- package/dist/views/Steps/StepsPanel.d.ts +6 -0
- package/dist/views/Steps/StepsPanel.d.ts.map +1 -0
- package/dist/views/Steps/StepsPanel.js +18 -0
- package/dist/views/Steps/StepsPanel.js.map +1 -0
- package/dist/views/Steps/dictionary.d.ts +43 -0
- package/dist/views/Steps/dictionary.d.ts.map +1 -0
- package/dist/views/Steps/dictionary.js +45 -0
- package/dist/views/Steps/dictionary.js.map +1 -0
- package/dist/views/Steps/index.d.ts +5 -0
- package/dist/views/Steps/index.d.ts.map +1 -0
- package/dist/views/Steps/index.js +30 -0
- package/dist/views/Steps/index.js.map +1 -0
- package/dist/views/Steps/utils.d.ts +7 -0
- package/dist/views/Steps/utils.d.ts.map +1 -0
- package/dist/views/Steps/utils.js +32 -0
- package/dist/views/Steps/utils.js.map +1 -0
- package/dist/views/Tools.d.ts +2 -0
- package/dist/views/Tools.d.ts.map +1 -0
- package/dist/views/Tools.js +53 -0
- package/dist/views/Tools.js.map +1 -0
- package/dist/views/Workspaces/WorkspacesTab.d.ts +20 -0
- package/dist/views/Workspaces/WorkspacesTab.d.ts.map +1 -0
- package/dist/views/Workspaces/WorkspacesTab.js +61 -0
- package/dist/views/Workspaces/WorkspacesTab.js.map +1 -0
- package/dist/views/Workspaces/index.d.ts +5 -0
- package/dist/views/Workspaces/index.d.ts.map +1 -0
- package/dist/views/Workspaces/index.js +69 -0
- package/dist/views/Workspaces/index.js.map +1 -0
- package/package.dev.json +3 -0
- package/package.json +21 -13
- package/package.stg.json +4 -0
- package/src/StackspotAIWidget.tsx +96 -37
- package/src/app-metadata.json +175 -0
- package/src/assets/placeholder.png +0 -0
- package/src/chat-interceptors/CustomInputs.ts +14 -1
- package/src/chat-interceptors/quick-command-questions.ts +12 -2
- package/src/chat-interceptors/quick-commands.ts +286 -52
- package/src/chat-interceptors/send-message.ts +253 -25
- package/src/components/AdaptiveTextArea.tsx +36 -11
- package/src/components/AgentCard/AgentCardCreate.tsx +42 -0
- package/src/components/AgentCard/dictionary.ts +25 -0
- package/src/components/AgentCard/index.tsx +82 -0
- package/src/components/AnimatedOpacity.tsx +55 -0
- package/src/components/AutoFocus.tsx +42 -0
- package/src/components/ButtonFavorite.tsx +78 -0
- package/src/components/Code.tsx +94 -59
- package/src/components/ComponentNavigator.tsx +99 -0
- package/src/components/Fading.tsx +66 -0
- package/src/components/FadingOverflow.tsx +39 -12
- package/src/components/FileDescription.tsx +118 -0
- package/src/components/HistoryList.tsx +19 -2
- package/src/components/ListResource.tsx +60 -0
- package/src/components/Markdown.tsx +2 -1
- package/src/components/Modal.tsx +85 -0
- package/src/components/QuickStartButton.tsx +15 -47
- package/src/components/RightPanelContentList.tsx +15 -0
- package/src/components/RightPanelForm.tsx +64 -22
- package/src/components/RightPanelTabs.tsx +7 -32
- package/src/components/Selector/index.tsx +312 -0
- package/src/components/Selector/styled.ts +158 -0
- package/src/components/StackedBadge.tsx +77 -0
- package/src/components/TabManager.tsx +36 -36
- package/src/components/ToolBadge.tsx +67 -0
- package/src/components/WorkspaceTabNavigator.tsx +172 -0
- package/src/components/form/DescribedCheckboxGroup.tsx +135 -33
- package/src/components/form/DescribedRadioGroup.tsx +136 -32
- package/src/components/form/dictionary.ts +18 -0
- package/src/components/form/styled.ts +1 -2
- package/src/components/form/types.ts +45 -1
- package/src/context/AIWidgetProvider.tsx +19 -0
- package/src/context/hooks.ts +86 -16
- package/src/features.ts +90 -16
- package/src/hooks/midnight-update-view.ts +36 -0
- package/src/images.d.ts +5 -0
- package/src/index.ts +16 -0
- package/src/layout.css +95 -28
- package/src/regex.ts +2 -0
- package/src/right-panel/DefaultPanel.tsx +7 -7
- package/src/right-panel/RightPanel.tsx +3 -0
- package/src/right-panel/RightPanelProvider.tsx +15 -0
- package/src/right-panel/constants.ts +1 -0
- package/src/right-panel/hooks.tsx +8 -1
- package/src/state/ChatEntry.ts +189 -9
- package/src/state/ChatState.ts +131 -14
- package/src/state/ChatTabsController.ts +78 -8
- package/src/state/ObservableState.ts +14 -0
- package/src/state/WidgetState.ts +86 -3
- package/src/state/constants.ts +13 -0
- package/src/state/types.ts +12 -1
- package/src/types.ts +21 -4
- package/src/utils/chat.ts +15 -14
- package/src/utils/check-is-trial.ts +6 -0
- package/src/utils/copy-to-clipboard.ts +29 -0
- package/src/utils/date.ts +28 -4
- package/src/utils/download.ts +5 -0
- package/src/utils/error.ts +56 -0
- package/src/utils/knowledge-source.ts +18 -2
- package/src/utils/planning-tool.ts +41 -0
- package/src/utils/programming-languages.ts +10 -0
- package/src/utils/string.ts +5 -1
- package/src/utils/tools.ts +32 -0
- package/src/utils/update-tool-step.tsx +27 -0
- package/src/utils/upload/FileUpload.ts +63 -0
- package/src/utils/upload/UploadManager.ts +156 -0
- package/src/utils/upload/context.tsx +44 -0
- package/src/utils/upload/errors.ts +34 -0
- package/src/utils/upload/types.ts +7 -0
- package/src/utils/upload/use-paste-upload.tsx +30 -0
- package/src/utils/upload/utils.ts +12 -0
- package/src/utils/url.ts +8 -0
- package/src/views/Agents/AgentDescription.tsx +107 -0
- package/src/views/Agents/AgentsPanel.tsx +57 -0
- package/src/views/Agents/AgentsTab.tsx +126 -0
- package/src/views/Agents/dictionary.ts +45 -0
- package/src/views/Agents/index.tsx +26 -0
- package/src/views/Agents/styled.ts +69 -0
- package/src/views/Agents/useAgentFavorites.ts +63 -0
- package/src/views/Chat/AgentInfo.tsx +13 -8
- package/src/views/Chat/ButtonExecutionDetail.tsx +46 -0
- package/src/views/Chat/ChatMessage.tsx +465 -79
- package/src/views/Chat/ChatMessages.tsx +15 -4
- package/src/views/Chat/StepsList.tsx +394 -0
- package/src/views/Chat/chat-scroll.ts +1 -1
- package/src/views/Chat/events.ts +71 -0
- package/src/views/Chat/index.tsx +17 -3
- package/src/views/Chat/styled.ts +158 -32
- package/src/views/ChatHistory/ChatHistoryPanel.tsx +8 -5
- package/src/views/ChatHistory/HistoryItem.tsx +23 -44
- package/src/views/ChatHistory/index.tsx +6 -4
- package/src/views/ChatHistory/styled.ts +3 -5
- package/src/views/ChatHistory/utils.ts +144 -11
- package/src/views/ChatTabSelection.tsx +47 -20
- package/src/views/Editor.tsx +28 -18
- package/src/views/Home/BuiltInAgent.tsx +67 -0
- package/src/views/Home/CustomAgent.tsx +36 -0
- package/src/views/Home/index.tsx +48 -0
- package/src/views/Home/styled.ts +74 -0
- package/src/views/Home/types.ts +16 -0
- package/src/views/KSDocument.tsx +11 -8
- package/src/views/KnowledgeSources.tsx +169 -62
- package/src/views/MessageInput/AgentSelector.tsx +92 -0
- package/src/views/MessageInput/ButtonAgent.tsx +73 -0
- package/src/views/MessageInput/ButtonBar.tsx +57 -0
- package/src/views/MessageInput/ContextBar.tsx +117 -0
- package/src/views/MessageInput/ModelSwitcher/index.tsx +69 -0
- package/src/views/MessageInput/ModelSwitcher/utils.tsx +143 -0
- package/src/views/MessageInput/QuickCommandSelector.tsx +137 -0
- package/src/views/MessageInput/SelectContent.tsx +99 -0
- package/src/views/MessageInput/UploadBar.tsx +107 -0
- package/src/views/MessageInput/UploadDragNDrop.tsx +79 -0
- package/src/views/MessageInput/chat-entry-history.ts +97 -0
- package/src/views/MessageInput/dictionary.ts +52 -10
- package/src/views/MessageInput/index.tsx +154 -51
- package/src/views/MessageInput/styled.ts +226 -85
- package/src/views/MinimizedHeader.tsx +11 -10
- package/src/views/Resources.tsx +108 -0
- package/src/views/Stacks.tsx +152 -39
- package/src/views/Steps/FlowChart/HandleGroup.tsx +14 -0
- package/src/views/Steps/FlowChart/NodeDynamic.tsx +97 -0
- package/src/views/Steps/FlowChart/NodeStep.tsx +49 -0
- package/src/views/Steps/FlowChart/hooks.ts +41 -0
- package/src/views/Steps/FlowChart/index.tsx +111 -0
- package/src/views/Steps/FlowChart/layout.ts +73 -0
- package/src/views/Steps/FlowChart/styled.ts +157 -0
- package/src/views/Steps/FlowChart/types.ts +28 -0
- package/src/views/Steps/StepModal.tsx +233 -0
- package/src/views/Steps/StepsPanel.tsx +31 -0
- package/src/views/Steps/dictionary.ts +48 -0
- package/src/views/Steps/index.tsx +36 -0
- package/src/views/Steps/utils.tsx +34 -0
- package/src/views/Tools.tsx +77 -0
- package/src/views/Workspaces/WorkspacesTab.tsx +116 -0
- package/src/views/Workspaces/index.tsx +78 -0
- package/tsconfig.json +8 -3
- package/dist/components/Accordion.d.ts +0 -10
- package/dist/components/Accordion.d.ts.map +0 -1
- package/dist/components/Accordion.js +0 -46
- package/dist/components/Accordion.js.map +0 -1
- package/dist/components/FallbackBoundary/ErrorBoundary.d.ts +0 -30
- package/dist/components/FallbackBoundary/ErrorBoundary.d.ts.map +0 -1
- package/dist/components/FallbackBoundary/ErrorBoundary.js +0 -38
- package/dist/components/FallbackBoundary/ErrorBoundary.js.map +0 -1
- package/dist/components/FallbackBoundary/Loading.d.ts +0 -2
- package/dist/components/FallbackBoundary/Loading.d.ts.map +0 -1
- package/dist/components/FallbackBoundary/Loading.js +0 -12
- package/dist/components/FallbackBoundary/Loading.js.map +0 -1
- package/dist/components/FallbackBoundary/index.d.ts +0 -6
- package/dist/components/FallbackBoundary/index.d.ts.map +0 -1
- package/dist/components/FallbackBoundary/index.js +0 -9
- package/dist/components/FallbackBoundary/index.js.map +0 -1
- package/dist/components/IconInput.d.ts +0 -7
- package/dist/components/IconInput.d.ts.map +0 -1
- package/dist/components/IconInput.js +0 -58
- package/dist/components/IconInput.js.map +0 -1
- package/dist/components/OverlayMenu.d.ts +0 -10
- package/dist/components/OverlayMenu.d.ts.map +0 -1
- package/dist/components/OverlayMenu.js +0 -58
- package/dist/components/OverlayMenu.js.map +0 -1
- package/dist/components/ProgressBar.d.ts +0 -11
- package/dist/components/ProgressBar.d.ts.map +0 -1
- package/dist/components/ProgressBar.js +0 -126
- package/dist/components/ProgressBar.js.map +0 -1
- package/dist/components/Tooltip/Tooltip.d.ts +0 -12
- package/dist/components/Tooltip/Tooltip.d.ts.map +0 -1
- package/dist/components/Tooltip/Tooltip.js +0 -17
- package/dist/components/Tooltip/Tooltip.js.map +0 -1
- package/dist/components/Tooltip/TooltipAPI.d.ts +0 -13
- package/dist/components/Tooltip/TooltipAPI.d.ts.map +0 -1
- package/dist/components/Tooltip/TooltipAPI.js +0 -90
- package/dist/components/Tooltip/TooltipAPI.js.map +0 -1
- package/dist/components/Tooltip/context.d.ts +0 -5
- package/dist/components/Tooltip/context.d.ts.map +0 -1
- package/dist/components/Tooltip/context.js +0 -18
- package/dist/components/Tooltip/context.js.map +0 -1
- package/dist/components/Tooltip/index.d.ts +0 -3
- package/dist/components/Tooltip/index.d.ts.map +0 -1
- package/dist/components/Tooltip/index.js +0 -3
- package/dist/components/Tooltip/index.js.map +0 -1
- package/dist/components/Tooltip/style.d.ts +0 -4
- package/dist/components/Tooltip/style.d.ts.map +0 -1
- package/dist/components/Tooltip/style.js +0 -22
- package/dist/components/Tooltip/style.js.map +0 -1
- package/dist/components/Tooltip/types.d.ts +0 -14
- package/dist/components/Tooltip/types.d.ts.map +0 -1
- package/dist/views/Agents.d.ts +0 -2
- package/dist/views/Agents.d.ts.map +0 -1
- package/dist/views/Agents.js +0 -143
- package/dist/views/Agents.js.map +0 -1
- package/dist/views/Home.d.ts +0 -6
- package/dist/views/Home.d.ts.map +0 -1
- package/dist/views/Home.js +0 -68
- package/dist/views/Home.js.map +0 -1
- package/dist/views/MessageInput/ButtonGroup.d.ts +0 -12
- package/dist/views/MessageInput/ButtonGroup.d.ts.map +0 -1
- package/dist/views/MessageInput/ButtonGroup.js +0 -24
- package/dist/views/MessageInput/ButtonGroup.js.map +0 -1
- package/dist/views/MessageInput/InfoBar.d.ts +0 -2
- package/dist/views/MessageInput/InfoBar.d.ts.map +0 -1
- package/dist/views/MessageInput/InfoBar.js +0 -35
- package/dist/views/MessageInput/InfoBar.js.map +0 -1
- package/dist/views/Workspaces.d.ts +0 -2
- package/dist/views/Workspaces.d.ts.map +0 -1
- package/dist/views/Workspaces.js +0 -62
- package/dist/views/Workspaces.js.map +0 -1
- package/src/components/Accordion.tsx +0 -64
- package/src/components/FallbackBoundary/ErrorBoundary.tsx +0 -48
- package/src/components/FallbackBoundary/Loading.tsx +0 -14
- package/src/components/FallbackBoundary/index.tsx +0 -15
- package/src/components/IconInput.tsx +0 -70
- package/src/components/OverlayMenu.tsx +0 -77
- package/src/components/ProgressBar.tsx +0 -153
- package/src/components/Tooltip/Tooltip.tsx +0 -36
- package/src/components/Tooltip/TooltipAPI.ts +0 -84
- package/src/components/Tooltip/context.tsx +0 -24
- package/src/components/Tooltip/index.ts +0 -2
- package/src/components/Tooltip/style.tsx +0 -24
- package/src/components/Tooltip/types.ts +0 -15
- package/src/views/Agents.tsx +0 -200
- package/src/views/Home.tsx +0 -109
- package/src/views/MessageInput/ButtonGroup.tsx +0 -91
- package/src/views/MessageInput/InfoBar.tsx +0 -82
- package/src/views/Workspaces.tsx +0 -92
- /package/dist/{components/Tooltip → utils/upload}/types.js +0 -0
package/src/state/WidgetState.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import { loader } from '@monaco-editor/react'
|
|
2
|
+
import { ulid } from 'ulid'
|
|
3
|
+
import { quickCommandQuestionsInterceptor } from '../chat-interceptors/quick-command-questions'
|
|
4
|
+
import { createQuickCommandInterceptor } from '../chat-interceptors/quick-commands'
|
|
5
|
+
import { sendMessageInterceptor } from '../chat-interceptors/send-message'
|
|
6
|
+
import { AIWidgetFeatures, ChatFeatures, getFeaturesWithDefaults, GlobalFeatures } from '../features'
|
|
7
|
+
import { ChatEntry } from './ChatEntry'
|
|
8
|
+
import { ChatPropertiesWithOptionalFeatures, ChatState, MessageInterceptor } from './ChatState'
|
|
1
9
|
import { ChatTabsController } from './ChatTabsController'
|
|
2
10
|
import { ObservableState } from './ObservableState'
|
|
3
11
|
|
|
@@ -5,22 +13,97 @@ export interface WidgetProperties {
|
|
|
5
13
|
/**
|
|
6
14
|
* Current content of the right panel. Undefined for closed right panel.
|
|
7
15
|
*/
|
|
8
|
-
panel?: 'stack' | 'workspace' | 'agent' | 'ks' | 'editor' | 'history' | 'ks-details',
|
|
16
|
+
panel?: 'stack' | 'workspace' | 'agent' | 'ks' | 'editor' | 'history' | 'ks-details' | 'steps' | 'tools' | 'resources',
|
|
9
17
|
/**
|
|
10
18
|
* KS to use when the right panel "ks-details" is open.
|
|
11
19
|
*/
|
|
12
20
|
currentKSInPanel?: { name: string, slug: string, score: number, documentId: string },
|
|
21
|
+
/**
|
|
22
|
+
* The message to show in the tools panel or the steps panel.
|
|
23
|
+
*/
|
|
24
|
+
currentMessageInPanel?: { chatId: string, messageId: number },
|
|
13
25
|
/**
|
|
14
26
|
* Whether or not the widget is in its minimized version.
|
|
15
27
|
*/
|
|
16
28
|
isMinimized?: boolean,
|
|
29
|
+
/**
|
|
30
|
+
* Global features of the chat widget. These features don't depend on the chat currently selected.
|
|
31
|
+
*/
|
|
32
|
+
features: GlobalFeatures,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface Options {
|
|
36
|
+
/**
|
|
37
|
+
* Chat interceptors allows you to intercept chat messages, interpret them, modify them and even change the chat flow. See
|
|
38
|
+
* {@link ChatState} for more details.
|
|
39
|
+
*
|
|
40
|
+
* These interceptors, in addition to the default interceptors, will be used when creating a new chat via `WidgetState#createChat`.
|
|
41
|
+
*/
|
|
42
|
+
interceptors?: MessageInterceptor[],
|
|
43
|
+
/**
|
|
44
|
+
* Features to enable in the widget. If a feature is not set explicitly to false, it's interpreted as enabled.
|
|
45
|
+
*
|
|
46
|
+
* These features will be used when creating a new chat via `WidgetState#createChat`. Updating chat features only influence new chats.
|
|
47
|
+
*/
|
|
48
|
+
features?: Partial<AIWidgetFeatures>,
|
|
49
|
+
/**
|
|
50
|
+
* The initial values for the widget state.
|
|
51
|
+
*
|
|
52
|
+
* The default value for each feature under `initial.features` is true.
|
|
53
|
+
*/
|
|
54
|
+
initial?: Omit<WidgetProperties, 'features'>,
|
|
55
|
+
/**
|
|
56
|
+
* The initial tabs for the chat window.
|
|
57
|
+
*/
|
|
58
|
+
chatTabs?: ChatTabsController,
|
|
17
59
|
}
|
|
18
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Holds the full state of the AI Chat Widget.
|
|
63
|
+
*
|
|
64
|
+
* This can be used to fully control the chat widget. This is the model of what gets rendered to the screen.
|
|
65
|
+
*/
|
|
19
66
|
export class WidgetState extends ObservableState<WidgetProperties> {
|
|
20
67
|
readonly chatTabs: ChatTabsController
|
|
68
|
+
/**
|
|
69
|
+
* Chat interceptors to be used by default when creating a new chat.
|
|
70
|
+
*/
|
|
71
|
+
interceptors: MessageInterceptor[] = []
|
|
72
|
+
/**
|
|
73
|
+
* Chat features to be used by default when creating a new chat.
|
|
74
|
+
*/
|
|
75
|
+
chatFeatures: ChatFeatures
|
|
21
76
|
|
|
22
|
-
constructor(initial:
|
|
23
|
-
|
|
77
|
+
constructor({ chatTabs, initial, interceptors = [], features }: Options = {}) {
|
|
78
|
+
const featuresWithDefaults = getFeaturesWithDefaults(features)
|
|
79
|
+
super({ ...initial, features: featuresWithDefaults })
|
|
80
|
+
this.chatFeatures = featuresWithDefaults
|
|
24
81
|
this.chatTabs = chatTabs ?? new ChatTabsController()
|
|
82
|
+
this.interceptors = [
|
|
83
|
+
...interceptors,
|
|
84
|
+
quickCommandQuestionsInterceptor,
|
|
85
|
+
createQuickCommandInterceptor(this, () => loader.__getMonacoInstance()?.editor),
|
|
86
|
+
sendMessageInterceptor,
|
|
87
|
+
],
|
|
88
|
+
this.createChat()
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Utility function for adding a new chat to the chat tabs. This also selects the new tab.
|
|
93
|
+
* @param properties the chat properties (initial state).
|
|
94
|
+
* @param entries the entries for the chat to start with.
|
|
95
|
+
* @returns the chat created.
|
|
96
|
+
*/
|
|
97
|
+
createChat({ label, ...properties }: Partial<ChatPropertiesWithOptionalFeatures> = {}, entries: ChatEntry[] = []) {
|
|
98
|
+
const chat = new ChatState({
|
|
99
|
+
id: ulid(),
|
|
100
|
+
initial: { label: label || 'Chat', features: this.chatFeatures, ...properties },
|
|
101
|
+
entries,
|
|
102
|
+
interceptors: this.interceptors,
|
|
103
|
+
untitled: !label,
|
|
104
|
+
})
|
|
105
|
+
this.chatTabs.add(chat)
|
|
106
|
+
this.chatTabs.select(chat.id)
|
|
107
|
+
return chat
|
|
25
108
|
}
|
|
26
109
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FileSize } from './types'
|
|
2
|
+
|
|
3
|
+
export const acceptedFileTypes = [
|
|
4
|
+
'json', 'yaml', 'txt', 'md', 'json', 'yaml', 'pdf', /*'xls',*/ 'xlsx', 'csv', 'cbl', 'cpp', 'cxx', 'cc', 'c', 'hpp', 'hxx', 'hh', 'h',
|
|
5
|
+
'cs', 'go', 'html', 'htm', 'kt', 'kts', 'md', 'php', 'proto', 'py', 'java', 'js', 'jsx', 'ts', 'tsx', 'rst', 'rb', 'rs', 'scala', 'swift',
|
|
6
|
+
'sql', 'yaml', 'yml', 'tf', 'sh', 'ps1', 'psd1', 'psm1', 'bat', 'cmd', 'rego', 'f', 'for', 'r', 'pl', 'vb', 'dart', 'hs', 'lua',
|
|
7
|
+
'asm', 'groovy', 'gvy', 'gy', 'mat', 'clj', 'lisp', 'm', 'cls', 'css', 'scss', 'json', 'jpg', 'jpeg', 'png', 'docx', 'pptx',
|
|
8
|
+
'tiff', 'tif', 'bmp',
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
export const maxFileSize: FileSize = { value: 10, unit: 'MB' }
|
|
12
|
+
|
|
13
|
+
export const maxUploadItems = 5
|
package/src/state/types.ts
CHANGED
|
@@ -4,5 +4,16 @@ export interface Labeled {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
export interface LabeledWithImage extends Labeled {
|
|
7
|
-
image?: string,
|
|
7
|
+
image?: string | undefined | null,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface LabeledAgent extends LabeledWithImage {
|
|
11
|
+
builtIn?: boolean,
|
|
12
|
+
slug?: string,
|
|
13
|
+
visibility_level?: string,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface FileSize {
|
|
17
|
+
value: number,
|
|
18
|
+
unit: 'B' | 'KB' | 'MB' | 'GB',
|
|
8
19
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { WithIcon } from '@stack-spot/citric-icons'
|
|
2
|
+
import { BaseIconBoxProps } from '@stack-spot/citric-react'
|
|
1
3
|
import { WithStyle } from '@stack-spot/portal-theme'
|
|
2
4
|
|
|
3
5
|
export interface WithChildren<T = React.ReactNode> {
|
|
@@ -6,15 +8,30 @@ export interface WithChildren<T = React.ReactNode> {
|
|
|
6
8
|
|
|
7
9
|
export type PropsOf<T extends React.FunctionComponent> = T extends React.FunctionComponent<infer P> ? P : never
|
|
8
10
|
|
|
9
|
-
export
|
|
10
|
-
icon?: React.ReactElement,
|
|
11
|
+
export type ButtonAction = {
|
|
11
12
|
color?: string,
|
|
12
|
-
label
|
|
13
|
+
label?: string,
|
|
14
|
+
ariaLabel?: string,
|
|
15
|
+
title?: string,
|
|
13
16
|
onClick: () => any,
|
|
14
|
-
|
|
17
|
+
appearance?: BaseIconBoxProps<any, any>['appearance'],
|
|
18
|
+
size?: BaseIconBoxProps<any, any>['size'],
|
|
19
|
+
disabled?: boolean,
|
|
20
|
+
} & WithStyle & Partial<WithIcon>
|
|
21
|
+
|
|
15
22
|
|
|
16
23
|
export interface MinimizedActions {
|
|
24
|
+
/**
|
|
25
|
+
* When the chat is minimized, a button to collapse the window is rendered. This function is called whenever this button is clicked.
|
|
26
|
+
*/
|
|
17
27
|
onCollapse?: () => void,
|
|
28
|
+
/**
|
|
29
|
+
* If `onCollapse` is clicked, the button to collapse is replaced by a button to expand. This function is called whenever the expand
|
|
30
|
+
* button is clicked.
|
|
31
|
+
*/
|
|
18
32
|
onExpand?: () => void,
|
|
33
|
+
/**
|
|
34
|
+
* When the chat is minimized, a button to close the window is rendered. This function is called whenever this button is clicked.
|
|
35
|
+
*/
|
|
19
36
|
onClose?: () => void,
|
|
20
37
|
}
|
package/src/utils/chat.ts
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import { FixedChatRequest } from '@stack-spot/portal-network'
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import appData from '../app-metadata.json'
|
|
3
|
+
import { ChatEntry } from '../state/ChatEntry'
|
|
4
|
+
import { ChatState } from '../state/ChatState'
|
|
5
5
|
import { defaultLanguage } from './programming-languages'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export function buildConversationContext(state: ChatState): FixedChatRequest['context'] {
|
|
7
|
+
/**
|
|
8
|
+
* Builds a conversation context from a ChatState.
|
|
9
|
+
*
|
|
10
|
+
* The conversation context is needed by most backend services.
|
|
11
|
+
*
|
|
12
|
+
* @param state the ChatState to build the context from.
|
|
13
|
+
* @returns the conversation context ready to be sent to the backend.
|
|
14
|
+
*/
|
|
15
|
+
export function buildConversationContext(state: ChatState, message?: ChatEntry): FixedChatRequest['context'] {
|
|
17
16
|
return {
|
|
18
17
|
workspace: state.get('workspace')?.id,
|
|
19
18
|
conversation_id: state.id,
|
|
20
19
|
stack_id: state.get('stack')?.id,
|
|
21
20
|
language: state.get('codeLanguage') || (state.get('codeSelection') ? defaultLanguage : undefined),
|
|
22
21
|
knowledge_sources: state.get('knowledgeSources')?.map(ks => ks.id),
|
|
22
|
+
upload_ids: message?.getValue().upload?.map(f => f.id),
|
|
23
23
|
agent_id: state.get('agent')?.id,
|
|
24
24
|
agent_built_in: state.get('agent')?.builtIn,
|
|
25
25
|
os: navigator.userAgent,
|
|
26
26
|
platform: 'web-widget',
|
|
27
27
|
platform_version: navigator.userAgent,
|
|
28
|
-
stackspot_ai_version:
|
|
28
|
+
stackspot_ai_version: appData.version,
|
|
29
|
+
selected_model_id: state.get('selected_model_id'),
|
|
29
30
|
}
|
|
30
31
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function copyTextToClipboardFallback(text: string) {
|
|
2
|
+
const input = document.createElement('input')
|
|
3
|
+
input.value = text
|
|
4
|
+
input.style.position = 'absolute'
|
|
5
|
+
input.style.left = '-99999px'
|
|
6
|
+
document.body.appendChild(input)
|
|
7
|
+
input.select()
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
document.execCommand('copy')
|
|
11
|
+
} catch {
|
|
12
|
+
/* empty */
|
|
13
|
+
}
|
|
14
|
+
finally {
|
|
15
|
+
document.body.removeChild(input)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Copies the provided text to the clipboard. If the Clipboard API is not supported,
|
|
21
|
+
* it falls back to using a hidden input element to perform the copy operation.
|
|
22
|
+
*/
|
|
23
|
+
export async function copyTextToClipboardWithFallback(text: string) {
|
|
24
|
+
try {
|
|
25
|
+
await navigator.clipboard.writeText(text)
|
|
26
|
+
} catch {
|
|
27
|
+
copyTextToClipboardFallback(text)
|
|
28
|
+
}
|
|
29
|
+
}
|
package/src/utils/date.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dictionary,
|
|
1
|
+
import { Dictionary, getLanguage, ptEn, useLanguage } from '@stack-spot/portal-translate'
|
|
2
2
|
|
|
3
3
|
const OneDay = 24 * 60 * 60 * 1000
|
|
4
4
|
const timeFormatOptions: Intl.DateTimeFormatOptions = { hour: '2-digit', minute:'2-digit' }
|
|
@@ -8,8 +8,18 @@ const fullFormatOptions: Intl.DateTimeFormatOptions = {
|
|
|
8
8
|
month: 'long',
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Formats a date to show at the footer of a chat message.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* - Today, 14:11
|
|
16
|
+
* - Yesterday, 09:00
|
|
17
|
+
* - October 26 at 10:53
|
|
18
|
+
* @param date the Date to format.
|
|
19
|
+
* @param language the language to use.
|
|
20
|
+
* @returns the formatted date.
|
|
21
|
+
*/
|
|
22
|
+
export function formatDateForChatMessage(date: Date, language = getLanguage(ptEn)) {
|
|
13
23
|
const formatted: string[] = []
|
|
14
24
|
const now = new Date()
|
|
15
25
|
const isToday = date.toDateString() === now.toDateString()
|
|
@@ -21,13 +31,27 @@ export function formatDateForChatMessage(date: Date, language: Language = getLan
|
|
|
21
31
|
return formatted.join(', ')
|
|
22
32
|
}
|
|
23
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Uses the current language to format dates.
|
|
36
|
+
* @returns an object containing functions for formatting dates.
|
|
37
|
+
*/
|
|
24
38
|
export function useDateFormatter() {
|
|
25
|
-
const language = useLanguage()
|
|
39
|
+
const language = useLanguage(ptEn)
|
|
26
40
|
return {
|
|
41
|
+
/**
|
|
42
|
+
* @param date the date to format using {@link formatDateForChatMessage}.
|
|
43
|
+
* @returns the formatted date according to the current language. If the language changes, this result also changes.
|
|
44
|
+
*/
|
|
27
45
|
formatForChatMessage: (date: Date) => formatDateForChatMessage(date, language),
|
|
28
46
|
}
|
|
29
47
|
}
|
|
30
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Subtracts `numberOfDays` from `date`.
|
|
51
|
+
* @param date
|
|
52
|
+
* @param numberOfDays
|
|
53
|
+
* @returns the resulting Date object.
|
|
54
|
+
*/
|
|
31
55
|
export function subtractDays(date: Date, numberOfDays: number) {
|
|
32
56
|
return new Date(date.getTime() - 24 * numberOfDays * 60 * 60000)
|
|
33
57
|
}
|
package/src/utils/download.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Downloads `text` as a file named `filename`.
|
|
3
|
+
* @param filename the name of the file.
|
|
4
|
+
* @param text the content of the file.
|
|
5
|
+
*/
|
|
1
6
|
export function download(filename: string, text: string) {
|
|
2
7
|
const element = document.createElement('a')
|
|
3
8
|
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text))
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { getLanguage, ptEn } from '@stack-spot/portal-translate'
|
|
2
|
+
|
|
3
|
+
const httpErrors: Record<'en' | 'pt', Record<number, string>> = {
|
|
4
|
+
en: {
|
|
5
|
+
400: 'Bad Request',
|
|
6
|
+
401: 'Unauthorized',
|
|
7
|
+
403: 'Forbidden',
|
|
8
|
+
404: 'Not Found',
|
|
9
|
+
405: 'Method Not Allowed',
|
|
10
|
+
406: 'Not Acceptable',
|
|
11
|
+
408: 'Request Timeout',
|
|
12
|
+
409: 'Conflict',
|
|
13
|
+
410: 'Gone',
|
|
14
|
+
411: 'Length Required',
|
|
15
|
+
413: 'Payload Too Large',
|
|
16
|
+
414: 'URI Too Long',
|
|
17
|
+
415: 'Unsupported Media Type',
|
|
18
|
+
429: 'Too Many Requests',
|
|
19
|
+
500: 'Internal Server Error',
|
|
20
|
+
501: 'Not Implemented',
|
|
21
|
+
502: 'Bad Gateway',
|
|
22
|
+
503: 'Service Unavailable',
|
|
23
|
+
504: 'Gateway Timeout',
|
|
24
|
+
505: 'HTTP Version Not Supported',
|
|
25
|
+
},
|
|
26
|
+
pt: {
|
|
27
|
+
400: 'Requisição Inválida',
|
|
28
|
+
401: 'Não Autorizado',
|
|
29
|
+
403: 'Proibido',
|
|
30
|
+
404: 'Não Encontrado',
|
|
31
|
+
405: 'Método Não Permitido',
|
|
32
|
+
406: 'Não Aceitável',
|
|
33
|
+
408: 'Tempo de Requisição Esgotado',
|
|
34
|
+
409: 'Conflito',
|
|
35
|
+
410: 'Indisponível',
|
|
36
|
+
411: 'Comprimento Necessário',
|
|
37
|
+
413: 'Carga Muito Grande',
|
|
38
|
+
414: 'URI Muito Longa',
|
|
39
|
+
415: 'Tipo de Mídia Não Suportado',
|
|
40
|
+
429: 'Muitas Requisições',
|
|
41
|
+
500: 'Erro Interno do Servidor',
|
|
42
|
+
501: 'Não Implementado',
|
|
43
|
+
502: 'Gateway Inválido',
|
|
44
|
+
503: 'Serviço Indisponível',
|
|
45
|
+
504: 'Tempo de Gateway Esgotado',
|
|
46
|
+
505: 'Versão HTTP Não Suportada',
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function getGenericErrorBasedOnStatus(status: number) {
|
|
51
|
+
return httpErrors[getLanguage(ptEn)][status] ?? `Unknown error. Status code: ${status}.`
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function treatHTMLInErrorMessage(text: string, status: number) {
|
|
55
|
+
return (!text.includes('<html>')) ? text : getGenericErrorBasedOnStatus(status)
|
|
56
|
+
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { DocumentResponse, SourceKnowledgeSource,
|
|
1
|
+
import { DocumentResponse, SourceKnowledgeSource, SourceProjectFile3, SourceStackAi } from '@stack-spot/portal-network/api/ai'
|
|
2
2
|
import { KnowledgeSource } from '../state/ChatEntry'
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* A document can come from the backend as something that resembles a JSON, but it is not. This function attempts to solve some issues and
|
|
6
|
+
* still interpret as a JSON.
|
|
7
|
+
* @param str the malformed JSON.
|
|
8
|
+
* @returns the object corresponding to parsed JSON or undefined if it wasn't possible to fix it.
|
|
9
|
+
*/
|
|
4
10
|
function attemptToParseMalFormedJson(str: string) {
|
|
5
11
|
try {
|
|
6
12
|
return JSON.parse(str)
|
|
@@ -21,6 +27,11 @@ function attemptToParseMalFormedJson(str: string) {
|
|
|
21
27
|
}
|
|
22
28
|
}
|
|
23
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Extracts the important part of a KS document to show for the user.
|
|
32
|
+
* @param document the document to parse.
|
|
33
|
+
* @returns an object containing the programming language of the KS, its code snippet and a textual description.
|
|
34
|
+
*/
|
|
24
35
|
export function extractCodeFromKSDocument(document: DocumentResponse): { language?: string, snippet: string, text?: string } {
|
|
25
36
|
const language = (document?.metadata as any)?.language
|
|
26
37
|
if (language) {
|
|
@@ -43,8 +54,13 @@ export function extractCodeFromKSDocument(document: DocumentResponse): { languag
|
|
|
43
54
|
return typeof document === 'object' ? { language: 'json', snippet: JSON.stringify(document, null, 2) } : { snippet: String(document) }
|
|
44
55
|
}
|
|
45
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Extracts all knowledge sources from a mix of sources that can be used to shape an AI agent's answer.
|
|
59
|
+
* @param sources a list with sources of any kind.
|
|
60
|
+
* @returns a list of knowledge sources in the format expected by the chat.
|
|
61
|
+
*/
|
|
46
62
|
export function genericSourcesToKnowledgeSources(
|
|
47
|
-
sources: (SourceStackAi | SourceKnowledgeSource |
|
|
63
|
+
sources: (SourceStackAi | SourceKnowledgeSource | SourceProjectFile3)[] | undefined,
|
|
48
64
|
): KnowledgeSource[] | undefined {
|
|
49
65
|
return sources?.filter(s => s.type === 'knowledge_source').map(ks => {
|
|
50
66
|
const { document_id: documentId, document_score: documentScore, name, slug } = ks as SourceKnowledgeSource
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
class PlanningToolDictionaryHelper {
|
|
2
|
+
static instance: PlanningToolDictionaryHelper | undefined
|
|
3
|
+
private toolExecutionIdPlanningStep: Record<string, string> = {}
|
|
4
|
+
private toolExecutionIdToolStep: Record<string, string> = {}
|
|
5
|
+
private stepId: Record<string, number> = {}
|
|
6
|
+
|
|
7
|
+
private constructor() {
|
|
8
|
+
PlanningToolDictionaryHelper.instance = this
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
static create() {
|
|
12
|
+
return PlanningToolDictionaryHelper.instance ?? new PlanningToolDictionaryHelper()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
setMessageIdPlanningStepToolExecutionId(messageId: string, toolExecutionId: string){
|
|
16
|
+
this.toolExecutionIdPlanningStep[toolExecutionId] = messageId
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
setMessageIdToolStepToolExecutionId(messageId: string, toolExecutionId: string){
|
|
20
|
+
this.toolExecutionIdToolStep[toolExecutionId] = messageId
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
setMessageIdForStepId(messageId: number, stepId: string){
|
|
24
|
+
this.stepId[stepId] = messageId
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
getMessageIdFromStepId(stepId: string){
|
|
28
|
+
return this.stepId[stepId]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
getMessageIdPlanningStepFromToolExecutionId(toolExecutionId: string){
|
|
32
|
+
return this.toolExecutionIdPlanningStep[toolExecutionId]
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getMessageIdToolStepFromToolExecutionId(toolExecutionId: string){
|
|
36
|
+
return this.toolExecutionIdToolStep[toolExecutionId]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const planningToolDictionaryHelper = PlanningToolDictionaryHelper.create()
|
|
41
|
+
|
|
@@ -81,6 +81,11 @@ export const languages = [
|
|
|
81
81
|
'label': 'CSS',
|
|
82
82
|
'extensions': ['.css'],
|
|
83
83
|
},
|
|
84
|
+
{
|
|
85
|
+
'value': 'csv',
|
|
86
|
+
'label': 'CSV',
|
|
87
|
+
'extensions': ['.csv'],
|
|
88
|
+
},
|
|
84
89
|
{
|
|
85
90
|
'value': 'd',
|
|
86
91
|
'label': 'D',
|
|
@@ -351,6 +356,11 @@ export const languages = [
|
|
|
351
356
|
'label': 'Redshift',
|
|
352
357
|
'extensions': ['.sql'],
|
|
353
358
|
},
|
|
359
|
+
{
|
|
360
|
+
'value': 'rego',
|
|
361
|
+
'label': 'Rego',
|
|
362
|
+
'extensions': ['.rego'],
|
|
363
|
+
},
|
|
354
364
|
{
|
|
355
365
|
'value': 'restructuredtext',
|
|
356
366
|
'label': 'Restructured Text',
|
package/src/utils/string.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Gets the size of a string removing control characters and spaces
|
|
3
|
+
* @param str the string to count.
|
|
4
|
+
* @returns the count value.
|
|
5
|
+
*/
|
|
2
6
|
export function getSizeOfString(str: string): number {
|
|
3
7
|
// eslint-disable-next-line no-control-regex
|
|
4
8
|
const withoutSpacesAndControls = str.replace(/[\u0000-\u001F\u007F-\u009F\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069\s]/g, '')
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
export type ToolWithImage = { id?: string, image?: string, name: string, description?: string }
|
|
3
|
+
|
|
4
|
+
interface Toolkit {
|
|
5
|
+
id?: string | null,
|
|
6
|
+
tools?: { id?: string, name?: string, description?: string, function?: { name: string, description?: string } }[] | null,
|
|
7
|
+
image_url?: string | null,
|
|
8
|
+
avatar?: string | null,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function findToolById(id: string, toolkits: Toolkit[]) {
|
|
12
|
+
for (const tk of toolkits ?? []) {
|
|
13
|
+
for (const t of tk.tools ?? []) {
|
|
14
|
+
if (t.id === id) return { tool: t, toolkit: tk }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function toolById(id: string, toolkits: Toolkit[] | undefined): ToolWithImage {
|
|
20
|
+
// mcp tools are identified by "{toolkitId}/{functionName}"
|
|
21
|
+
const mcp = id.match(/(\w+)\/(.+)/)
|
|
22
|
+
if (mcp) {
|
|
23
|
+
const [, toolkitId, toolName] = mcp
|
|
24
|
+
const toolkit = toolkits?.find(tk => tk.id === toolkitId)
|
|
25
|
+
const tool = toolkit?.tools?.find(t => t.name === toolName)
|
|
26
|
+
return { id, image: toolkit?.avatar ?? undefined, name: toolName, description: tool?.function?.description }
|
|
27
|
+
}
|
|
28
|
+
const { tool, toolkit } = findToolById(id, toolkits ?? []) ?? {}
|
|
29
|
+
return (tool && toolkit)
|
|
30
|
+
? { id, image: toolkit.avatar ?? toolkit.image_url ?? undefined, name: tool.name || id, description: tool?.description }
|
|
31
|
+
: { id, name: id }
|
|
32
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ChatEntry, TextChatEntry } from '../state/ChatEntry'
|
|
2
|
+
import { planningToolDictionaryHelper } from './planning-tool'
|
|
3
|
+
|
|
4
|
+
export const updateToolStep = (messages: ChatEntry[], executionId: string,
|
|
5
|
+
newStatus: 'pending' | 'running' | 'success' | 'error' | 'awaiting_approval') => {
|
|
6
|
+
|
|
7
|
+
// if last message is a user message, no update in tool status is needed
|
|
8
|
+
if (messages[messages.length-1].getValue().agentType === 'user') return
|
|
9
|
+
|
|
10
|
+
const messageId = planningToolDictionaryHelper.getMessageIdPlanningStepFromToolExecutionId(executionId)
|
|
11
|
+
const message = messages.find((message) => `${message.id}` === messageId)
|
|
12
|
+
let update = false
|
|
13
|
+
const messageValue = message?.getValue()
|
|
14
|
+
messageValue?.steps?.map((step) => {
|
|
15
|
+
if (step.type === 'step') {
|
|
16
|
+
const tool = step.attempts?.[0].tools?.[0]
|
|
17
|
+
if (tool?.executionId === executionId && step.status !== newStatus) {
|
|
18
|
+
step.status = newStatus
|
|
19
|
+
update = true
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
if (update) {
|
|
25
|
+
message?.setValue({ ...messageValue as TextChatEntry })
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { dataIntegrationClient } from '@stack-spot/portal-network'
|
|
2
|
+
import { FileUploadType } from '@stack-spot/portal-network/api/dataIntegration'
|
|
3
|
+
import { pull } from 'lodash'
|
|
4
|
+
import { FileUploadStatus } from './types'
|
|
5
|
+
|
|
6
|
+
export type FileUploadChangeListener = (status: FileUploadStatus) => void
|
|
7
|
+
|
|
8
|
+
export class FileUpload {
|
|
9
|
+
readonly file: File
|
|
10
|
+
status: FileUploadStatus = 'pending'
|
|
11
|
+
readonly id: string
|
|
12
|
+
readonly type: FileUploadType
|
|
13
|
+
error?: any
|
|
14
|
+
uploadId?: string
|
|
15
|
+
private listeners: FileUploadChangeListener[] = []
|
|
16
|
+
private abortController = new AbortController()
|
|
17
|
+
|
|
18
|
+
constructor(file: File, type: FileUploadType = 'CONTEXT') {
|
|
19
|
+
this.file = file
|
|
20
|
+
this.type = type
|
|
21
|
+
this.id = `${Date.now()}-${Math.random()}`
|
|
22
|
+
this.upload()
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private runListeners() {
|
|
26
|
+
this.listeners.forEach(l => l(this.status))
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private async upload() {
|
|
30
|
+
try {
|
|
31
|
+
const [id] = await dataIntegrationClient.uploadFiles.mutate({ files: [this.file], type: this.type }, this.abortController.signal)
|
|
32
|
+
this.uploadId = id
|
|
33
|
+
this.status = 'success'
|
|
34
|
+
} catch (error) {
|
|
35
|
+
this.error = error
|
|
36
|
+
this.status = 'error'
|
|
37
|
+
}
|
|
38
|
+
this.runListeners()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
stop() {
|
|
42
|
+
this.abortController.abort()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
retry() {
|
|
46
|
+
if (this.status != 'error') return
|
|
47
|
+
this.status = 'pending'
|
|
48
|
+
this.runListeners()
|
|
49
|
+
this.upload()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
onChange(listener: FileUploadChangeListener) {
|
|
53
|
+
this.listeners.push(listener)
|
|
54
|
+
return () => {
|
|
55
|
+
pull(this.listeners, listener)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
destroy() {
|
|
60
|
+
this.listeners = []
|
|
61
|
+
this.stop()
|
|
62
|
+
}
|
|
63
|
+
}
|