@vertesia/ui 1.0.0-dev.20260128.144200 → 1.0.0-dev.20260225.024852Z
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/lib/esm/core/components/InputList.js +1 -1
- package/lib/esm/core/components/InputList.js.map +1 -1
- package/lib/esm/core/components/Overlay.js +1 -1
- package/lib/esm/core/components/Overlay.js.map +1 -1
- package/lib/esm/core/components/SidePanel.js +8 -2
- package/lib/esm/core/components/SidePanel.js.map +1 -1
- package/lib/esm/core/components/Switch.js +1 -1
- package/lib/esm/core/components/Switch.js.map +1 -1
- package/lib/esm/core/components/index.js +0 -8
- package/lib/esm/core/components/index.js.map +1 -1
- package/lib/esm/core/components/shadcn/MessageBox.js.map +1 -0
- package/lib/esm/core/components/shadcn/Panel.js +13 -0
- package/lib/esm/core/components/shadcn/Panel.js.map +1 -0
- package/lib/esm/core/components/{Badge.js → shadcn/badge.js} +2 -2
- package/lib/esm/core/components/shadcn/badge.js.map +1 -0
- package/lib/esm/core/components/shadcn/command.js +1 -1
- package/lib/esm/core/components/shadcn/command.js.map +1 -1
- package/lib/esm/core/components/shadcn/filters/filterBar.js +73 -83
- package/lib/esm/core/components/shadcn/filters/filterBar.js.map +1 -1
- package/lib/esm/core/components/shadcn/index.js +4 -2
- package/lib/esm/core/components/shadcn/index.js.map +1 -1
- package/lib/esm/core/components/shadcn/modal/ConfirmModal.js +10 -0
- package/lib/esm/core/components/shadcn/modal/ConfirmModal.js.map +1 -0
- package/lib/esm/core/components/{DeleteModal.js → shadcn/modal/DeleteModal.js} +1 -1
- package/lib/esm/core/components/shadcn/modal/DeleteModal.js.map +1 -0
- package/lib/esm/core/components/shadcn/{dialog.js → modal/dialog.js} +19 -15
- package/lib/esm/core/components/shadcn/modal/dialog.js.map +1 -0
- package/lib/esm/core/components/shadcn/modal/index.js +4 -0
- package/lib/esm/core/components/shadcn/modal/index.js.map +1 -0
- package/lib/esm/core/components/shadcn/popover.js +4 -2
- package/lib/esm/core/components/shadcn/popover.js.map +1 -1
- package/lib/esm/core/components/shadcn/selectBox.js +19 -15
- package/lib/esm/core/components/shadcn/selectBox.js.map +1 -1
- package/lib/esm/core/components/shadcn/tabs.js +16 -14
- package/lib/esm/core/components/shadcn/tabs.js.map +1 -1
- package/lib/esm/core/components/shadcn/textarea.js +30 -2
- package/lib/esm/core/components/shadcn/textarea.js.map +1 -1
- package/lib/esm/core/components/shadcn/tooltip.js +5 -1
- package/lib/esm/core/components/shadcn/tooltip.js.map +1 -1
- package/lib/esm/features/agent/PayloadBuilder.js +45 -0
- package/lib/esm/features/agent/PayloadBuilder.js.map +1 -1
- package/lib/esm/features/agent/chat/AgentChart.js +12 -232
- package/lib/esm/features/agent/chat/AgentChart.js.map +1 -1
- package/lib/esm/features/agent/chat/AskUserWidget.js +2 -1
- package/lib/esm/features/agent/chat/AskUserWidget.js.map +1 -1
- package/lib/esm/features/agent/chat/DocumentPanel.js +46 -0
- package/lib/esm/features/agent/chat/DocumentPanel.js.map +1 -0
- package/lib/esm/features/agent/chat/DocumentTabBar.js +17 -0
- package/lib/esm/features/agent/chat/DocumentTabBar.js.map +1 -0
- package/lib/esm/features/agent/chat/ModernAgentConversation.js +159 -402
- package/lib/esm/features/agent/chat/ModernAgentConversation.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js +99 -57
- package/lib/esm/features/agent/chat/ModernAgentOutput/AllMessagesMixed.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/BatchProgressPanel.js +4 -4
- package/lib/esm/features/agent/chat/ModernAgentOutput/BatchProgressPanel.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js +4 -4
- package/lib/esm/features/agent/chat/ModernAgentOutput/Header.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js +3 -3
- package/lib/esm/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/MessageInput.js +25 -22
- package/lib/esm/features/agent/chat/ModernAgentOutput/MessageInput.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js +110 -55
- package/lib/esm/features/agent/chat/ModernAgentOutput/MessageItem.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/StreamingMessage.js +2 -2
- package/lib/esm/features/agent/chat/ModernAgentOutput/StreamingMessage.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/ToolCallGroup.js +146 -55
- package/lib/esm/features/agent/chat/ModernAgentOutput/ToolCallGroup.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js +5 -6
- package/lib/esm/features/agent/chat/ModernAgentOutput/WorkstreamTabs.js.map +1 -1
- package/lib/esm/features/agent/chat/ModernAgentOutput/utils.js +110 -2
- package/lib/esm/features/agent/chat/ModernAgentOutput/utils.js.map +1 -1
- package/lib/esm/features/agent/chat/SkillWidgetProvider.js +28 -15
- package/lib/esm/features/agent/chat/SkillWidgetProvider.js.map +1 -1
- package/lib/esm/features/agent/chat/hooks/useAgentPlans.js +146 -0
- package/lib/esm/features/agent/chat/hooks/useAgentPlans.js.map +1 -0
- package/lib/esm/features/agent/chat/hooks/useAgentStream.js +180 -0
- package/lib/esm/features/agent/chat/hooks/useAgentStream.js.map +1 -0
- package/lib/esm/features/agent/chat/hooks/useDocumentPanel.js +100 -0
- package/lib/esm/features/agent/chat/hooks/useDocumentPanel.js.map +1 -0
- package/lib/esm/features/agent/chat/hooks/useFileProcessing.js +90 -0
- package/lib/esm/features/agent/chat/hooks/useFileProcessing.js.map +1 -0
- package/lib/esm/features/agent/chat/index.js +6 -5
- package/lib/esm/features/agent/chat/index.js.map +1 -1
- package/lib/esm/features/agent/chat/types/document.js +2 -0
- package/lib/esm/features/agent/chat/types/document.js.map +1 -0
- package/lib/esm/features/agent/index.js +0 -2
- package/lib/esm/features/agent/index.js.map +1 -1
- package/lib/esm/features/store/collections/BrowseCollectionView.js +4 -6
- package/lib/esm/features/store/collections/BrowseCollectionView.js.map +1 -1
- package/lib/esm/features/store/collections/CreateCollection.js +4 -4
- package/lib/esm/features/store/collections/CreateCollection.js.map +1 -1
- package/lib/esm/features/store/collections/EditCollectionView.js +1 -1
- package/lib/esm/features/store/collections/EditCollectionView.js.map +1 -1
- package/lib/esm/features/store/objects/DocumentSearchResults.js +5 -5
- package/lib/esm/features/store/objects/DocumentSearchResults.js.map +1 -1
- package/lib/esm/features/store/objects/ExportPropertiesModal.js +3 -3
- package/lib/esm/features/store/objects/ExportPropertiesModal.js.map +1 -1
- package/lib/esm/features/store/objects/components/ContentOverview.js +19 -120
- package/lib/esm/features/store/objects/components/ContentOverview.js.map +1 -1
- package/lib/esm/features/store/objects/components/PropertiesEditorModal.js +1 -1
- package/lib/esm/features/store/objects/components/PropertiesEditorModal.js.map +1 -1
- package/lib/esm/features/store/objects/components/SelectDocumentModal.js +2 -2
- package/lib/esm/features/store/objects/components/SelectDocumentModal.js.map +1 -1
- package/lib/esm/features/store/objects/components/VectorSearchWidget.js +1 -1
- package/lib/esm/features/store/objects/components/VectorSearchWidget.js.map +1 -1
- package/lib/esm/features/store/objects/components/index.js +1 -1
- package/lib/esm/features/store/objects/components/index.js.map +1 -1
- package/lib/esm/features/store/objects/components/useDownloadFile.js +192 -0
- package/lib/esm/features/store/objects/components/useDownloadFile.js.map +1 -0
- package/lib/esm/features/store/objects/search/DocumentSearchContext.js +1 -2
- package/lib/esm/features/store/objects/search/DocumentSearchContext.js.map +1 -1
- package/lib/esm/features/store/objects/selection/SelectionActions.js +5 -8
- package/lib/esm/features/store/objects/selection/SelectionActions.js.map +1 -1
- package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js +4 -4
- package/lib/esm/features/store/objects/selection/actions/AddToCollectionAction.js.map +1 -1
- package/lib/esm/features/store/objects/selection/actions/ChangeTypeAction.js +2 -2
- package/lib/esm/features/store/objects/selection/actions/ChangeTypeAction.js.map +1 -1
- package/lib/esm/features/store/objects/selection/actions/ExportPropertiesAction.js +1 -1
- package/lib/esm/features/store/objects/selection/actions/ExportPropertiesAction.js.map +1 -1
- package/lib/esm/features/store/objects/selection/actions/StartWorkflowComponent.js +3 -3
- package/lib/esm/features/store/objects/selection/actions/StartWorkflowComponent.js.map +1 -1
- package/lib/esm/features/store/objects/upload/DocumentUploadModal.js +13 -13
- package/lib/esm/features/store/objects/upload/DocumentUploadModal.js.map +1 -1
- package/lib/esm/features/store/objects/upload/useSmartFileUploadProcessing.js +15 -8
- package/lib/esm/features/store/objects/upload/useSmartFileUploadProcessing.js.map +1 -1
- package/lib/esm/features/store/types/ObjectSchemaEditor.js +6 -5
- package/lib/esm/features/store/types/ObjectSchemaEditor.js.map +1 -1
- package/lib/esm/features/store/types/SelectContentType.js +3 -3
- package/lib/esm/features/store/types/SelectContentType.js.map +1 -1
- package/lib/esm/features/store/types/SelectContentTypeModal.js +5 -4
- package/lib/esm/features/store/types/SelectContentTypeModal.js.map +1 -1
- package/lib/esm/features/store/types/TableLayoutEditor.js +4 -4
- package/lib/esm/features/store/types/TableLayoutEditor.js.map +1 -1
- package/lib/esm/features/user/UserInfo.js +73 -9
- package/lib/esm/features/user/UserInfo.js.map +1 -1
- package/lib/esm/features/utils/print.js +0 -1
- package/lib/esm/features/utils/print.js.map +1 -1
- package/lib/esm/layout/AppLayout.js +3 -4
- package/lib/esm/layout/AppLayout.js.map +1 -1
- package/lib/esm/layout/Sidebar.js +5 -5
- package/lib/esm/layout/Sidebar.js.map +1 -1
- package/lib/esm/router/HistoryNavigator.js +7 -1
- package/lib/esm/router/HistoryNavigator.js.map +1 -1
- package/lib/esm/router/Nav.js +2 -2
- package/lib/esm/router/Nav.js.map +1 -1
- package/lib/esm/session/UserSession.js +35 -9
- package/lib/esm/session/UserSession.js.map +1 -1
- package/lib/esm/session/UserSessionProvider.js +3 -2
- package/lib/esm/session/UserSessionProvider.js.map +1 -1
- package/lib/esm/shell/apps/AppProjectSelector.js +2 -2
- package/lib/esm/shell/apps/AppProjectSelector.js.map +1 -1
- package/lib/esm/shell/apps/StandaloneApp.js +2 -2
- package/lib/esm/shell/apps/StandaloneApp.js.map +1 -1
- package/lib/esm/shell/login/InviteAcceptModal.js +2 -2
- package/lib/esm/shell/login/InviteAcceptModal.js.map +1 -1
- package/lib/esm/shell/login/SignInModal.js +1 -1
- package/lib/esm/shell/login/SignInModal.js.map +1 -1
- package/lib/esm/shell/login/SignupForm.js +2 -2
- package/lib/esm/shell/login/SignupForm.js.map +1 -1
- package/lib/esm/shell/login/UserInfo.js +2 -2
- package/lib/esm/shell/login/UserInfo.js.map +1 -1
- package/lib/esm/widgets/json-view/JSONCode.js +1 -1
- package/lib/esm/widgets/json-view/JSONCode.js.map +1 -1
- package/lib/esm/widgets/json-view/JSONDisplay.js +1 -1
- package/lib/esm/widgets/json-view/JSONDisplay.js.map +1 -1
- package/lib/esm/widgets/markdown/ArtifactContentRenderer.js +84 -13
- package/lib/esm/widgets/markdown/ArtifactContentRenderer.js.map +1 -1
- package/lib/esm/widgets/markdown/MarkdownFigure.js +40 -0
- package/lib/esm/widgets/markdown/MarkdownFigure.js.map +1 -0
- package/lib/esm/widgets/markdown/MarkdownRenderer.js +42 -7
- package/lib/esm/widgets/markdown/MarkdownRenderer.js.map +1 -1
- package/lib/esm/widgets/markdown/MermaidDiagram.js +80 -5
- package/lib/esm/widgets/markdown/MermaidDiagram.js.map +1 -1
- package/lib/esm/widgets/markdown/codeBlockHandlers.js +33 -33
- package/lib/esm/widgets/markdown/codeBlockHandlers.js.map +1 -1
- package/lib/esm/widgets/markdown/codeBlockHandlers.test.js +2 -29
- package/lib/esm/widgets/markdown/codeBlockHandlers.test.js.map +1 -1
- package/lib/esm/widgets/markdown/index.js +1 -0
- package/lib/esm/widgets/markdown/index.js.map +1 -1
- package/lib/esm/widgets/markdown/normalizeCustomSchemeLinks.js +77 -0
- package/lib/esm/widgets/markdown/normalizeCustomSchemeLinks.js.map +1 -0
- package/lib/esm/widgets/markdown/normalizeDirectives.js +45 -0
- package/lib/esm/widgets/markdown/normalizeDirectives.js.map +1 -0
- package/lib/esm/widgets/markdown/remarkDirectiveHandler.js +96 -0
- package/lib/esm/widgets/markdown/remarkDirectiveHandler.js.map +1 -0
- package/lib/esm/widgets/monacoEditor/MonacoEditor.js +8 -14
- package/lib/esm/widgets/monacoEditor/MonacoEditor.js.map +1 -1
- package/lib/esm/widgets/schema-editor/ManagedSchema.js.map +1 -1
- package/lib/esm/widgets/schema-editor/editor/PropertyEditor.js +3 -3
- package/lib/esm/widgets/schema-editor/editor/PropertyEditor.js.map +1 -1
- package/lib/esm/widgets/schema-editor/json-schema4-utils.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/core/components/SidePanel.d.ts +4 -1
- package/lib/types/core/components/SidePanel.d.ts.map +1 -1
- package/lib/types/core/components/index.d.ts +0 -8
- package/lib/types/core/components/index.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/MessageBox.d.ts.map +1 -0
- package/lib/types/core/components/{Panel.d.ts → shadcn/Panel.d.ts} +3 -1
- package/lib/types/core/components/shadcn/Panel.d.ts.map +1 -0
- package/lib/types/core/components/{Badge.d.ts → shadcn/badge.d.ts} +4 -4
- package/lib/types/core/components/shadcn/badge.d.ts.map +1 -0
- package/lib/types/core/components/shadcn/button.d.ts +1 -1
- package/lib/types/core/components/shadcn/filters/filterBar.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/index.d.ts +4 -2
- package/lib/types/core/components/shadcn/index.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/input.d.ts +1 -1
- package/lib/types/core/components/shadcn/modal/ConfirmModal.d.ts.map +1 -0
- package/lib/types/core/components/shadcn/modal/DeleteModal.d.ts.map +1 -0
- package/lib/types/core/components/shadcn/{dialog.d.ts → modal/dialog.d.ts} +7 -4
- package/lib/types/core/components/shadcn/modal/dialog.d.ts.map +1 -0
- package/lib/types/core/components/shadcn/modal/index.d.ts +4 -0
- package/lib/types/core/components/shadcn/modal/index.d.ts.map +1 -0
- package/lib/types/core/components/shadcn/popover.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/selectBox.d.ts +9 -5
- package/lib/types/core/components/shadcn/selectBox.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/tabs.d.ts +14 -5
- package/lib/types/core/components/shadcn/tabs.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/textarea.d.ts +6 -2
- package/lib/types/core/components/shadcn/textarea.d.ts.map +1 -1
- package/lib/types/core/components/shadcn/tooltip.d.ts.map +1 -1
- package/lib/types/features/agent/PayloadBuilder.d.ts +22 -4
- package/lib/types/features/agent/PayloadBuilder.d.ts.map +1 -1
- package/lib/types/features/agent/chat/AgentChart.d.ts +3 -44
- package/lib/types/features/agent/chat/AgentChart.d.ts.map +1 -1
- package/lib/types/features/agent/chat/AskUserWidget.d.ts.map +1 -1
- package/lib/types/features/agent/chat/DocumentPanel.d.ts +16 -0
- package/lib/types/features/agent/chat/DocumentPanel.d.ts.map +1 -0
- package/lib/types/features/agent/chat/DocumentTabBar.d.ts +10 -0
- package/lib/types/features/agent/chat/DocumentTabBar.d.ts.map +1 -0
- package/lib/types/features/agent/chat/ModernAgentConversation.d.ts +69 -1
- package/lib/types/features/agent/chat/ModernAgentConversation.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts +36 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/AllMessagesMixed.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/BatchProgressPanel.d.ts +18 -2
- package/lib/types/features/agent/chat/ModernAgentOutput/BatchProgressPanel.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/Header.d.ts +4 -7
- package/lib/types/features/agent/chat/ModernAgentOutput/Header.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/MessageInput.d.ts +2 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/MessageInput.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/MessageItem.d.ts +35 -7
- package/lib/types/features/agent/chat/ModernAgentOutput/MessageItem.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/StreamingMessage.d.ts +11 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/StreamingMessage.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/ToolCallGroup.d.ts +20 -2
- package/lib/types/features/agent/chat/ModernAgentOutput/ToolCallGroup.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/WorkstreamTabs.d.ts.map +1 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/utils.d.ts +18 -1
- package/lib/types/features/agent/chat/ModernAgentOutput/utils.d.ts.map +1 -1
- package/lib/types/features/agent/chat/SkillWidgetProvider.d.ts.map +1 -1
- package/lib/types/features/agent/chat/hooks/useAgentPlans.d.ts +22 -0
- package/lib/types/features/agent/chat/hooks/useAgentPlans.d.ts.map +1 -0
- package/lib/types/features/agent/chat/hooks/useAgentStream.d.ts +42 -0
- package/lib/types/features/agent/chat/hooks/useAgentStream.d.ts.map +1 -0
- package/lib/types/features/agent/chat/hooks/useDocumentPanel.d.ts +22 -0
- package/lib/types/features/agent/chat/hooks/useDocumentPanel.d.ts.map +1 -0
- package/lib/types/features/agent/chat/hooks/useFileProcessing.d.ts +27 -0
- package/lib/types/features/agent/chat/hooks/useFileProcessing.d.ts.map +1 -0
- package/lib/types/features/agent/chat/index.d.ts +12 -8
- package/lib/types/features/agent/chat/index.d.ts.map +1 -1
- package/lib/types/features/agent/chat/types/document.d.ts +5 -0
- package/lib/types/features/agent/chat/types/document.d.ts.map +1 -0
- package/lib/types/features/agent/index.d.ts +0 -2
- package/lib/types/features/agent/index.d.ts.map +1 -1
- package/lib/types/features/store/collections/BrowseCollectionView.d.ts.map +1 -1
- package/lib/types/features/store/objects/ExportPropertiesModal.d.ts.map +1 -1
- package/lib/types/features/store/objects/components/ContentOverview.d.ts.map +1 -1
- package/lib/types/features/store/objects/components/PropertiesEditorModal.d.ts.map +1 -1
- package/lib/types/features/store/objects/components/index.d.ts +1 -1
- package/lib/types/features/store/objects/components/index.d.ts.map +1 -1
- package/lib/types/features/store/objects/components/useDownloadFile.d.ts +35 -0
- package/lib/types/features/store/objects/components/useDownloadFile.d.ts.map +1 -0
- package/lib/types/features/store/objects/search/DocumentSearchContext.d.ts.map +1 -1
- package/lib/types/features/store/objects/selection/SelectionActions.d.ts +1 -1
- package/lib/types/features/store/objects/selection/SelectionActions.d.ts.map +1 -1
- package/lib/types/features/store/objects/selection/actions/ChangeTypeAction.d.ts.map +1 -1
- package/lib/types/features/store/objects/selection/actions/ExportPropertiesAction.d.ts.map +1 -1
- package/lib/types/features/store/objects/upload/useSmartFileUploadProcessing.d.ts.map +1 -1
- package/lib/types/features/store/types/ObjectSchemaEditor.d.ts +2 -1
- package/lib/types/features/store/types/ObjectSchemaEditor.d.ts.map +1 -1
- package/lib/types/features/store/types/SelectContentTypeModal.d.ts +1 -1
- package/lib/types/features/store/types/SelectContentTypeModal.d.ts.map +1 -1
- package/lib/types/features/store/types/TableLayoutEditor.d.ts +2 -1
- package/lib/types/features/store/types/TableLayoutEditor.d.ts.map +1 -1
- package/lib/types/features/user/UserInfo.d.ts +12 -1
- package/lib/types/features/user/UserInfo.d.ts.map +1 -1
- package/lib/types/features/utils/print.d.ts.map +1 -1
- package/lib/types/layout/AppLayout.d.ts.map +1 -1
- package/lib/types/layout/Sidebar.d.ts +4 -2
- package/lib/types/layout/Sidebar.d.ts.map +1 -1
- package/lib/types/router/HistoryNavigator.d.ts.map +1 -1
- package/lib/types/router/Nav.d.ts +6 -1
- package/lib/types/router/Nav.d.ts.map +1 -1
- package/lib/types/session/UserSession.d.ts.map +1 -1
- package/lib/types/session/UserSessionProvider.d.ts +1 -0
- package/lib/types/session/UserSessionProvider.d.ts.map +1 -1
- package/lib/types/widgets/json-view/JSONCode.d.ts.map +1 -1
- package/lib/types/widgets/markdown/ArtifactContentRenderer.d.ts +10 -1
- package/lib/types/widgets/markdown/ArtifactContentRenderer.d.ts.map +1 -1
- package/lib/types/widgets/markdown/MarkdownFigure.d.ts +15 -0
- package/lib/types/widgets/markdown/MarkdownFigure.d.ts.map +1 -0
- package/lib/types/widgets/markdown/MarkdownRenderer.d.ts.map +1 -1
- package/lib/types/widgets/markdown/MermaidDiagram.d.ts.map +1 -1
- package/lib/types/widgets/markdown/codeBlockHandlers.d.ts +5 -2
- package/lib/types/widgets/markdown/codeBlockHandlers.d.ts.map +1 -1
- package/lib/types/widgets/markdown/index.d.ts +1 -0
- package/lib/types/widgets/markdown/index.d.ts.map +1 -1
- package/lib/types/widgets/markdown/normalizeCustomSchemeLinks.d.ts +9 -0
- package/lib/types/widgets/markdown/normalizeCustomSchemeLinks.d.ts.map +1 -0
- package/lib/types/widgets/markdown/normalizeDirectives.d.ts +20 -0
- package/lib/types/widgets/markdown/normalizeDirectives.d.ts.map +1 -0
- package/lib/types/widgets/markdown/remarkDirectiveHandler.d.ts +2 -0
- package/lib/types/widgets/markdown/remarkDirectiveHandler.d.ts.map +1 -0
- package/lib/types/widgets/monacoEditor/MonacoEditor.d.ts +1 -3
- package/lib/types/widgets/monacoEditor/MonacoEditor.d.ts.map +1 -1
- package/lib/types/widgets/schema-editor/ManagedSchema.d.ts +1 -1
- package/lib/types/widgets/schema-editor/ManagedSchema.d.ts.map +1 -1
- package/lib/vertesia-ui-core.js +1 -1
- package/lib/vertesia-ui-core.js.map +1 -1
- package/lib/vertesia-ui-features.js +1 -1
- package/lib/vertesia-ui-features.js.map +1 -1
- package/lib/vertesia-ui-layout.js +1 -1
- package/lib/vertesia-ui-layout.js.map +1 -1
- package/lib/vertesia-ui-router.js +1 -1
- package/lib/vertesia-ui-router.js.map +1 -1
- package/lib/vertesia-ui-session.js +1 -1
- package/lib/vertesia-ui-session.js.map +1 -1
- package/lib/vertesia-ui-shell.js +1 -1
- package/lib/vertesia-ui-shell.js.map +1 -1
- package/lib/vertesia-ui-widgets.js +1 -1
- package/lib/vertesia-ui-widgets.js.map +1 -1
- package/package.json +14 -10
- package/src/core/components/InputList.tsx +1 -1
- package/src/core/components/Overlay.tsx +1 -1
- package/src/core/components/SidePanel.tsx +29 -15
- package/src/core/components/Switch.tsx +1 -1
- package/src/core/components/index.ts +0 -8
- package/src/core/components/shadcn/Panel.tsx +50 -0
- package/src/core/components/{Badge.tsx → shadcn/badge.tsx} +3 -3
- package/src/core/components/shadcn/command.tsx +1 -1
- package/src/core/components/shadcn/filters/filterBar.tsx +76 -87
- package/src/core/components/shadcn/index.ts +5 -3
- package/src/core/components/{ConfirmModal.tsx → shadcn/modal/ConfirmModal.tsx} +8 -8
- package/src/core/components/{DeleteModal.tsx → shadcn/modal/DeleteModal.tsx} +1 -1
- package/src/core/components/shadcn/{dialog.tsx → modal/dialog.tsx} +43 -32
- package/src/core/components/shadcn/modal/index.ts +3 -0
- package/src/core/components/shadcn/popover.tsx +4 -2
- package/src/core/components/shadcn/selectBox.tsx +71 -52
- package/src/core/components/shadcn/tabs.tsx +36 -19
- package/src/core/components/shadcn/textarea.tsx +43 -2
- package/src/core/components/shadcn/tooltip.tsx +23 -17
- package/src/features/agent/PayloadBuilder.tsx +70 -9
- package/src/features/agent/chat/AgentChart.tsx +46 -678
- package/src/features/agent/chat/AskUserWidget.tsx +4 -3
- package/src/features/agent/chat/DocumentPanel.tsx +120 -0
- package/src/features/agent/chat/DocumentTabBar.tsx +49 -0
- package/src/features/agent/chat/ModernAgentConversation.tsx +403 -549
- package/src/features/agent/chat/ModernAgentOutput/AllMessagesMixed.tsx +162 -55
- package/src/features/agent/chat/ModernAgentOutput/BatchProgressPanel.tsx +40 -10
- package/src/features/agent/chat/ModernAgentOutput/Header.tsx +12 -16
- package/src/features/agent/chat/ModernAgentOutput/InlineSlidingPlanPanel.tsx +3 -3
- package/src/features/agent/chat/ModernAgentOutput/MessageInput.tsx +68 -75
- package/src/features/agent/chat/ModernAgentOutput/MessageItem.tsx +206 -94
- package/src/features/agent/chat/ModernAgentOutput/StreamingMessage.tsx +22 -5
- package/src/features/agent/chat/ModernAgentOutput/ToolCallGroup.tsx +295 -113
- package/src/features/agent/chat/ModernAgentOutput/WorkstreamTabs.tsx +11 -8
- package/src/features/agent/chat/ModernAgentOutput/utils.ts +133 -4
- package/src/features/agent/chat/SkillWidgetProvider.tsx +32 -15
- package/src/features/agent/chat/hooks/useAgentPlans.ts +190 -0
- package/src/features/agent/chat/hooks/useAgentStream.ts +239 -0
- package/src/features/agent/chat/hooks/useDocumentPanel.ts +118 -0
- package/src/features/agent/chat/hooks/useFileProcessing.ts +126 -0
- package/src/features/agent/chat/index.ts +18 -17
- package/src/features/agent/chat/types/document.ts +4 -0
- package/src/features/agent/index.ts +0 -2
- package/src/features/store/collections/BrowseCollectionView.tsx +5 -8
- package/src/features/store/collections/CreateCollection.tsx +8 -8
- package/src/features/store/collections/EditCollectionView.tsx +1 -1
- package/src/features/store/objects/DocumentSearchResults.tsx +9 -13
- package/src/features/store/objects/ExportPropertiesModal.tsx +9 -7
- package/src/features/store/objects/components/ContentOverview.tsx +29 -155
- package/src/features/store/objects/components/PropertiesEditorModal.tsx +0 -1
- package/src/features/store/objects/components/SelectDocumentModal.tsx +6 -6
- package/src/features/store/objects/components/VectorSearchWidget.tsx +2 -2
- package/src/features/store/objects/components/index.ts +1 -1
- package/src/features/store/objects/components/useDownloadFile.ts +237 -0
- package/src/features/store/objects/search/DocumentSearchContext.ts +1 -2
- package/src/features/store/objects/selection/SelectionActions.tsx +0 -4
- package/src/features/store/objects/selection/actions/AddToCollectionAction.tsx +13 -13
- package/src/features/store/objects/selection/actions/ChangeTypeAction.tsx +2 -6
- package/src/features/store/objects/selection/actions/ExportPropertiesAction.tsx +1 -3
- package/src/features/store/objects/selection/actions/StartWorkflowComponent.tsx +8 -8
- package/src/features/store/objects/upload/DocumentUploadModal.tsx +25 -25
- package/src/features/store/objects/upload/useSmartFileUploadProcessing.ts +16 -10
- package/src/features/store/types/ObjectSchemaEditor.tsx +32 -29
- package/src/features/store/types/SelectContentType.tsx +3 -3
- package/src/features/store/types/SelectContentTypeModal.tsx +17 -30
- package/src/features/store/types/TableLayoutEditor.tsx +14 -18
- package/src/features/user/UserInfo.tsx +176 -10
- package/src/features/utils/print.ts +0 -1
- package/src/layout/AppLayout.tsx +16 -44
- package/src/layout/Sidebar.tsx +7 -5
- package/src/router/HistoryNavigator.ts +9 -1
- package/src/router/Nav.tsx +7 -2
- package/src/session/UserSession.ts +38 -9
- package/src/session/UserSessionProvider.tsx +3 -2
- package/src/shell/apps/AppProjectSelector.tsx +2 -2
- package/src/shell/apps/StandaloneApp.tsx +3 -3
- package/src/shell/login/InviteAcceptModal.tsx +6 -6
- package/src/shell/login/SignInModal.tsx +1 -1
- package/src/shell/login/SignupForm.tsx +3 -3
- package/src/shell/login/UserInfo.tsx +5 -5
- package/src/widgets/json-view/JSONCode.tsx +1 -3
- package/src/widgets/json-view/JSONDisplay.tsx +1 -1
- package/src/widgets/markdown/ArtifactContentRenderer.tsx +115 -14
- package/src/widgets/markdown/MarkdownFigure.tsx +100 -0
- package/src/widgets/markdown/MarkdownRenderer.tsx +62 -9
- package/src/widgets/markdown/MermaidDiagram.tsx +97 -5
- package/src/widgets/markdown/codeBlockHandlers.test.tsx +3 -34
- package/src/widgets/markdown/codeBlockHandlers.tsx +47 -42
- package/src/widgets/markdown/index.ts +1 -0
- package/src/widgets/markdown/markdown.css +192 -0
- package/src/widgets/markdown/normalizeCustomSchemeLinks.test.ts +86 -0
- package/src/widgets/markdown/normalizeCustomSchemeLinks.ts +91 -0
- package/src/widgets/markdown/normalizeDirectives.ts +50 -0
- package/src/widgets/markdown/remarkDirectiveHandler.ts +119 -0
- package/src/widgets/monacoEditor/MonacoEditor.tsx +8 -22
- package/src/widgets/schema-editor/ManagedSchema.ts +1 -1
- package/src/widgets/schema-editor/editor/PropertyEditor.tsx +5 -5
- package/src/widgets/schema-editor/json-schema4-utils.ts +1 -1
- package/lib/esm/core/components/Badge.js.map +0 -1
- package/lib/esm/core/components/Button.js +0 -32
- package/lib/esm/core/components/Button.js.map +0 -1
- package/lib/esm/core/components/ConfirmModal.js +0 -10
- package/lib/esm/core/components/ConfirmModal.js.map +0 -1
- package/lib/esm/core/components/DeleteModal.js.map +0 -1
- package/lib/esm/core/components/MessageBox.js.map +0 -1
- package/lib/esm/core/components/Modal.js +0 -26
- package/lib/esm/core/components/Modal.js.map +0 -1
- package/lib/esm/core/components/Panel.js +0 -8
- package/lib/esm/core/components/Panel.js.map +0 -1
- package/lib/esm/core/components/SelectBox.js +0 -67
- package/lib/esm/core/components/SelectBox.js.map +0 -1
- package/lib/esm/core/components/shadcn/dialog.js.map +0 -1
- package/lib/esm/core/components/tabs/Tabs.js +0 -78
- package/lib/esm/core/components/tabs/Tabs.js.map +0 -1
- package/lib/esm/core/components/tabs/TabsContext.js +0 -7
- package/lib/esm/core/components/tabs/TabsContext.js.map +0 -1
- package/lib/esm/core/components/tabs/index.js +0 -3
- package/lib/esm/core/components/tabs/index.js.map +0 -1
- package/lib/esm/features/agent/createChartTool.js +0 -632
- package/lib/esm/features/agent/createChartTool.js.map +0 -1
- package/lib/esm/features/agent/examples.js +0 -295
- package/lib/esm/features/agent/examples.js.map +0 -1
- package/lib/esm/features/agent/visualization.js +0 -165
- package/lib/esm/features/agent/visualization.js.map +0 -1
- package/lib/esm/features/store/objects/components/useDownloadObject.js +0 -21
- package/lib/esm/features/store/objects/components/useDownloadObject.js.map +0 -1
- package/lib/types/core/components/Badge.d.ts.map +0 -1
- package/lib/types/core/components/Button.d.ts +0 -14
- package/lib/types/core/components/Button.d.ts.map +0 -1
- package/lib/types/core/components/ConfirmModal.d.ts.map +0 -1
- package/lib/types/core/components/DeleteModal.d.ts.map +0 -1
- package/lib/types/core/components/MessageBox.d.ts.map +0 -1
- package/lib/types/core/components/Modal.d.ts +0 -30
- package/lib/types/core/components/Modal.d.ts.map +0 -1
- package/lib/types/core/components/Panel.d.ts.map +0 -1
- package/lib/types/core/components/SelectBox.d.ts +0 -36
- package/lib/types/core/components/SelectBox.d.ts.map +0 -1
- package/lib/types/core/components/shadcn/dialog.d.ts.map +0 -1
- package/lib/types/core/components/tabs/Tabs.d.ts +0 -25
- package/lib/types/core/components/tabs/Tabs.d.ts.map +0 -1
- package/lib/types/core/components/tabs/TabsContext.d.ts +0 -17
- package/lib/types/core/components/tabs/TabsContext.d.ts.map +0 -1
- package/lib/types/core/components/tabs/index.d.ts +0 -3
- package/lib/types/core/components/tabs/index.d.ts.map +0 -1
- package/lib/types/features/agent/createChartTool.d.ts +0 -178
- package/lib/types/features/agent/createChartTool.d.ts.map +0 -1
- package/lib/types/features/agent/examples.d.ts +0 -59
- package/lib/types/features/agent/examples.d.ts.map +0 -1
- package/lib/types/features/agent/visualization.d.ts +0 -95
- package/lib/types/features/agent/visualization.d.ts.map +0 -1
- package/lib/types/features/store/objects/components/useDownloadObject.d.ts +0 -4
- package/lib/types/features/store/objects/components/useDownloadObject.d.ts.map +0 -1
- package/src/core/components/Button.tsx +0 -63
- package/src/core/components/Modal.tsx +0 -144
- package/src/core/components/Panel.tsx +0 -34
- package/src/core/components/SelectBox.tsx +0 -188
- package/src/core/components/tabs/Tabs.tsx +0 -132
- package/src/core/components/tabs/TabsContext.ts +0 -25
- package/src/core/components/tabs/index.ts +0 -2
- package/src/features/agent/CHART_INSTRUCTIONS.md +0 -228
- package/src/features/agent/createChartTool.ts +0 -643
- package/src/features/agent/examples.ts +0 -321
- package/src/features/agent/visualization.ts +0 -227
- package/src/features/store/objects/components/useDownloadObject.ts +0 -29
- /package/lib/esm/core/components/{MessageBox.js → shadcn/MessageBox.js} +0 -0
- /package/lib/types/core/components/{MessageBox.d.ts → shadcn/MessageBox.d.ts} +0 -0
- /package/lib/types/core/components/{ConfirmModal.d.ts → shadcn/modal/ConfirmModal.d.ts} +0 -0
- /package/lib/types/core/components/{DeleteModal.d.ts → shadcn/modal/DeleteModal.d.ts} +0 -0
- /package/src/core/components/{MessageBox.tsx → shadcn/MessageBox.tsx} +0 -0
|
@@ -2,20 +2,25 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { Bot, Cpu, FileTextIcon, SendIcon, UploadIcon, XIcon } from "lucide-react";
|
|
4
4
|
import { useUserSession } from "@vertesia/ui/session";
|
|
5
|
-
import { AgentMessageType,
|
|
5
|
+
import { AgentMessageType, } from "@vertesia/common";
|
|
6
6
|
import { FusionFragmentProvider } from "@vertesia/fusion-ux";
|
|
7
|
-
import { Button, MessageBox, Spinner, useToast,
|
|
7
|
+
import { Button, cn, MessageBox, Spinner, useToast, Modal, ModalBody, ModalFooter, ModalTitle } from "@vertesia/ui/core";
|
|
8
8
|
import { AnimatedThinkingDots, PulsatingCircle } from "./AnimatedThinkingDots";
|
|
9
9
|
import { ImageLightboxProvider } from "./ImageLightbox";
|
|
10
10
|
import AllMessagesMixed from "./ModernAgentOutput/AllMessagesMixed";
|
|
11
11
|
import Header from "./ModernAgentOutput/Header";
|
|
12
12
|
import MessageInput from "./ModernAgentOutput/MessageInput";
|
|
13
|
-
import { getWorkstreamId
|
|
13
|
+
import { getWorkstreamId } from "./ModernAgentOutput/utils";
|
|
14
14
|
import { ThinkingMessages } from "./WaitingMessages";
|
|
15
15
|
import InlineSlidingPlanPanel from "./ModernAgentOutput/InlineSlidingPlanPanel";
|
|
16
16
|
import { SkillWidgetProvider } from "./SkillWidgetProvider";
|
|
17
17
|
import { ArtifactUrlCacheProvider } from "./useArtifactUrlCache.js";
|
|
18
18
|
import { VegaLiteChart } from "./VegaLiteChart";
|
|
19
|
+
import { DocumentPanel } from "./DocumentPanel.js";
|
|
20
|
+
import { useAgentStream } from "./hooks/useAgentStream.js";
|
|
21
|
+
import { useAgentPlans } from "./hooks/useAgentPlans.js";
|
|
22
|
+
import { useDocumentPanel } from "./hooks/useDocumentPanel.js";
|
|
23
|
+
import { useFileProcessing } from "./hooks/useFileProcessing.js";
|
|
19
24
|
function printElementToPdf(sourceElement, title) {
|
|
20
25
|
if (typeof window === "undefined" || typeof document === "undefined") {
|
|
21
26
|
return false;
|
|
@@ -166,12 +171,12 @@ acceptedFileTypes = ".pdf,.doc,.docx,.txt,.csv,.xlsx,.xls,.png,.jpg,.jpeg,.gif,.
|
|
|
166
171
|
status: "info",
|
|
167
172
|
duration: 3000,
|
|
168
173
|
});
|
|
169
|
-
// Get attached
|
|
174
|
+
// Get attached documents if callback provided
|
|
170
175
|
const attachedDocs = getAttachedDocs?.() || [];
|
|
171
|
-
// Build message content with attachment references
|
|
176
|
+
// Build message content with attachment references as markdown links
|
|
172
177
|
let messageContent = message;
|
|
173
178
|
if (attachedDocs.length > 0 && !/store:\S+/.test(message)) {
|
|
174
|
-
const lines = attachedDocs.map((
|
|
179
|
+
const lines = attachedDocs.map((doc) => `[${doc.name}](/store/objects/${doc.id})`);
|
|
175
180
|
messageContent = [message, '', 'Attachments:', ...lines].join('\n');
|
|
176
181
|
}
|
|
177
182
|
// If files are staged, add a note to the message so the agent knows files are coming
|
|
@@ -284,6 +289,8 @@ uploadedFiles, onRemoveFile, acceptedFileTypes, maxFiles,
|
|
|
284
289
|
renderDocumentSearch, selectedDocuments, onRemoveDocument,
|
|
285
290
|
// Object linking
|
|
286
291
|
hideObjectLinking,
|
|
292
|
+
// Section visibility
|
|
293
|
+
hideHeader, hideMessageInput, hidePlanPanel, hideWorkstreamTabs, hideFileUpload, hideDocumentPanel,
|
|
287
294
|
// Attachment callback
|
|
288
295
|
getAttachedDocs, onAttachmentsSent,
|
|
289
296
|
// Upload state
|
|
@@ -291,55 +298,71 @@ isUploading = false,
|
|
|
291
298
|
// Context callback
|
|
292
299
|
getMessageContext,
|
|
293
300
|
// Styling props
|
|
294
|
-
inputContainerClassName, inputClassName,
|
|
301
|
+
className, inputContainerClassName, inputClassName,
|
|
295
302
|
// Fusion fragment data
|
|
296
|
-
fusionData,
|
|
303
|
+
fusionData,
|
|
304
|
+
// External file upload API
|
|
305
|
+
fileUploadRef, onProcessingFilesChange,
|
|
306
|
+
// External plan panel API
|
|
307
|
+
onPlansChange, onWorkstreamStatusChange,
|
|
308
|
+
// External view mode control
|
|
309
|
+
viewMode: controlledViewMode, onViewModeChange: onViewModeChangeProp, onShowInputChange,
|
|
310
|
+
// External stop API
|
|
311
|
+
stopRef, onStoppingChange,
|
|
312
|
+
// MessageItem className/style overrides
|
|
313
|
+
messageItemClassNames, messageStyleOverrides,
|
|
314
|
+
// ToolCallGroup className overrides + view mode visibility
|
|
315
|
+
toolCallGroupClassNames, hideToolCallsInViewMode,
|
|
316
|
+
// StreamingMessage className overrides
|
|
317
|
+
streamingMessageClassNames,
|
|
318
|
+
// BatchProgressPanel className overrides
|
|
319
|
+
batchProgressPanelClassNames,
|
|
320
|
+
// AllMessagesMixed className overrides
|
|
321
|
+
workingIndicatorClassName, messageListClassName, StoreLinkComponent, CollectionLinkComponent, prependFriendlyMessage, }) {
|
|
297
322
|
const { client } = useUserSession();
|
|
323
|
+
const toast = useToast();
|
|
324
|
+
// ────────────────────────────────────────────
|
|
325
|
+
// Extracted hooks
|
|
326
|
+
// ────────────────────────────────────────────
|
|
327
|
+
const { messages, streamingMessages, isCompleted, debugChunkFlash, addOptimisticMessage, removeOptimisticMessages, workflowStatus, serverFileUpdates, } = useAgentStream(client, run);
|
|
328
|
+
const { plans, activePlanIndex, setActivePlanIndex, workstreamStatusMap, showInput, showSlidingPanel, setShowSlidingPanel, } = useAgentPlans(messages, interactive, isModal);
|
|
329
|
+
const { openDocuments, activeDocumentId, isDocPanelOpen, docRefreshKey, closeDocPanel: handleCloseDocPanel, closeDocument: handleCloseDocument, selectDocument, openDocInPanel, } = useDocumentPanel(messages);
|
|
330
|
+
const { processingFiles, hasProcessingFiles, handleFileUpload, } = useFileProcessing(client, run, serverFileUpdates, toast);
|
|
331
|
+
// ────────────────────────────────────────────
|
|
332
|
+
// Local state (UI-only concerns)
|
|
333
|
+
// ────────────────────────────────────────────
|
|
298
334
|
const bottomRef = useRef(null);
|
|
299
335
|
const conversationRef = useRef(null);
|
|
300
|
-
const [messages, setMessages] = useState([]);
|
|
301
|
-
const [isCompleted, setIsCompleted] = useState(false);
|
|
302
336
|
const [isSending, setIsSending] = useState(false);
|
|
303
|
-
const [
|
|
304
|
-
const
|
|
337
|
+
const [internalViewMode, setInternalViewMode] = useState("sliding");
|
|
338
|
+
const viewMode = controlledViewMode ?? internalViewMode;
|
|
339
|
+
const handleViewModeChange = useCallback((mode) => {
|
|
340
|
+
if (onViewModeChangeProp) {
|
|
341
|
+
onViewModeChangeProp(mode);
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
setInternalViewMode(mode);
|
|
345
|
+
}
|
|
346
|
+
}, [onViewModeChangeProp]);
|
|
305
347
|
const [isStopping, setIsStopping] = useState(false);
|
|
306
|
-
// Keep track of multiple plans and their timestamps
|
|
307
|
-
const [plans, setPlans] = useState([]);
|
|
308
|
-
// Track which plan is currently active in the UI
|
|
309
|
-
const [activePlanIndex, setActivePlanIndex] = useState(0);
|
|
310
|
-
// Store workstream status for each plan separately
|
|
311
|
-
const [workstreamStatusMap, setWorkstreamStatusMap] = useState(new Map());
|
|
312
348
|
const [thinkingMessageIndex, setThinkingMessageIndex] = useState(0);
|
|
313
|
-
const toast = useToast();
|
|
314
|
-
const [showInput, setShowInput] = useState(interactive);
|
|
315
|
-
const [workflowStatus, setWorkflowStatus] = useState(null);
|
|
316
|
-
// Track streaming messages by streaming_id for real-time chunk aggregation
|
|
317
|
-
// Include startTimestamp to preserve chronological order when converting to regular messages
|
|
318
|
-
const [streamingMessages, setStreamingMessages] = useState(new Map());
|
|
319
|
-
// Track files being processed by the workflow
|
|
320
|
-
const [processingFiles, setProcessingFiles] = useState(new Map());
|
|
321
|
-
// Check if any files are still uploading or processing
|
|
322
|
-
const hasProcessingFiles = useMemo(() => Array.from(processingFiles.values()).some(f => f.status === FileProcessingStatus.UPLOADING || f.status === FileProcessingStatus.PROCESSING), [processingFiles]);
|
|
323
|
-
// Performance optimization: Batch streaming updates using RAF
|
|
324
|
-
// Instead of updating state on every chunk (100+ times/sec), batch them per animation frame
|
|
325
|
-
const pendingStreamingChunks = useRef(new Map());
|
|
326
|
-
const streamingFlushScheduled = useRef(null);
|
|
327
|
-
// Debug: Track chunk arrivals and renders
|
|
328
|
-
const [_debugChunkCount, setDebugChunkCount] = useState(0);
|
|
329
|
-
const [_debugRenderCount, setDebugRenderCount] = useState(0);
|
|
330
|
-
const [debugChunkFlash, setDebugChunkFlash] = useState(false);
|
|
331
|
-
const debugFlashTimeout = useRef(null);
|
|
332
|
-
const flushStreamingChunks = useCallback(() => {
|
|
333
|
-
if (pendingStreamingChunks.current.size > 0) {
|
|
334
|
-
setStreamingMessages(new Map(pendingStreamingChunks.current));
|
|
335
|
-
setDebugRenderCount(c => c + 1);
|
|
336
|
-
}
|
|
337
|
-
streamingFlushScheduled.current = null;
|
|
338
|
-
}, []);
|
|
339
|
-
// Drag and drop state for full-panel file upload
|
|
340
349
|
const [isDragOver, setIsDragOver] = useState(false);
|
|
341
350
|
const dragCounterRef = useRef(0);
|
|
342
|
-
//
|
|
351
|
+
// PERFORMANCE: Refs for values used inside useCallback to avoid re-creating the callback
|
|
352
|
+
const isSendingRef = useRef(isSending);
|
|
353
|
+
isSendingRef.current = isSending;
|
|
354
|
+
const hasProcessingFilesRef = useRef(hasProcessingFiles);
|
|
355
|
+
hasProcessingFilesRef.current = hasProcessingFiles;
|
|
356
|
+
// Derive effective workflow status (API status + TERMINATED from messages)
|
|
357
|
+
const effectiveWorkflowStatus = useMemo(() => {
|
|
358
|
+
const lastMsg = messages[messages.length - 1];
|
|
359
|
+
if (lastMsg?.type === AgentMessageType.TERMINATED)
|
|
360
|
+
return "TERMINATED";
|
|
361
|
+
return workflowStatus;
|
|
362
|
+
}, [messages, workflowStatus]);
|
|
363
|
+
// ────────────────────────────────────────────
|
|
364
|
+
// Computed values
|
|
365
|
+
// ────────────────────────────────────────────
|
|
343
366
|
const getActivePlan = useMemo(() => {
|
|
344
367
|
const currentPlanData = plans[activePlanIndex] || {
|
|
345
368
|
plan: { plan: [] },
|
|
@@ -351,7 +374,9 @@ fusionData, }) {
|
|
|
351
374
|
workstreamStatus: currentWorkstreamStatus,
|
|
352
375
|
};
|
|
353
376
|
}, [plans, activePlanIndex, workstreamStatusMap]);
|
|
354
|
-
//
|
|
377
|
+
// ────────────────────────────────────────────
|
|
378
|
+
// Stable callbacks
|
|
379
|
+
// ────────────────────────────────────────────
|
|
355
380
|
const handleTogglePlanPanel = useCallback(() => {
|
|
356
381
|
setShowSlidingPanel((prev) => {
|
|
357
382
|
if (!prev) {
|
|
@@ -359,13 +384,19 @@ fusionData, }) {
|
|
|
359
384
|
}
|
|
360
385
|
return !prev;
|
|
361
386
|
});
|
|
362
|
-
}, []);
|
|
387
|
+
}, [setShowSlidingPanel]);
|
|
363
388
|
const handleChangePlan = useCallback((index) => {
|
|
364
389
|
setActivePlanIndex(index);
|
|
365
|
-
}, []);
|
|
390
|
+
}, [setActivePlanIndex]);
|
|
366
391
|
const handleClosePlanPanel = useCallback(() => {
|
|
367
392
|
setShowSlidingPanel(false);
|
|
368
|
-
}, []);
|
|
393
|
+
}, [setShowSlidingPanel]);
|
|
394
|
+
// Default StoreLinkComponent that opens documents in the panel
|
|
395
|
+
const internalStoreLinkComponent = useCallback(({ documentId, children }) => (_jsx("button", { className: "text-info underline cursor-pointer hover:text-info/80", onClick: () => openDocInPanel(documentId), children: children })), [openDocInPanel]);
|
|
396
|
+
const effectiveStoreLinkComponent = StoreLinkComponent ?? internalStoreLinkComponent;
|
|
397
|
+
// ────────────────────────────────────────────
|
|
398
|
+
// Effects
|
|
399
|
+
// ────────────────────────────────────────────
|
|
369
400
|
// Show rotating thinking messages
|
|
370
401
|
useEffect(() => {
|
|
371
402
|
if (!isCompleted) {
|
|
@@ -375,259 +406,51 @@ fusionData, }) {
|
|
|
375
406
|
return () => clearInterval(interval);
|
|
376
407
|
}
|
|
377
408
|
}, [isCompleted]);
|
|
378
|
-
|
|
379
|
-
try {
|
|
380
|
-
const statusResult = await client.store.workflows.getRunDetails(run.runId, run.workflowId);
|
|
381
|
-
setWorkflowStatus(statusResult.status);
|
|
382
|
-
}
|
|
383
|
-
catch (error) {
|
|
384
|
-
console.error('Failed to check workflow status:', error);
|
|
385
|
-
}
|
|
386
|
-
};
|
|
387
|
-
// Stream messages from the agent
|
|
409
|
+
// Expose handleFileUpload to external callers via ref
|
|
388
410
|
useEffect(() => {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
setWorkflowStatus(null);
|
|
396
|
-
setStreamingMessages(new Map());
|
|
397
|
-
checkWorkflowStatus();
|
|
398
|
-
client.store.workflows.streamMessages(run.workflowId, run.runId, (message) => {
|
|
399
|
-
// Client now converts compact wire format to AgentMessage internally
|
|
400
|
-
// Handle streaming chunks separately for real-time aggregation
|
|
401
|
-
// PERFORMANCE: Batch updates using RAF instead of immediate state updates
|
|
402
|
-
if (message.type === AgentMessageType.STREAMING_CHUNK) {
|
|
403
|
-
const details = message.details;
|
|
404
|
-
// Use activity_id as key if available (for dedup), fall back to streaming_id
|
|
405
|
-
const streamKey = details?.activity_id || details?.streaming_id;
|
|
406
|
-
if (!streamKey)
|
|
407
|
-
return;
|
|
408
|
-
// Debug: Track chunk arrival with flash
|
|
409
|
-
setDebugChunkCount(c => c + 1);
|
|
410
|
-
setDebugChunkFlash(true);
|
|
411
|
-
if (debugFlashTimeout.current)
|
|
412
|
-
clearTimeout(debugFlashTimeout.current);
|
|
413
|
-
debugFlashTimeout.current = setTimeout(() => setDebugChunkFlash(false), 50);
|
|
414
|
-
// Accumulate chunks in the ref (no state update yet)
|
|
415
|
-
const current = pendingStreamingChunks.current.get(streamKey) || {
|
|
416
|
-
text: '',
|
|
417
|
-
workstreamId: message.workstream_id,
|
|
418
|
-
startTimestamp: Date.now(),
|
|
419
|
-
activityId: details?.activity_id,
|
|
420
|
-
};
|
|
421
|
-
const newText = current.text + (message.message || '');
|
|
422
|
-
pendingStreamingChunks.current.set(streamKey, {
|
|
423
|
-
text: newText,
|
|
424
|
-
workstreamId: message.workstream_id,
|
|
425
|
-
isComplete: details.is_final,
|
|
426
|
-
startTimestamp: current.startTimestamp,
|
|
427
|
-
activityId: details?.activity_id,
|
|
428
|
-
});
|
|
429
|
-
// Schedule a flush if not already scheduled (batches ~60 updates/sec max)
|
|
430
|
-
if (streamingFlushScheduled.current === null) {
|
|
431
|
-
streamingFlushScheduled.current = requestAnimationFrame(flushStreamingChunks);
|
|
432
|
-
}
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
// Handle file processing status updates (SYSTEM messages with system_type: 'file_processing')
|
|
436
|
-
if (message.type === AgentMessageType.SYSTEM) {
|
|
437
|
-
const details = message.details;
|
|
438
|
-
if (details?.system_type === 'file_processing' && details.files) {
|
|
439
|
-
setProcessingFiles(prev => {
|
|
440
|
-
const newMap = new Map(prev);
|
|
441
|
-
for (const file of details.files) {
|
|
442
|
-
newMap.set(file.id, file);
|
|
443
|
-
}
|
|
444
|
-
return newMap;
|
|
445
|
-
});
|
|
446
|
-
return; // Don't add to messages array - this is status only
|
|
447
|
-
}
|
|
448
|
-
// Other SYSTEM messages fall through to normal handling
|
|
449
|
-
}
|
|
450
|
-
// When THOUGHT or ANSWER arrives with activity_id, remove matching streaming message
|
|
451
|
-
// This prevents duplicate content (streamed content replaced by final message)
|
|
452
|
-
if ((message.type === AgentMessageType.THOUGHT || message.type === AgentMessageType.ANSWER) && message.details?.activity_id) {
|
|
453
|
-
const activityId = message.details.activity_id;
|
|
454
|
-
// Remove from pending chunks
|
|
455
|
-
pendingStreamingChunks.current.delete(activityId);
|
|
456
|
-
// Remove from streaming messages state
|
|
457
|
-
setStreamingMessages(prev => {
|
|
458
|
-
if (prev.has(activityId)) {
|
|
459
|
-
const next = new Map(prev);
|
|
460
|
-
next.delete(activityId);
|
|
461
|
-
return next;
|
|
462
|
-
}
|
|
463
|
-
return prev;
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
// On COMPLETE or IDLE, just flush any pending chunks
|
|
467
|
-
if (message.type === AgentMessageType.COMPLETE || message.type === AgentMessageType.IDLE) {
|
|
468
|
-
if (pendingStreamingChunks.current.size > 0) {
|
|
469
|
-
flushStreamingChunks();
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
if (message.message) {
|
|
473
|
-
setMessages((prev_messages) => {
|
|
474
|
-
// Check for duplicate by timestamp
|
|
475
|
-
if (prev_messages.find((m) => m.timestamp === message.timestamp)) {
|
|
476
|
-
return prev_messages;
|
|
477
|
-
}
|
|
478
|
-
// For QUESTION messages from server, replace any optimistic version
|
|
479
|
-
if (message.type === AgentMessageType.QUESTION && !message.details?._optimistic) {
|
|
480
|
-
const withoutOptimistic = prev_messages.filter((m) => !(m.type === AgentMessageType.QUESTION &&
|
|
481
|
-
m.details?._optimistic &&
|
|
482
|
-
m.message === message.message));
|
|
483
|
-
insertMessageInTimeline(withoutOptimistic, message);
|
|
484
|
-
return [...withoutOptimistic];
|
|
485
|
-
}
|
|
486
|
-
insertMessageInTimeline(prev_messages, message);
|
|
487
|
-
return [...prev_messages];
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
});
|
|
491
|
-
// Clear messages and unsubscribe when component unmounts or runId changes
|
|
492
|
-
return () => {
|
|
493
|
-
setMessages([]);
|
|
494
|
-
// Cancel any pending streaming flush
|
|
495
|
-
if (streamingFlushScheduled.current !== null) {
|
|
496
|
-
cancelAnimationFrame(streamingFlushScheduled.current);
|
|
497
|
-
streamingFlushScheduled.current = null;
|
|
498
|
-
}
|
|
499
|
-
pendingStreamingChunks.current.clear();
|
|
500
|
-
// Client handles unsubscribing from the message stream internally
|
|
501
|
-
};
|
|
502
|
-
}, [run.runId, client.store.workflows, flushStreamingChunks]);
|
|
503
|
-
// Update completion status when messages change
|
|
504
|
-
// This now accounts for multiple workstreams
|
|
411
|
+
if (fileUploadRef)
|
|
412
|
+
fileUploadRef.current = handleFileUpload;
|
|
413
|
+
return () => { if (fileUploadRef)
|
|
414
|
+
fileUploadRef.current = null; };
|
|
415
|
+
}, [fileUploadRef, handleFileUpload]);
|
|
416
|
+
// Notify parent when processingFiles changes
|
|
505
417
|
useEffect(() => {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
if (plans.length === 0) {
|
|
510
|
-
// If there are no plans, make sure the plan panel is hidden
|
|
511
|
-
setShowSlidingPanel(false);
|
|
512
|
-
}
|
|
513
|
-
// We removed the auto-show functionality to allow users to keep the panel closed if they want
|
|
514
|
-
}, [messages, plans.length]);
|
|
515
|
-
// Update plans and workstream status based on incoming messages
|
|
418
|
+
onProcessingFilesChange?.(processingFiles);
|
|
419
|
+
}, [processingFiles, onProcessingFilesChange]);
|
|
420
|
+
// Notify parent when plans change
|
|
516
421
|
useEffect(() => {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
422
|
+
onPlansChange?.(plans, activePlanIndex);
|
|
423
|
+
}, [plans, activePlanIndex, onPlansChange]);
|
|
424
|
+
// Notify parent when workstream status changes
|
|
425
|
+
useEffect(() => {
|
|
426
|
+
onWorkstreamStatusChange?.(workstreamStatusMap);
|
|
427
|
+
}, [workstreamStatusMap, onWorkstreamStatusChange]);
|
|
428
|
+
// Notify parent when input availability is determined
|
|
429
|
+
useEffect(() => {
|
|
430
|
+
if (messages.length === 0)
|
|
431
|
+
return;
|
|
432
|
+
if (!showInput) {
|
|
433
|
+
onShowInputChange?.(false);
|
|
434
|
+
return;
|
|
528
435
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
let newPlanDetails = null;
|
|
536
|
-
// Extract the plan from the message details object
|
|
537
|
-
if (message.details && typeof message.details === "object") {
|
|
538
|
-
// For a PLAN type message like the example you provided
|
|
539
|
-
if (message.details.plan && Array.isArray(message.details.plan)) {
|
|
540
|
-
console.log("Valid plan array found in message.details.plan");
|
|
541
|
-
newPlanDetails = { plan: message.details.plan };
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
// Only proceed if we have a valid plan
|
|
545
|
-
if (newPlanDetails) {
|
|
546
|
-
const timestamp = typeof message.timestamp === "number"
|
|
547
|
-
? message.timestamp
|
|
548
|
-
: new Date(message.timestamp).getTime();
|
|
549
|
-
// Check if we already have this plan
|
|
550
|
-
const existingPlanIndex = plans.findIndex((p) => p.timestamp === timestamp);
|
|
551
|
-
if (existingPlanIndex === -1 && newPlanDetails) {
|
|
552
|
-
console.log("Adding new plan to plans array");
|
|
553
|
-
// This is a new plan - add it to our plans array
|
|
554
|
-
const newPlan = {
|
|
555
|
-
plan: newPlanDetails,
|
|
556
|
-
timestamp,
|
|
557
|
-
};
|
|
558
|
-
// Add new plan to the beginning of the array (newest first)
|
|
559
|
-
console.log("Adding plan to plans array:", newPlan);
|
|
560
|
-
setPlans((prev) => {
|
|
561
|
-
const newPlans = [newPlan, ...prev];
|
|
562
|
-
console.log("New plans array:", newPlans);
|
|
563
|
-
return newPlans;
|
|
564
|
-
});
|
|
565
|
-
// Set this as the active plan
|
|
566
|
-
setActivePlanIndex(0);
|
|
567
|
-
// Automatically show sliding plan panel when a plan is detected
|
|
568
|
-
console.log("Setting showSlidingPanel to true");
|
|
569
|
-
setShowSlidingPanel(true);
|
|
570
|
-
// Initialize workstreams as pending based on the plan tasks
|
|
571
|
-
const newWorkstreamStatus = new Map();
|
|
572
|
-
// Always initialize main workstream
|
|
573
|
-
newWorkstreamStatus.set("main", "in_progress");
|
|
574
|
-
// Initialize each task in the plan with its status
|
|
575
|
-
if (Array.isArray(newPlanDetails.plan)) {
|
|
576
|
-
newPlanDetails.plan.forEach((task) => {
|
|
577
|
-
if (task && typeof task === "object" && task.id) {
|
|
578
|
-
const taskId = task.id.toString();
|
|
579
|
-
// Use the task's status if available, otherwise default to pending
|
|
580
|
-
newWorkstreamStatus.set(taskId, task.status || "pending");
|
|
581
|
-
}
|
|
582
|
-
});
|
|
583
|
-
}
|
|
584
|
-
// Update the workstream status map with the new status for this plan
|
|
585
|
-
setWorkstreamStatusMap((prev) => {
|
|
586
|
-
const newMap = new Map(prev);
|
|
587
|
-
newMap.set(timestamp, newWorkstreamStatus);
|
|
588
|
-
return newMap;
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
catch (error) {
|
|
594
|
-
console.error("Failed to parse plan from message:", error);
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
// Handle UPDATE type messages with plan updates
|
|
598
|
-
if (message.type === AgentMessageType.UPDATE && message.details) {
|
|
599
|
-
// We no longer process UPDATE messages with details.updates
|
|
600
|
-
// Instead, we rely on the PLAN message that follows with the complete plan
|
|
601
|
-
if (message.details.updates && Array.isArray(message.details.updates)) {
|
|
602
|
-
console.log("Ignoring UPDATE message with details.updates - waiting for PLAN message with full plan");
|
|
603
|
-
// This is an initial update notification, but we'll wait for the PLAN message that follows
|
|
604
|
-
// with the complete updated plan before making any UI changes
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
});
|
|
608
|
-
const lastMessage = messages[messages.length - 1];
|
|
609
|
-
if (lastMessage) {
|
|
610
|
-
if (lastMessage.type === AgentMessageType.TERMINATED) {
|
|
611
|
-
setShowInput(false);
|
|
612
|
-
setWorkflowStatus("TERMINATED");
|
|
613
|
-
}
|
|
614
|
-
else {
|
|
615
|
-
if (interactive) {
|
|
616
|
-
setShowInput(true);
|
|
617
|
-
}
|
|
618
|
-
else {
|
|
619
|
-
setShowInput(lastMessage.type === AgentMessageType.REQUEST_INPUT);
|
|
620
|
-
}
|
|
621
|
-
}
|
|
436
|
+
if (effectiveWorkflowStatus && effectiveWorkflowStatus !== "RUNNING") {
|
|
437
|
+
onShowInputChange?.(false);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
if (effectiveWorkflowStatus !== null) {
|
|
441
|
+
onShowInputChange?.(true);
|
|
622
442
|
}
|
|
623
|
-
}, [
|
|
443
|
+
}, [showInput, effectiveWorkflowStatus, messages.length, onShowInputChange]);
|
|
444
|
+
// ────────────────────────────────────────────
|
|
445
|
+
// Handlers
|
|
446
|
+
// ────────────────────────────────────────────
|
|
624
447
|
// Send a message to the agent
|
|
625
|
-
const handleSendMessage = (message) => {
|
|
448
|
+
const handleSendMessage = useCallback((message) => {
|
|
626
449
|
const trimmed = message.trim();
|
|
627
|
-
if (!trimmed ||
|
|
450
|
+
if (!trimmed || isSendingRef.current)
|
|
628
451
|
return;
|
|
629
452
|
// Block if files are still processing
|
|
630
|
-
if (
|
|
453
|
+
if (hasProcessingFilesRef.current) {
|
|
631
454
|
toast({
|
|
632
455
|
status: "warning",
|
|
633
456
|
title: "Files Still Processing",
|
|
@@ -637,56 +460,38 @@ fusionData, }) {
|
|
|
637
460
|
return;
|
|
638
461
|
}
|
|
639
462
|
setIsSending(true);
|
|
640
|
-
// Add optimistic QUESTION message immediately for better UX
|
|
641
|
-
const optimisticTimestamp = Date.now();
|
|
642
|
-
const optimisticMessage = {
|
|
643
|
-
timestamp: optimisticTimestamp,
|
|
644
|
-
workflow_run_id: run.runId,
|
|
645
|
-
type: AgentMessageType.QUESTION,
|
|
646
|
-
message: trimmed,
|
|
647
|
-
workstream_id: "main",
|
|
648
|
-
details: { _optimistic: true },
|
|
649
|
-
};
|
|
650
|
-
console.log("[Optimistic] Adding user message:", trimmed);
|
|
651
|
-
setMessages((prev) => {
|
|
652
|
-
const newMessages = [...prev, optimisticMessage];
|
|
653
|
-
// Sort by timestamp to maintain order
|
|
654
|
-
newMessages.sort((a, b) => {
|
|
655
|
-
const timeA = typeof a.timestamp === "number" ? a.timestamp : new Date(a.timestamp).getTime();
|
|
656
|
-
const timeB = typeof b.timestamp === "number" ? b.timestamp : new Date(b.timestamp).getTime();
|
|
657
|
-
return timeA - timeB;
|
|
658
|
-
});
|
|
659
|
-
console.log("[Optimistic] Messages after add:", newMessages.length, "messages");
|
|
660
|
-
return newMessages;
|
|
661
|
-
});
|
|
662
|
-
// Get attached document IDs if callback provided
|
|
663
463
|
const attachedDocs = getAttachedDocs?.() || [];
|
|
664
|
-
// Get additional context metadata if callback provided (e.g., fundId)
|
|
665
464
|
const contextMetadata = getMessageContext?.() || {};
|
|
666
|
-
// Build message content with attachment references if present
|
|
667
465
|
let messageContent = trimmed;
|
|
668
466
|
if (attachedDocs.length > 0 && !/store:\S+/.test(trimmed)) {
|
|
669
|
-
const lines = attachedDocs.map((
|
|
467
|
+
const lines = attachedDocs.map((doc) => `[${doc.name}](/store/objects/${doc.id})`);
|
|
670
468
|
messageContent = [trimmed, '', 'Attachments:', ...lines].join('\n');
|
|
671
469
|
}
|
|
672
|
-
|
|
470
|
+
const messageId = `msg-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
471
|
+
const optimisticMessage = {
|
|
472
|
+
timestamp: Date.now(),
|
|
473
|
+
workflow_run_id: run.runId,
|
|
474
|
+
type: AgentMessageType.QUESTION,
|
|
475
|
+
message: messageContent,
|
|
476
|
+
workstream_id: "main",
|
|
477
|
+
details: { _optimistic: true, _messageId: messageId },
|
|
478
|
+
};
|
|
479
|
+
addOptimisticMessage(optimisticMessage);
|
|
673
480
|
const metadata = {
|
|
674
|
-
...(attachedDocs.length > 0 ? { attached_docs: attachedDocs } : {}),
|
|
481
|
+
...(attachedDocs.length > 0 ? { attached_docs: attachedDocs.map((d) => d.id) } : {}),
|
|
675
482
|
...contextMetadata,
|
|
483
|
+
_messageId: messageId,
|
|
676
484
|
};
|
|
677
485
|
client.store.workflows
|
|
678
486
|
.sendSignal(run.workflowId, run.runId, "UserInput", {
|
|
679
487
|
message: messageContent,
|
|
680
|
-
metadata
|
|
488
|
+
metadata,
|
|
681
489
|
})
|
|
682
490
|
.then(() => {
|
|
683
|
-
setIsCompleted(false);
|
|
684
|
-
// Clear attachments after successful send
|
|
685
491
|
onAttachmentsSent?.();
|
|
686
492
|
})
|
|
687
493
|
.catch((err) => {
|
|
688
|
-
|
|
689
|
-
setMessages((prev) => prev.filter((m) => m.timestamp !== optimisticTimestamp));
|
|
494
|
+
removeOptimisticMessages((m) => m.details?._messageId === messageId);
|
|
690
495
|
toast({
|
|
691
496
|
status: "error",
|
|
692
497
|
title: "Failed to Send Message",
|
|
@@ -697,72 +502,12 @@ fusionData, }) {
|
|
|
697
502
|
.finally(() => {
|
|
698
503
|
setIsSending(false);
|
|
699
504
|
});
|
|
700
|
-
};
|
|
701
|
-
// Handle file uploads - upload to artifact storage and signal workflow
|
|
702
|
-
const handleFileUpload = useCallback(async (files) => {
|
|
703
|
-
for (const file of files) {
|
|
704
|
-
const fileId = `file-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
705
|
-
const artifactPath = `files/${file.name}`;
|
|
706
|
-
// Add to local state immediately (optimistic - uploading status)
|
|
707
|
-
const fileState = {
|
|
708
|
-
id: fileId,
|
|
709
|
-
name: file.name,
|
|
710
|
-
content_type: file.type || 'application/octet-stream',
|
|
711
|
-
size: file.size,
|
|
712
|
-
status: FileProcessingStatus.UPLOADING,
|
|
713
|
-
started_at: Date.now(),
|
|
714
|
-
};
|
|
715
|
-
setProcessingFiles(prev => new Map(prev).set(fileId, fileState));
|
|
716
|
-
try {
|
|
717
|
-
// Upload to artifact storage
|
|
718
|
-
await client.files.uploadArtifact(run.runId, artifactPath, file);
|
|
719
|
-
// Update local state to processing
|
|
720
|
-
setProcessingFiles(prev => {
|
|
721
|
-
const newMap = new Map(prev);
|
|
722
|
-
const f = newMap.get(fileId);
|
|
723
|
-
if (f) {
|
|
724
|
-
f.status = FileProcessingStatus.PROCESSING;
|
|
725
|
-
f.artifact_path = artifactPath;
|
|
726
|
-
f.reference = `artifact:${artifactPath}`;
|
|
727
|
-
}
|
|
728
|
-
return newMap;
|
|
729
|
-
});
|
|
730
|
-
// Signal workflow that file was uploaded
|
|
731
|
-
await client.store.workflows.sendSignal(run.workflowId, run.runId, "FileUploaded", {
|
|
732
|
-
id: fileId,
|
|
733
|
-
name: file.name,
|
|
734
|
-
content_type: file.type || 'application/octet-stream',
|
|
735
|
-
reference: `artifact:${artifactPath}`,
|
|
736
|
-
artifact_path: artifactPath,
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
catch (error) {
|
|
740
|
-
// Update local state to error
|
|
741
|
-
setProcessingFiles(prev => {
|
|
742
|
-
const newMap = new Map(prev);
|
|
743
|
-
const f = newMap.get(fileId);
|
|
744
|
-
if (f) {
|
|
745
|
-
f.status = FileProcessingStatus.ERROR;
|
|
746
|
-
f.error = error instanceof Error ? error.message : 'Upload failed';
|
|
747
|
-
f.completed_at = Date.now();
|
|
748
|
-
}
|
|
749
|
-
return newMap;
|
|
750
|
-
});
|
|
751
|
-
toast({
|
|
752
|
-
status: "error",
|
|
753
|
-
title: "Upload Failed",
|
|
754
|
-
description: error instanceof Error ? error.message : "Failed to upload file",
|
|
755
|
-
duration: 3000,
|
|
756
|
-
});
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
}, [client, run, toast]);
|
|
505
|
+
}, [run.runId, run.workflowId, client, toast, getAttachedDocs, getMessageContext, onAttachmentsSent, addOptimisticMessage, removeOptimisticMessages]);
|
|
760
506
|
// Drag and drop handlers for full-panel file upload
|
|
761
507
|
const handleDragEnter = useCallback((e) => {
|
|
762
508
|
e.preventDefault();
|
|
763
509
|
e.stopPropagation();
|
|
764
510
|
dragCounterRef.current++;
|
|
765
|
-
// Enable drag if we have a run (for internal file processing)
|
|
766
511
|
if (run && e.dataTransfer?.types?.includes('Files')) {
|
|
767
512
|
setIsDragOver(true);
|
|
768
513
|
}
|
|
@@ -784,14 +529,13 @@ fusionData, }) {
|
|
|
784
529
|
e.stopPropagation();
|
|
785
530
|
dragCounterRef.current = 0;
|
|
786
531
|
setIsDragOver(false);
|
|
787
|
-
// Use internal handleFileUpload for proper workflow signaling and status tracking
|
|
788
532
|
if (run && e.dataTransfer?.files && e.dataTransfer.files.length > 0) {
|
|
789
533
|
const filesArray = Array.from(e.dataTransfer.files);
|
|
790
534
|
handleFileUpload(filesArray);
|
|
791
535
|
}
|
|
792
536
|
}, [run, handleFileUpload]);
|
|
793
537
|
// Stop/interrupt the active workflow
|
|
794
|
-
const handleStopWorkflow = async () => {
|
|
538
|
+
const handleStopWorkflow = useCallback(async () => {
|
|
795
539
|
if (isStopping)
|
|
796
540
|
return;
|
|
797
541
|
setIsStopping(true);
|
|
@@ -805,7 +549,6 @@ fusionData, }) {
|
|
|
805
549
|
description: "Type your message to give new instructions",
|
|
806
550
|
duration: 3000,
|
|
807
551
|
});
|
|
808
|
-
setIsCompleted(true);
|
|
809
552
|
}
|
|
810
553
|
catch (err) {
|
|
811
554
|
toast({
|
|
@@ -818,7 +561,18 @@ fusionData, }) {
|
|
|
818
561
|
finally {
|
|
819
562
|
setIsStopping(false);
|
|
820
563
|
}
|
|
821
|
-
};
|
|
564
|
+
}, [isStopping, client, run.workflowId, run.runId, toast]);
|
|
565
|
+
// Expose stop handler to external callers via ref
|
|
566
|
+
useEffect(() => {
|
|
567
|
+
if (stopRef)
|
|
568
|
+
stopRef.current = !isCompleted ? handleStopWorkflow : null;
|
|
569
|
+
return () => { if (stopRef)
|
|
570
|
+
stopRef.current = null; };
|
|
571
|
+
}, [stopRef, isCompleted, handleStopWorkflow]);
|
|
572
|
+
// Notify parent when stopping state changes
|
|
573
|
+
useEffect(() => {
|
|
574
|
+
onStoppingChange?.(isStopping);
|
|
575
|
+
}, [isStopping, onStoppingChange]);
|
|
822
576
|
// Calculate number of active tasks for the status indicator
|
|
823
577
|
const getActiveTaskCount = () => {
|
|
824
578
|
if (!messages.length)
|
|
@@ -915,17 +669,18 @@ fusionData, }) {
|
|
|
915
669
|
});
|
|
916
670
|
setIsPdfModalOpen(false);
|
|
917
671
|
};
|
|
672
|
+
// PERFORMANCE: Memoize taskLabels to prevent AllMessagesMixed re-renders
|
|
673
|
+
const taskLabels = useMemo(() => getActivePlan.plan.plan?.reduce((acc, task) => {
|
|
674
|
+
if (task.id && task.goal)
|
|
675
|
+
acc.set(task.id.toString(), task.goal);
|
|
676
|
+
return acc;
|
|
677
|
+
}, new Map()), [getActivePlan.plan]);
|
|
918
678
|
// Main content - wrapped with FusionFragmentProvider when fusionData is provided
|
|
919
|
-
const mainContent = (_jsx(ArtifactUrlCacheProvider, { children: _jsx(ImageLightboxProvider, { children: _jsxs("div", { className:
|
|
920
|
-
?
|
|
679
|
+
const mainContent = (_jsx(ArtifactUrlCacheProvider, { children: _jsx(ImageLightboxProvider, { children: _jsxs("div", { className: cn("flex flex-col lg:flex-row gap-2 h-full relative overflow-hidden", isDragOver && "ring-2 ring-blue-400 ring-inset", className), onDragEnter: handleDragEnter, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [isDragOver && (_jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-blue-100/80 dark:bg-blue-900/40 z-50 pointer-events-none rounded-lg", children: _jsxs("div", { className: "text-blue-600 dark:text-blue-400 font-medium flex items-center gap-2 text-lg", children: [_jsx(UploadIcon, { className: "size-6" }), "Drop files to upload"] }) })), _jsxs("div", { ref: conversationRef, className: cn("flex flex-col min-h-0 border-0", (showSlidingPanel || isDocPanelOpen)
|
|
680
|
+
? "w-full lg:w-3/5 flex-1 min-h-[50vh]"
|
|
921
681
|
: fullWidth
|
|
922
|
-
?
|
|
923
|
-
: `flex-1 mx-auto ${!isModal ?
|
|
924
|
-
if (task.id && task.goal) {
|
|
925
|
-
acc.set(task.id.toString(), task.goal);
|
|
926
|
-
}
|
|
927
|
-
return acc;
|
|
928
|
-
}, new Map()), streamingMessages: streamingMessages, onSendMessage: handleSendMessage, thinkingMessageIndex: thinkingMessageIndex })), _jsx("div", { className: "flex-shrink-0", style: { paddingBottom: 'env(safe-area-inset-bottom, 0px)' }, children: workflowStatus && workflowStatus !== "RUNNING" ? (_jsxs(MessageBox, { status: workflowStatus === "COMPLETED" ? 'success' : 'done', icon: null, className: "m-2", children: ["This Workflow is ", workflowStatus] })) : showInput && (_jsx(MessageInput, { onSend: handleSendMessage, onStop: handleStopWorkflow, disabled: isUploading, isSending: isSending || isUploading, isStopping: isStopping, isStreaming: !isCompleted, isCompleted: isCompleted, activeTaskCount: getActiveTaskCount(), placeholder: placeholder,
|
|
682
|
+
? "flex-1 w-full"
|
|
683
|
+
: `flex-1 mx-auto ${!isModal ? "max-w-4xl" : ""}`), children: [!hideHeader && (_jsx("div", { className: "flex-shrink-0", children: _jsx(Header, { title: actualTitle, isCompleted: isCompleted, onClose: onClose, isModal: isModal, run: run, viewMode: viewMode, onViewModeChange: handleViewModeChange, showPlanPanel: showSlidingPanel, hasPlan: plans.length > 0, onTogglePlanPanel: handleTogglePlanPanel, onDownload: downloadConversation, onCopyRunId: copyRunId, resetWorkflow: resetWorkflow, onExportPdf: exportConversationPdf, isReceivingChunks: debugChunkFlash }) })), messages.length === 0 && !isCompleted ? (_jsx("div", { className: "flex-1 flex flex-col items-center justify-center h-full text-center py-6", children: _jsxs("div", { className: "p-5 max-w-md border border-info rounded-lg shadow-sm", children: [_jsxs("div", { className: "flex items-center space-x-3 mb-3", children: [_jsx(PulsatingCircle, { size: "sm", color: "blue" }), _jsx("div", { className: "text-sm text-muted font-medium", children: ThinkingMessages[thinkingMessageIndex] })] }), _jsx("div", { className: "mt-4 flex justify-center", children: _jsx(AnimatedThinkingDots, { color: "blue", className: "mt-1" }) })] }) })) : (_jsx(AllMessagesMixed, { messages: messages, bottomRef: bottomRef, isCompleted: isCompleted, plan: getActivePlan.plan, workstreamStatus: getActivePlan.workstreamStatus, showPlanPanel: showSlidingPanel, onTogglePlanPanel: handleTogglePlanPanel, plans: plans, activePlanIndex: activePlanIndex, onChangePlan: handleChangePlan, taskLabels: taskLabels, streamingMessages: streamingMessages, onSendMessage: handleSendMessage, thinkingMessageIndex: thinkingMessageIndex, messageItemClassNames: messageItemClassNames, messageStyleOverrides: messageStyleOverrides, toolCallGroupClassNames: toolCallGroupClassNames, hideToolCallsInViewMode: hideToolCallsInViewMode, streamingMessageClassNames: streamingMessageClassNames, batchProgressPanelClassNames: batchProgressPanelClassNames, viewMode: viewMode, hideWorkstreamTabs: hideWorkstreamTabs, workingIndicatorClassName: workingIndicatorClassName, messageListClassName: messageListClassName, StoreLinkComponent: effectiveStoreLinkComponent, CollectionLinkComponent: CollectionLinkComponent, prependFriendlyMessage: prependFriendlyMessage })), !hideMessageInput && (_jsx("div", { className: "flex-shrink-0", style: { paddingBottom: 'env(safe-area-inset-bottom, 0px)' }, children: effectiveWorkflowStatus && effectiveWorkflowStatus !== "RUNNING" ? (_jsxs(MessageBox, { status: effectiveWorkflowStatus === "COMPLETED" ? 'success' : 'done', icon: null, className: "m-2", children: ["This Workflow is ", effectiveWorkflowStatus] })) : showInput && (_jsx(MessageInput, { onSend: handleSendMessage, onStop: handleStopWorkflow, disabled: isUploading, isSending: isSending || isUploading, isStopping: isStopping, isStreaming: !isCompleted, isCompleted: isCompleted, activeTaskCount: getActiveTaskCount(), placeholder: placeholder,
|
|
929
684
|
// File upload props - use internal handler that signals workflow
|
|
930
685
|
onFilesSelected: handleFileUpload, uploadedFiles: uploadedFiles, onRemoveFile: onRemoveFile, acceptedFileTypes: acceptedFileTypes, maxFiles: maxFiles,
|
|
931
686
|
// File processing state
|
|
@@ -934,8 +689,10 @@ fusionData, }) {
|
|
|
934
689
|
renderDocumentSearch: renderDocumentSearch, selectedDocuments: selectedDocuments, onRemoveDocument: onRemoveDocument,
|
|
935
690
|
// Object linking
|
|
936
691
|
hideObjectLinking: hideObjectLinking,
|
|
692
|
+
// Files Uploaded
|
|
693
|
+
hideFileUpload: hideFileUpload,
|
|
937
694
|
// Styling props
|
|
938
|
-
className: inputContainerClassName, inputClassName: inputClassName })) })] }), showSlidingPanel && (_jsx("div", { className: "w-full lg:w-1/3 min-h-[50vh] lg:h-full border-t lg:border-t-0 lg:border-l", children: _jsx(InlineSlidingPlanPanel, { plan: getActivePlan.plan, workstreamStatus: getActivePlan.workstreamStatus, isOpen: showSlidingPanel, onClose: handleClosePlanPanel, plans: plans, activePlanIndex: activePlanIndex, onChangePlan: handleChangePlan }) })), _jsxs(
|
|
695
|
+
className: inputContainerClassName, inputClassName: inputClassName })) }))] }), !hidePlanPanel && showSlidingPanel && (_jsx("div", { className: "w-full lg:w-1/3 min-h-[50vh] lg:h-full border-t lg:border-t-0 lg:border-l", children: _jsx(InlineSlidingPlanPanel, { plan: getActivePlan.plan, workstreamStatus: getActivePlan.workstreamStatus, isOpen: showSlidingPanel, onClose: handleClosePlanPanel, plans: plans, activePlanIndex: activePlanIndex, onChangePlan: handleChangePlan }) })), !hideDocumentPanel && isDocPanelOpen && openDocuments.length > 0 && (_jsx("div", { className: cn("w-full lg:w-2/5 min-h-[50vh] lg:h-full border-t lg:border-t-0 lg:border-l", showSlidingPanel && "lg:w-1/3"), children: _jsx(DocumentPanel, { isOpen: isDocPanelOpen, onClose: handleCloseDocPanel, documents: openDocuments, activeDocumentId: activeDocumentId, onSelectDocument: selectDocument, onCloseDocument: handleCloseDocument, refreshKey: docRefreshKey, runId: run.runId }) })), _jsxs(Modal, { isOpen: isPdfModalOpen, onClose: () => setIsPdfModalOpen(false), children: [_jsx(ModalTitle, { children: "Export conversation as PDF" }), _jsxs(ModalBody, { children: [_jsx("p", { className: "mb-2", children: "This will open your browser's print dialog with the current conversation." }), _jsx("p", { className: "text-sm text-muted", children: "To save a PDF, choose \"Save as PDF\" or a similar option in the print dialog." })] }), _jsxs(ModalFooter, { align: "right", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: () => setIsPdfModalOpen(false), children: "Cancel" }), _jsx(Button, { size: "sm", onClick: handleConfirmExportPdf, children: "Open print dialog" })] })] })] }) }) }));
|
|
939
696
|
// Wrap with FusionFragmentProvider when fusionData is provided
|
|
940
697
|
// This enables fusion-fragment code blocks to display data and supports
|
|
941
698
|
// agent-mode interactions where clicking editable fields sends messages
|