@stack-spot/ai-chat-widget 0.10.0 → 1.0.0-dev.1768314799914
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/AbortedError.d.ts +5 -0
- package/dist/AbortedError.d.ts.map +1 -0
- package/dist/AbortedError.js +7 -0
- package/dist/AbortedError.js.map +1 -0
- package/dist/StackspotAIWidget.d.ts +48 -7
- package/dist/StackspotAIWidget.d.ts.map +1 -1
- package/dist/StackspotAIWidget.js +22 -15
- package/dist/StackspotAIWidget.js.map +1 -1
- package/dist/app-metadata.json +171 -0
- package/dist/assets/placeholder.png +0 -0
- package/dist/chat-interceptors/CustomInputs.d.ts +22 -0
- package/dist/chat-interceptors/CustomInputs.d.ts.map +1 -0
- package/dist/chat-interceptors/CustomInputs.js +71 -0
- package/dist/chat-interceptors/CustomInputs.js.map +1 -0
- package/dist/chat-interceptors/quick-command-questions.d.ts +14 -0
- package/dist/chat-interceptors/quick-command-questions.d.ts.map +1 -0
- package/dist/chat-interceptors/quick-command-questions.js +28 -0
- package/dist/chat-interceptors/quick-command-questions.js.map +1 -0
- package/dist/chat-interceptors/quick-commands.d.ts +14 -1
- package/dist/chat-interceptors/quick-commands.d.ts.map +1 -1
- package/dist/chat-interceptors/quick-commands.js +442 -8
- package/dist/chat-interceptors/quick-commands.js.map +1 -1
- package/dist/chat-interceptors/send-message.d.ts +27 -2
- package/dist/chat-interceptors/send-message.d.ts.map +1 -1
- package/dist/chat-interceptors/send-message.js +230 -29
- 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 +189 -15
- package/dist/state/ChatEntry.d.ts.map +1 -1
- package/dist/state/ChatEntry.js +29 -18
- package/dist/state/ChatEntry.js.map +1 -1
- package/dist/state/ChatState.d.ts +129 -15
- package/dist/state/ChatState.d.ts.map +1 -1
- package/dist/state/ChatState.js +87 -11
- 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 +15 -1
- 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 +15 -12
- 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 +20 -6
- 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 +1 -0
- package/dist/utils/programming-languages.d.ts.map +1 -1
- package/dist/utils/programming-languages.js +11 -0
- package/dist/utils/programming-languages.js.map +1 -1
- package/dist/utils/string.d.ts +7 -0
- package/dist/utils/string.d.ts.map +1 -0
- package/dist/utils/string.js +11 -0
- package/dist/utils/string.js.map +1 -0
- 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 +57 -4
- package/dist/views/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/views/Chat/ChatMessage.js +167 -20
- 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 +183 -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 +26 -20
- 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 +116 -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 +20 -13
- package/package.stg.json +4 -0
- package/scripts/package-override.js +105 -0
- package/src/AbortedError.ts +7 -0
- package/src/StackspotAIWidget.tsx +96 -27
- package/src/app-metadata.json +171 -0
- package/src/assets/placeholder.png +0 -0
- package/src/chat-interceptors/CustomInputs.ts +83 -0
- package/src/chat-interceptors/quick-command-questions.ts +25 -0
- package/src/chat-interceptors/quick-commands.ts +503 -7
- package/src/chat-interceptors/send-message.ts +256 -28
- 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 +194 -27
- package/src/state/ChatState.ts +172 -17
- package/src/state/ChatTabsController.ts +78 -8
- package/src/state/ObservableState.ts +15 -1
- 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 +17 -15
- 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 +22 -8
- package/src/utils/planning-tool.ts +41 -0
- package/src/utils/programming-languages.ts +12 -0
- package/src/utils/string.ts +10 -0
- 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 +472 -56
- package/src/views/Chat/ChatMessages.tsx +18 -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 +189 -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 +31 -22
- 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 +158 -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/Editor.d.ts +0 -9
- package/dist/components/Editor.d.ts.map +0 -1
- package/dist/components/Editor.js +0 -2
- package/dist/components/Editor.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/Editor.tsx +0 -12
- 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
|
@@ -1,12 +1,508 @@
|
|
|
1
|
+
import { aiClient, CancelledError, FixedChatRequest, StackspotAPIError } from '@stack-spot/portal-network'
|
|
2
|
+
import { QuickCommandStepResult, QuickCommandPromptResponse2, QuickCommandResponse, QuickCommandScriptExecutionResponse, QuickCommandStepFetchResponse, QuickCommandStepLlmResponse } from '@stack-spot/portal-network/api/ai'
|
|
3
|
+
import { Dictionary, interpolate, translate } from '@stack-spot/portal-translate'
|
|
4
|
+
import { isNil } from 'lodash'
|
|
5
|
+
import type { editor } from 'monaco-editor'
|
|
6
|
+
import { ulid } from 'ulid'
|
|
7
|
+
import { AbortedError } from '../AbortedError'
|
|
8
|
+
import { quickCommandRegex } from '../regex'
|
|
1
9
|
import { ChatEntry } from '../state/ChatEntry'
|
|
2
10
|
import { ChatState } from '../state/ChatState'
|
|
11
|
+
import { LabeledWithImage } from '../state/types'
|
|
12
|
+
import { WidgetState } from '../state/WidgetState'
|
|
13
|
+
import { buildConversationContext } from '../utils/chat'
|
|
14
|
+
import { getSizeOfString } from '../utils/string'
|
|
15
|
+
import { CustomInputs } from './CustomInputs'
|
|
3
16
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
17
|
+
type SlugExecution = Record<string, QuickCommandStepResult>
|
|
18
|
+
|
|
19
|
+
interface QCContext {
|
|
20
|
+
qc: QuickCommandResponse,
|
|
21
|
+
context: Required<FixedChatRequest>['context'],
|
|
22
|
+
resultMap: SlugExecution,
|
|
23
|
+
customInputs: Record<string, string>,
|
|
24
|
+
chat: ChatState,
|
|
25
|
+
code?: string,
|
|
26
|
+
executionId: string,
|
|
27
|
+
signal: AbortSignal,
|
|
28
|
+
isRemote?: boolean,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* While the quick command is running, if it takes more than `progressMessageDelayMS` a progress message is shown.
|
|
33
|
+
* This progress message is shown immediately if one of the steps is of type "LLM".
|
|
34
|
+
*/
|
|
35
|
+
const progressMessageDelayMS = 1000
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* This creates a chat interceptor for interpreting and running quick commands. We need a function to create the interceptor because, for
|
|
39
|
+
* quick commands, we need access to the full widget state and the editor, which are not provided to a chat interceptor.
|
|
40
|
+
*
|
|
41
|
+
* The quick command interceptor intercepts all user messages (trimmed) that matches the quick command regex. It fetches the quick command
|
|
42
|
+
* from the backend, runs all of its steps and outputs the final response (in the chat or in the editor).
|
|
43
|
+
*
|
|
44
|
+
* @param widget the full widget state.
|
|
45
|
+
* @param getEditor a function that returns the editor instance (monaco).
|
|
46
|
+
* @returns the quick commands chat interceptor.
|
|
47
|
+
*/
|
|
48
|
+
export function createQuickCommandInterceptor(widget: WidgetState, getEditor: () => typeof editor | undefined) {
|
|
49
|
+
/**
|
|
50
|
+
* This creates a CustomInputs instance in the current chat, which activates the `quickCommandQuestionsInterceptor`. In summary, this asks
|
|
51
|
+
* the first question, wait for all answers to be given and fills the result map in the context passed as parameter.
|
|
52
|
+
*/
|
|
53
|
+
async function computeCustomInputs(ctx: QCContext) {
|
|
54
|
+
const { chat, qc: { custom_inputs: inputs, name, slug } } = ctx
|
|
55
|
+
if (!inputs?.length) return
|
|
56
|
+
chat.set('isLoading', false)
|
|
57
|
+
const t = translate(dictionary)
|
|
58
|
+
const customInputs = new CustomInputs(inputs, chat.get('agent'))
|
|
59
|
+
CustomInputs.setCustomInputsForChat(customInputs, chat)
|
|
60
|
+
chat.pushMessage(new ChatEntry({
|
|
61
|
+
agentType: 'bot',
|
|
62
|
+
type: 'text',
|
|
63
|
+
content: interpolate(t.startQuestioning, name || slug),
|
|
64
|
+
}))
|
|
65
|
+
chat.pushMessage(customInputs.ask())
|
|
66
|
+
const inputsValues = await customInputs.getValue()
|
|
67
|
+
chat.set('isLoading', true)
|
|
68
|
+
CustomInputs.deleteCustomInputsFromChat(chat)
|
|
69
|
+
ctx.customInputs = { ...ctx.customInputs, ...inputsValues }
|
|
70
|
+
ctx.context.upload_ids = chat.getMessages()
|
|
71
|
+
.flatMap(message =>
|
|
72
|
+
(message.getValue().upload || []).map(upload => upload.id),
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Runs an Router step of a quick command.
|
|
78
|
+
*/
|
|
79
|
+
async function runRouterStep(
|
|
80
|
+
ctx: QCContext,
|
|
81
|
+
stepIndex: number, iteration: Record<string, number>,
|
|
82
|
+
progress: { update: (index: number) => void, remove: () => void },
|
|
83
|
+
) {
|
|
84
|
+
const { qc: { slug, steps }, code, resultMap, customInputs } = ctx
|
|
85
|
+
const step = steps![stepIndex]
|
|
86
|
+
const inputData = Object.keys(customInputs).length > 0 && code ? { ...customInputs, [code]: code } : code ?? customInputs
|
|
87
|
+
try {
|
|
88
|
+
if (step.slug in iteration) {
|
|
89
|
+
iteration[step.slug] = iteration[step.slug] + 1
|
|
90
|
+
} else {
|
|
91
|
+
iteration[step.slug] = 1
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const { next_step_slug } = await aiClient.calculateNextStep.mutate({
|
|
95
|
+
stepSlug: step.slug,
|
|
96
|
+
slug: slug,
|
|
97
|
+
quickCommandEvaluateStepRouterRequest: {
|
|
98
|
+
executions_count: iteration[step.slug],
|
|
99
|
+
input_data: inputData,
|
|
100
|
+
slugs_executions: resultMap,
|
|
101
|
+
},
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
if (next_step_slug === step.slug) {
|
|
105
|
+
return runStepsRecursively(stepIndex, progress, ctx, iteration)
|
|
106
|
+
}
|
|
107
|
+
const nextStepIndex = steps?.findIndex((step) => step.slug === next_step_slug)
|
|
108
|
+
|
|
109
|
+
if (isNil(nextStepIndex) || nextStepIndex === -1) return
|
|
110
|
+
|
|
111
|
+
return runStepsRecursively(nextStepIndex, progress, ctx, iteration)
|
|
112
|
+
}
|
|
113
|
+
catch (error: any) {
|
|
114
|
+
// eslint-disable-next-line no-console
|
|
115
|
+
console.error('Error executing QC step', error)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Runs a fetch step of a quick command and puts the result in the `resultMap` of the context passed as parameter.
|
|
121
|
+
*/
|
|
122
|
+
async function runFetchStep(ctx: QCContext, stepIndex: number) {
|
|
123
|
+
const { qc: { slug, steps }, code, context, resultMap, customInputs, executionId, signal } = ctx
|
|
124
|
+
const step = steps![stepIndex] as QuickCommandStepFetchResponse
|
|
125
|
+
if (step.is_remote) {
|
|
126
|
+
ctx.isRemote = true
|
|
127
|
+
|
|
128
|
+
const { data } = await aiClient.fetchStepOfQuickCommandRemotely.mutate({
|
|
129
|
+
slug, stepSlug: step.slug,
|
|
130
|
+
quickCommandsExecutionRequest: {
|
|
131
|
+
code_selection: code, context, qc_execution_id: executionId,
|
|
132
|
+
slugs_executions: { ...resultMap, ...customInputs },
|
|
133
|
+
},
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
//data is the return of the request in the QC so we do not have full control over the response
|
|
137
|
+
//We handle the usual format with body, status_code and headers, but we might also handle other formats
|
|
138
|
+
const responseData = data as any
|
|
139
|
+
resultMap[step.slug] = {
|
|
140
|
+
status: responseData.status_code || 200,
|
|
141
|
+
data: JSON.stringify(responseData.body) ?? JSON.stringify(responseData),
|
|
142
|
+
headers: responseData.headers ?? {},
|
|
143
|
+
}
|
|
144
|
+
return
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const { headers, data, method, url } = await aiClient.fetchStepOfQuickCommand.mutate({
|
|
148
|
+
slug,
|
|
149
|
+
stepSlug: step.slug,
|
|
150
|
+
quickCommandsExecutionRequest: {
|
|
151
|
+
input_data: code, context, qc_execution_id: executionId,
|
|
152
|
+
slugs_executions: { ...resultMap, ...customInputs },
|
|
153
|
+
},
|
|
154
|
+
}, signal)
|
|
155
|
+
const body = ['get', 'head'].includes(method.toLowerCase()) ? undefined : data
|
|
156
|
+
const response = await fetch(url, { headers: headers || undefined, body, method, signal })
|
|
157
|
+
if (!response.ok) throw new Error(`Failed to execute step "${step.slug}" of quick command "${slug}". Status ${response.status}.`)
|
|
158
|
+
resultMap[step.slug] = {
|
|
159
|
+
status: response.status,
|
|
160
|
+
data: await response.text(),
|
|
161
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
162
|
+
}
|
|
11
163
|
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Runs an LLM step of a quick command and puts the result in the `resultMap` of the context passed as parameter.
|
|
167
|
+
*/
|
|
168
|
+
async function runLLMStep(
|
|
169
|
+
{ qc: { slug, steps }, code, customInputs, context, executionId, resultMap, signal }: QCContext,
|
|
170
|
+
stepIndex: number,
|
|
171
|
+
) {
|
|
172
|
+
const step = steps![stepIndex] as QuickCommandStepLlmResponse
|
|
173
|
+
let stepContext = context
|
|
174
|
+
if (!step.use_uploaded_files) {
|
|
175
|
+
const { upload_ids: _upload_ids, ...contextDataProps } = context
|
|
176
|
+
stepContext = { ...contextDataProps }
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const stream = aiClient.streamLlmStepOfQuickCommand(
|
|
180
|
+
slug,
|
|
181
|
+
step.slug,
|
|
182
|
+
{
|
|
183
|
+
input_data: code,
|
|
184
|
+
context: stepContext,
|
|
185
|
+
qc_execution_id: executionId,
|
|
186
|
+
slugs_executions: { ...resultMap, ...customInputs },
|
|
187
|
+
},
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
signal.addEventListener('abort', () => stream.cancel())
|
|
191
|
+
|
|
192
|
+
let finalValue: QuickCommandPromptResponse2
|
|
193
|
+
try {
|
|
194
|
+
finalValue = await stream.getValue()
|
|
195
|
+
resultMap[step.slug] = finalValue
|
|
196
|
+
} catch (error: any) {
|
|
197
|
+
// eslint-disable-next-line no-console
|
|
198
|
+
console.error('Error executing QC step', error)
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function updateProgressMessageForStep(message: ChatEntry, qc: QuickCommandResponse, stepIndex: number) {
|
|
203
|
+
const t = translate(dictionary)
|
|
204
|
+
message.setValue({
|
|
205
|
+
...message.getValue(),
|
|
206
|
+
content: interpolate(t.progress, qc.steps?.[stepIndex]?.slug, qc.name || qc.slug),
|
|
207
|
+
})
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function createProgressMessage(agent?: LabeledWithImage) {
|
|
211
|
+
return new ChatEntry({
|
|
212
|
+
agentType: 'bot',
|
|
213
|
+
content: '',
|
|
214
|
+
type: 'text',
|
|
215
|
+
agent,
|
|
216
|
+
})
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function showProgressMessage(ctx: QCContext) {
|
|
220
|
+
const showImmediately = ctx.qc.steps?.some(s => s.type === 'LLM')
|
|
221
|
+
const message = createProgressMessage(ctx.chat.get('agent'))
|
|
222
|
+
const controller = {
|
|
223
|
+
update: (index: number) => updateProgressMessageForStep(message, ctx.qc, index),
|
|
224
|
+
remove: () => clearTimeout(timeout),
|
|
225
|
+
}
|
|
226
|
+
const timeout = window.setTimeout(() => {
|
|
227
|
+
const chat = ctx.chat
|
|
228
|
+
chat.pushMessage(message)
|
|
229
|
+
controller.remove = () => chat.popMessage()
|
|
230
|
+
}, showImmediately ? 0 : progressMessageDelayMS)
|
|
231
|
+
return controller
|
|
232
|
+
}
|
|
233
|
+
async function getScriptStepStatus(
|
|
234
|
+
scriptExecutionId: string,
|
|
235
|
+
interval = 5000,
|
|
236
|
+
maxAttempts = 500,
|
|
237
|
+
currentAttempt = 0,
|
|
238
|
+
): Promise<QuickCommandScriptExecutionResponse> {
|
|
239
|
+
if (currentAttempt >= maxAttempts) {
|
|
240
|
+
throw new Error('Max attempts reached in verify script status')
|
|
241
|
+
}
|
|
242
|
+
await aiClient.getStatusScriptStep.invalidate({ scriptExecutionId })
|
|
243
|
+
const response = await aiClient.getStatusScriptStep.query({ scriptExecutionId })
|
|
244
|
+
|
|
245
|
+
if (response.status === 'success') {
|
|
246
|
+
return response
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (response.status === 'failure') {
|
|
250
|
+
throw response
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
await new Promise(resolve => {setTimeout(resolve, interval)})
|
|
254
|
+
|
|
255
|
+
return getScriptStepStatus(scriptExecutionId, interval, maxAttempts, currentAttempt + 1)
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
async function runScriptStep(
|
|
259
|
+
{ qc: { slug, steps }, code, context, resultMap, customInputs, signal }: QCContext,
|
|
260
|
+
stepIndex: number,
|
|
261
|
+
) {
|
|
262
|
+
const step = steps![stepIndex] as QuickCommandStepLlmResponse
|
|
263
|
+
let stepContext = context
|
|
264
|
+
if (!step.use_uploaded_files) {
|
|
265
|
+
const { upload_ids: _upload_ids, ...contextDataProps } = context
|
|
266
|
+
stepContext = { ...contextDataProps }
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
try {
|
|
270
|
+
const { script_execution_id } = await aiClient.startScriptStep.mutate({
|
|
271
|
+
stepSlug: step.slug,
|
|
272
|
+
slug: slug,
|
|
273
|
+
quickCommandStartScriptRequest: {
|
|
274
|
+
input_data: code,
|
|
275
|
+
custom_inputs: customInputs,
|
|
276
|
+
context: stepContext,
|
|
277
|
+
slugs_executions: resultMap,
|
|
278
|
+
},
|
|
279
|
+
}, signal)
|
|
280
|
+
const scriptResult = await getScriptStepStatus(script_execution_id)
|
|
281
|
+
resultMap[step.slug] = scriptResult
|
|
282
|
+
}
|
|
283
|
+
catch (error: any) {
|
|
284
|
+
throw new Error(`Failed to execute step "${step.slug}" of quick command "${slug}". Error ${error}.`)
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
async function runStepsRecursively(currentIndex: number, progress: { update: (index: number) => void, remove: () => void },
|
|
289
|
+
ctx: QCContext, iteration: Record<string, number>) {
|
|
290
|
+
const { qc } = ctx
|
|
291
|
+
|
|
292
|
+
if (!qc.steps || currentIndex >= qc.steps?.length) return
|
|
293
|
+
progress.update(currentIndex)
|
|
294
|
+
|
|
295
|
+
if (qc.steps[currentIndex].type === 'ROUTER') {
|
|
296
|
+
await runRouterStep(ctx, currentIndex, iteration, progress)
|
|
297
|
+
return
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (qc.steps[currentIndex].type === 'SCRIPT') {
|
|
301
|
+
await runScriptStep(ctx, currentIndex)
|
|
302
|
+
} else {
|
|
303
|
+
await (qc.steps[currentIndex].type === 'FETCH' ? runFetchStep(ctx, currentIndex) : runLLMStep(ctx, currentIndex))
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const currentStep = qc.steps?.[currentIndex] as QuickCommandStepFetchResponse | QuickCommandStepLlmResponse
|
|
307
|
+
let nextIndex = currentIndex + 1
|
|
308
|
+
|
|
309
|
+
let nextStepSlug = currentStep.next_step_slug
|
|
310
|
+
const stepResult = ctx.resultMap[currentStep.slug]
|
|
311
|
+
if (stepResult && typeof stepResult !== 'string' && 'answer_status' in stepResult && !!stepResult.answer_status?.next_step_slug) {
|
|
312
|
+
nextStepSlug = stepResult.answer_status.next_step_slug
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if (nextStepSlug) {
|
|
316
|
+
nextIndex = nextStepSlug === 'end' ?
|
|
317
|
+
qc.steps.length : qc.steps?.findIndex((step) => step.slug === nextStepSlug)
|
|
318
|
+
}
|
|
319
|
+
await runStepsRecursively(nextIndex, progress, ctx, iteration)
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
async function runSteps(ctx: QCContext) {
|
|
323
|
+
const progress = showProgressMessage(ctx)
|
|
324
|
+
try {
|
|
325
|
+
await runStepsRecursively(0, progress, ctx, {})
|
|
326
|
+
} finally {
|
|
327
|
+
progress.remove()
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
async function formatResult({ qc, code, executionId, context, resultMap, customInputs, signal }: QCContext) {
|
|
332
|
+
const formatted = await aiClient.formatResultOfQuickCommand.mutate({
|
|
333
|
+
slug: qc.slug,
|
|
334
|
+
quickCommandsExecutionRequest: {
|
|
335
|
+
input_data: code,
|
|
336
|
+
context,
|
|
337
|
+
qc_execution_id: executionId,
|
|
338
|
+
slugs_executions: { ...resultMap, ...customInputs },
|
|
339
|
+
},
|
|
340
|
+
}, signal)
|
|
341
|
+
return formatted.result
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// opens a new chat tab if the quick command doesn't preserve the conversation and the current conversation isn't clean.
|
|
345
|
+
function manageConversationContext(ctx: QCContext) {
|
|
346
|
+
if (!ctx.qc.preserve_conversation && ctx.chat.getMessages().length > 1) {
|
|
347
|
+
if (ctx.qc.return_type === 'CHAT') {
|
|
348
|
+
ctx.chat.set('isLoading', false)
|
|
349
|
+
ctx.chat = ctx.chat.transferToNewChat(ctx.qc.name || ctx.qc.slug)
|
|
350
|
+
ctx.chat.set('isLoading', true)
|
|
351
|
+
widget.chatTabs.add(ctx.chat)
|
|
352
|
+
widget.chatTabs.select(ctx.chat.id)
|
|
353
|
+
ctx.context.conversation_id = ctx.chat.id
|
|
354
|
+
} else {
|
|
355
|
+
// if we're running a command in the editor, we don't need to open a new tab, we just need to run it in a new conversation context.
|
|
356
|
+
ctx.context.conversation_id = ulid()
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
async function runQuickCommand(ctx: QCContext) {
|
|
362
|
+
const { qc: { slug }, code } = ctx
|
|
363
|
+
const t = translate(dictionary)
|
|
364
|
+
ctx.signal.addEventListener('abort', () => aiClient.quickCommand.cancel({ slug }))
|
|
365
|
+
await aiClient.quickCommand.invalidate({ slug })
|
|
366
|
+
try {
|
|
367
|
+
ctx.qc = await aiClient.quickCommand.query({ slug })
|
|
368
|
+
} catch (error) {
|
|
369
|
+
throw error instanceof StackspotAPIError && error.status === 404 ? new Error(t.notFound) : error
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
if (ctx.qc.use_selected_code && (!code && ctx.context.upload_ids?.length === 0)) {
|
|
373
|
+
widget.set('panel', 'editor')
|
|
374
|
+
ctx.chat.pushMessage(new ChatEntry({
|
|
375
|
+
agentType: 'bot',
|
|
376
|
+
type: 'text',
|
|
377
|
+
agent: ctx.chat.get('agent'),
|
|
378
|
+
content: t.requiresSelection,
|
|
379
|
+
}))
|
|
380
|
+
return
|
|
381
|
+
}
|
|
382
|
+
manageConversationContext(ctx)
|
|
383
|
+
await computeCustomInputs(ctx)
|
|
384
|
+
await runSteps(ctx)
|
|
385
|
+
return formatResult(ctx)
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* This registers a quick command event in the backend (analytics).
|
|
390
|
+
*/
|
|
391
|
+
async function registerAnalyticsEvent({ qc, isRemote, executionId, code = '', context }: QCContext, status: string, start: number) {
|
|
392
|
+
const now = new Date().getTime()
|
|
393
|
+
try {
|
|
394
|
+
await aiClient.createEvent.mutate({
|
|
395
|
+
body: [{
|
|
396
|
+
type: 'custom_quick_command_execution',
|
|
397
|
+
quick_command_event: {
|
|
398
|
+
type: qc.type || '',
|
|
399
|
+
duration_execution: now - start,
|
|
400
|
+
status_execution: status,
|
|
401
|
+
slug: qc.slug,
|
|
402
|
+
qc_execution_id: executionId,
|
|
403
|
+
id: qc.id,
|
|
404
|
+
//@ts-ignore
|
|
405
|
+
is_remote: isRemote,
|
|
406
|
+
},
|
|
407
|
+
code,
|
|
408
|
+
context,
|
|
409
|
+
knowledge_sources: [],
|
|
410
|
+
size: getSizeOfString(code),
|
|
411
|
+
generated_at: now,
|
|
412
|
+
}],
|
|
413
|
+
})
|
|
414
|
+
} catch (error) {
|
|
415
|
+
// eslint-disable-next-line no-console
|
|
416
|
+
console.warn('Failed to register event: quick command.')
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Writes the result in the chat or in the editor.
|
|
422
|
+
*/
|
|
423
|
+
function outputResult({ qc, chat, code }: QCContext, result: string) {
|
|
424
|
+
if (qc.return_type === 'CHAT') {
|
|
425
|
+
chat.pushMessage(new ChatEntry({
|
|
426
|
+
agentType: 'bot',
|
|
427
|
+
content: result,
|
|
428
|
+
agent: chat.get('agent'),
|
|
429
|
+
type: 'md',
|
|
430
|
+
updated: new Date().toISOString(),
|
|
431
|
+
}))
|
|
432
|
+
} else {
|
|
433
|
+
const editor = getEditor()?.getEditors()[0]
|
|
434
|
+
let finalCode = result
|
|
435
|
+
if (qc.return_type === 'BEFORE_CODE') finalCode = `${result}\n${code}`
|
|
436
|
+
else if (qc.return_type === 'AFTER_CODE') finalCode = `${code}\n${result}`
|
|
437
|
+
finalCode = finalCode.replace(/(\$[{a-z]|\})/g, '\\$1')
|
|
438
|
+
editor?.trigger('keyboard', 'type', { text: finalCode })
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* The chat interceptor itself.
|
|
444
|
+
* @param entry the chat entry.
|
|
445
|
+
* @param chat the chat state.
|
|
446
|
+
* @param signal a signal that can be canceled by the user.
|
|
447
|
+
* @returns false if, and only if, this entry (trimmed) matches the quick command regex. Undefined otherwise.
|
|
448
|
+
*/
|
|
449
|
+
async function quickCommandInterceptor(entry: ChatEntry, chat: ChatState, signal: AbortSignal) {
|
|
450
|
+
const { agentType, content } = entry.getValue()
|
|
451
|
+
if (!chat.get('features')?.quickCommands || agentType !== 'user' || !quickCommandRegex.test(content.trim())) return
|
|
452
|
+
const t = translate(dictionary)
|
|
453
|
+
const slug = content.trim().substring(1)
|
|
454
|
+
const ctx: QCContext = {
|
|
455
|
+
qc: { slug } as QuickCommandResponse,
|
|
456
|
+
chat,
|
|
457
|
+
code: chat.get('codeSelection'),
|
|
458
|
+
context: buildConversationContext(chat, entry) ?? {},
|
|
459
|
+
executionId: ulid(),
|
|
460
|
+
resultMap: {},
|
|
461
|
+
customInputs: {},
|
|
462
|
+
signal,
|
|
463
|
+
}
|
|
464
|
+
chat.set('isLoading', true)
|
|
465
|
+
const start = new Date().getTime()
|
|
466
|
+
try {
|
|
467
|
+
const result = await runQuickCommand(ctx)
|
|
468
|
+
if (result) {
|
|
469
|
+
outputResult(ctx, result)
|
|
470
|
+
registerAnalyticsEvent(ctx, '200', start)
|
|
471
|
+
}
|
|
472
|
+
} catch (error: any) {
|
|
473
|
+
let message = error.message || `${error}`
|
|
474
|
+
if (error instanceof AbortedError || error instanceof CancelledError) message = t.aborted
|
|
475
|
+
else if (error instanceof StackspotAPIError) message = error.translate()
|
|
476
|
+
ctx.chat.pushMessage(new ChatEntry({
|
|
477
|
+
agentType: 'bot',
|
|
478
|
+
content: '',
|
|
479
|
+
error: message,
|
|
480
|
+
agent: chat.get('agent'),
|
|
481
|
+
type: 'text',
|
|
482
|
+
}))
|
|
483
|
+
registerAnalyticsEvent(ctx, message, start)
|
|
484
|
+
}
|
|
485
|
+
ctx.chat.set('isLoading', false)
|
|
486
|
+
// prevents the next interceptors from running
|
|
487
|
+
return false
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
return quickCommandInterceptor
|
|
12
491
|
}
|
|
492
|
+
|
|
493
|
+
const dictionary = {
|
|
494
|
+
en: {
|
|
495
|
+
requiresSelection: 'Select the code in the editor next to it for this quick command to interact with it.',
|
|
496
|
+
startQuestioning: 'To execute the Quick Command "$0", I\'ll need you to provide some information. Some may be mandatory, and others optional. Let\'s get started.',
|
|
497
|
+
progress: 'Running step "$0" from Quick Command "$1".',
|
|
498
|
+
aborted: 'The quick command execution aborted by the user.',
|
|
499
|
+
notFound: 'There\'s no quick command with the provided name. If you don\'t wish to run a command, prefix the first "/" with a "\\".',
|
|
500
|
+
},
|
|
501
|
+
pt: {
|
|
502
|
+
requiresSelection: 'Selecione o código no editor ao lado para que este quick command possa interagir com ele.',
|
|
503
|
+
startQuestioning: 'Para executar o Quick Command "$0", vou precisar que você providencie algumas explicações. Algumas são obrigatórias e outras opcionais. Vamos começar.',
|
|
504
|
+
progress: 'Executando step "$0" do Quick Command "$1".',
|
|
505
|
+
aborted: 'A execução do quick command foi abortada pelo usuário.',
|
|
506
|
+
notFound: 'Não existe quick command com o nome providenciado. Se você não quiser rodar um comando, prefixe o primeiro "/" com um "\\".',
|
|
507
|
+
},
|
|
508
|
+
} satisfies Dictionary
|