@parhelia/core 0.1.12570 → 0.1.12585
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/dist/agents-view/AgentCard.d.ts +6 -4
- package/dist/agents-view/AgentCard.js +143 -24
- package/dist/agents-view/AgentCard.js.map +1 -1
- package/dist/agents-view/AgentsInbox.d.ts +1 -1
- package/dist/agents-view/AgentsInbox.js +7 -92
- package/dist/agents-view/AgentsInbox.js.map +1 -1
- package/dist/agents-view/AgentsTitlebar.js +3 -2
- package/dist/agents-view/AgentsTitlebar.js.map +1 -1
- package/dist/agents-view/AgentsView.d.ts +6 -7
- package/dist/agents-view/AgentsView.js +191 -99
- package/dist/agents-view/AgentsView.js.map +1 -1
- package/dist/agents-view/AgentsWorkspaceView.d.ts +2 -6
- package/dist/agents-view/AgentsWorkspaceView.js +266 -113
- package/dist/agents-view/AgentsWorkspaceView.js.map +1 -1
- package/dist/agents-view/ProfileAgentsGroup.d.ts +2 -1
- package/dist/agents-view/ProfileAgentsGroup.js +4 -3
- package/dist/agents-view/ProfileAgentsGroup.js.map +1 -1
- package/dist/components/ActionButton.d.ts +1 -1
- package/dist/components/ActionButton.js.map +1 -1
- package/dist/components/FilterInput.d.ts +1 -1
- package/dist/components/FilterInput.js +1 -1
- package/dist/components/FilterInput.js.map +1 -1
- package/dist/components/ui/LanguageSelector.js +2 -4
- package/dist/components/ui/LanguageSelector.js.map +1 -1
- package/dist/components/ui/PlaceholderInput.js +3 -3
- package/dist/components/ui/PlaceholderInput.js.map +1 -1
- package/dist/components/ui/PlaceholderInputTypes.js +1 -1
- package/dist/components/ui/PlaceholderInputTypes.js.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +1 -1
- package/dist/components/ui/alert-dialog.js +6 -10
- package/dist/components/ui/alert-dialog.js.map +1 -1
- package/dist/components/ui/button.d.ts +4 -4
- package/dist/components/ui/button.js +4 -1
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/context-menu.d.ts +1 -1
- package/dist/components/ui/context-menu.js +12 -4
- package/dist/components/ui/context-menu.js.map +1 -1
- package/dist/components/ui/copy-button.d.ts +2 -1
- package/dist/components/ui/copy-button.js +2 -2
- package/dist/components/ui/copy-button.js.map +1 -1
- package/dist/components/ui/dialog.d.ts +1 -1
- package/dist/components/ui/dialog.js +21 -126
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/input.d.ts +1 -1
- package/dist/components/ui/input.js +5 -3
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/paste-button.d.ts +2 -1
- package/dist/components/ui/paste-button.js +2 -2
- package/dist/components/ui/paste-button.js.map +1 -1
- package/dist/components/ui/popover.js +1 -9
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/styled-dialog-title.js +1 -1
- package/dist/components/ui/styled-dialog-title.js.map +1 -1
- package/dist/components/ui/tabs.d.ts +1 -1
- package/dist/components/ui/tabs.js +4 -11
- package/dist/components/ui/tabs.js.map +1 -1
- package/dist/config/config.d.ts +4 -2
- package/dist/config/config.js +250 -70
- package/dist/config/config.js.map +1 -1
- package/dist/config/types/workspace.d.ts +6 -0
- package/dist/config/types.d.ts +63 -12
- package/dist/config/types.js.map +1 -1
- package/dist/editor/ConfirmationDialog.js +20 -4
- package/dist/editor/ConfirmationDialog.js.map +1 -1
- package/dist/editor/ContentTree.d.ts +2 -1
- package/dist/editor/ContentTree.js +93 -32
- package/dist/editor/ContentTree.js.map +1 -1
- package/dist/editor/Editor.js +87 -22
- package/dist/editor/Editor.js.map +1 -1
- package/dist/editor/FieldHistory.js +84 -36
- package/dist/editor/FieldHistory.js.map +1 -1
- package/dist/editor/FieldListField.js +21 -9
- package/dist/editor/FieldListField.js.map +1 -1
- package/dist/editor/FieldListFieldWithFallbacks.js +23 -2
- package/dist/editor/FieldListFieldWithFallbacks.js.map +1 -1
- package/dist/editor/GlobalMenuBar.js +29 -2
- package/dist/editor/GlobalMenuBar.js.map +1 -1
- package/dist/editor/ImageEditor.js +5 -2
- package/dist/editor/ImageEditor.js.map +1 -1
- package/dist/editor/ItemInfo.js +36 -1
- package/dist/editor/ItemInfo.js.map +1 -1
- package/dist/editor/LinkEditorDialog.js +3 -0
- package/dist/editor/LinkEditorDialog.js.map +1 -1
- package/dist/editor/MainLayout.d.ts +0 -2
- package/dist/editor/MainLayout.js +65 -8
- package/dist/editor/MainLayout.js.map +1 -1
- package/dist/editor/MigrationsView.js +29 -5
- package/dist/editor/MigrationsView.js.map +1 -1
- package/dist/editor/MobileLayout.js +37 -12
- package/dist/editor/MobileLayout.js.map +1 -1
- package/dist/editor/PictureCropper.js +54 -45
- package/dist/editor/PictureCropper.js.map +1 -1
- package/dist/editor/PictureEditor.js +17 -15
- package/dist/editor/PictureEditor.js.map +1 -1
- package/dist/editor/QuickItemSwitcher.js +37 -63
- package/dist/editor/QuickItemSwitcher.js.map +1 -1
- package/dist/editor/SetupWizard.js +52 -12
- package/dist/editor/SetupWizard.js.map +1 -1
- package/dist/editor/Titlebar.js +7 -2
- package/dist/editor/Titlebar.js.map +1 -1
- package/dist/editor/ai/AgentCostDisplay.d.ts +1 -0
- package/dist/editor/ai/AgentCostDisplay.js +1 -1
- package/dist/editor/ai/AgentCostDisplay.js.map +1 -1
- package/dist/editor/ai/AgentDocumentList.js +32 -14
- package/dist/editor/ai/AgentDocumentList.js.map +1 -1
- package/dist/editor/ai/AgentGreeting.js +6 -5
- package/dist/editor/ai/AgentGreeting.js.map +1 -1
- package/dist/editor/ai/AgentProfileSelector.js +2 -1
- package/dist/editor/ai/AgentProfileSelector.js.map +1 -1
- package/dist/editor/ai/AgentStatusBadge.d.ts +0 -5
- package/dist/editor/ai/AgentStatusBadge.js +67 -65
- package/dist/editor/ai/AgentStatusBadge.js.map +1 -1
- package/dist/editor/ai/AgentTerminal.d.ts +14 -2
- package/dist/editor/ai/AgentTerminal.js +2515 -579
- package/dist/editor/ai/AgentTerminal.js.map +1 -1
- package/dist/editor/ai/AgentTerminalStatusBar.d.ts +9 -4
- package/dist/editor/ai/AgentTerminalStatusBar.js +481 -56
- package/dist/editor/ai/AgentTerminalStatusBar.js.map +1 -1
- package/dist/editor/ai/Agents.js +161 -113
- package/dist/editor/ai/Agents.js.map +1 -1
- package/dist/editor/ai/AiResponseMessage.d.ts +10 -1
- package/dist/editor/ai/AiResponseMessage.js +267 -26
- package/dist/editor/ai/AiResponseMessage.js.map +1 -1
- package/dist/editor/ai/ContextInfoBar.d.ts +2 -3
- package/dist/editor/ai/ContextInfoBar.js +64 -7
- package/dist/editor/ai/ContextInfoBar.js.map +1 -1
- package/dist/editor/ai/EditOperationsPanel.d.ts +3 -2
- package/dist/editor/ai/EditOperationsPanel.js +21 -78
- package/dist/editor/ai/EditOperationsPanel.js.map +1 -1
- package/dist/editor/ai/GuidanceOverlay.js +17 -11
- package/dist/editor/ai/GuidanceOverlay.js.map +1 -1
- package/dist/editor/ai/InlineAiDialog.d.ts +1 -1
- package/dist/editor/ai/InlineAiDialog.js +514 -192
- package/dist/editor/ai/InlineAiDialog.js.map +1 -1
- package/dist/editor/ai/InlineAiTrigger.js +115 -12
- package/dist/editor/ai/InlineAiTrigger.js.map +1 -1
- package/dist/editor/ai/MediaImage.js +40 -8
- package/dist/editor/ai/MediaImage.js.map +1 -1
- package/dist/editor/ai/SpawnedAgentsPanel.js +10 -12
- package/dist/editor/ai/SpawnedAgentsPanel.js.map +1 -1
- package/dist/editor/ai/ToolCallDisplay.d.ts +22 -2
- package/dist/editor/ai/ToolCallDisplay.js +614 -202
- package/dist/editor/ai/ToolCallDisplay.js.map +1 -1
- package/dist/editor/ai/dialogs/AgentDialogHandler.d.ts +1 -8
- package/dist/editor/ai/dialogs/AgentDialogHandler.js +379 -42
- package/dist/editor/ai/dialogs/AgentDialogHandler.js.map +1 -1
- package/dist/editor/ai/dialogs/QuestionnaireInline.d.ts +5 -1
- package/dist/editor/ai/dialogs/QuestionnaireInline.js +628 -60
- package/dist/editor/ai/dialogs/QuestionnaireInline.js.map +1 -1
- package/dist/editor/ai/dialogs/agentDialogTypes.d.ts +117 -0
- package/dist/editor/ai/dialogs/agentDialogTypes.js +2 -0
- package/dist/editor/ai/dialogs/agentDialogTypes.js.map +1 -1
- package/dist/editor/ai/types.d.ts +3 -1
- package/dist/editor/ai/useAgentStatus.d.ts +2 -1
- package/dist/editor/ai/useAgentStatus.js +90 -100
- package/dist/editor/ai/useAgentStatus.js.map +1 -1
- package/dist/editor/ai/useInlineAiPosition.js +45 -5
- package/dist/editor/ai/useInlineAiPosition.js.map +1 -1
- package/dist/editor/client/AboutDialog.js +4 -2
- package/dist/editor/client/AboutDialog.js.map +1 -1
- package/dist/editor/client/EditorShell.d.ts +4 -1
- package/dist/editor/client/EditorShell.js +853 -258
- package/dist/editor/client/EditorShell.js.map +1 -1
- package/dist/editor/client/editContext.d.ts +33 -19
- package/dist/editor/client/editContext.js.map +1 -1
- package/dist/editor/client/helpers.js +6 -0
- package/dist/editor/client/helpers.js.map +1 -1
- package/dist/editor/client/hooks/useEditorUrlSync.js +1 -2
- package/dist/editor/client/hooks/useEditorUrlSync.js.map +1 -1
- package/dist/editor/client/hooks/useEditorWebSocket.d.ts +10 -0
- package/dist/editor/client/hooks/useEditorWebSocket.js +209 -14
- package/dist/editor/client/hooks/useEditorWebSocket.js.map +1 -1
- package/dist/editor/client/hooks/useQuota.d.ts +8 -0
- package/dist/editor/client/hooks/useQuota.js.map +1 -1
- package/dist/editor/client/hooks/useSocketMessageHandler.js +73 -15
- package/dist/editor/client/hooks/useSocketMessageHandler.js.map +1 -1
- package/dist/editor/client/itemsRepository.js +10 -6
- package/dist/editor/client/itemsRepository.js.map +1 -1
- package/dist/editor/client/operations.d.ts +6 -3
- package/dist/editor/client/operations.js +208 -30
- package/dist/editor/client/operations.js.map +1 -1
- package/dist/editor/client/pageModelBuilder.js +4 -31
- package/dist/editor/client/pageModelBuilder.js.map +1 -1
- package/dist/editor/client/ui/DevModeIndicator.js +2 -2
- package/dist/editor/client/ui/DevModeIndicator.js.map +1 -1
- package/dist/editor/client/ui/EditorChrome.d.ts +0 -6
- package/dist/editor/client/ui/EditorChrome.js +55 -72
- package/dist/editor/client/ui/EditorChrome.js.map +1 -1
- package/dist/editor/client/ui/FullscreenControls.js +5 -3
- package/dist/editor/client/ui/FullscreenControls.js.map +1 -1
- package/dist/editor/commands/commands.d.ts +11 -1
- package/dist/editor/commands/commands.js +12 -1
- package/dist/editor/commands/commands.js.map +1 -1
- package/dist/editor/commands/componentCommands.js +109 -55
- package/dist/editor/commands/componentCommands.js.map +1 -1
- package/dist/editor/commands/customCommandConverter.d.ts +8 -1
- package/dist/editor/commands/customCommandConverter.js +35 -5
- package/dist/editor/commands/customCommandConverter.js.map +1 -1
- package/dist/editor/commands/handlers/agentHandler.js +2 -1
- package/dist/editor/commands/handlers/agentHandler.js.map +1 -1
- package/dist/editor/commands/itemCommands.d.ts +3 -0
- package/dist/editor/commands/itemCommands.js +93 -10
- package/dist/editor/commands/itemCommands.js.map +1 -1
- package/dist/editor/commands/undo.d.ts +9 -15
- package/dist/editor/commands/undo.js +24 -0
- package/dist/editor/commands/undo.js.map +1 -1
- package/dist/editor/context-menu/InsertMenu.js +83 -39
- package/dist/editor/context-menu/InsertMenu.js.map +1 -1
- package/dist/editor/field-types/MultiLineText.js +1 -1
- package/dist/editor/field-types/MultiLineText.js.map +1 -1
- package/dist/editor/field-types/RawEditor.js +1 -1
- package/dist/editor/field-types/RichTextEditor.js +13 -5
- package/dist/editor/field-types/RichTextEditor.js.map +1 -1
- package/dist/editor/field-types/RichTextEditorComponent.js +37 -3
- package/dist/editor/field-types/RichTextEditorComponent.js.map +1 -1
- package/dist/editor/field-types/SingleLineText.js +1 -1
- package/dist/editor/field-types/TreeListEditor.js +3 -2
- package/dist/editor/field-types/TreeListEditor.js.map +1 -1
- package/dist/editor/field-types/richtext/components/ReactSlate.css +23 -5
- package/dist/editor/field-types/richtext/components/ReactSlate.d.ts +2 -0
- package/dist/editor/field-types/richtext/components/ReactSlate.js +28 -4
- package/dist/editor/field-types/richtext/components/ReactSlate.js.map +1 -1
- package/dist/editor/field-types/richtext/components/ToolbarButton.js +4 -2
- package/dist/editor/field-types/richtext/components/ToolbarButton.js.map +1 -1
- package/dist/editor/field-types/richtext/contextMenuFactory.d.ts +13 -0
- package/dist/editor/field-types/richtext/contextMenuFactory.js +181 -24
- package/dist/editor/field-types/richtext/contextMenuFactory.js.map +1 -1
- package/dist/editor/field-types/richtext/types.d.ts +2 -0
- package/dist/editor/field-types/richtext/types.js.map +1 -1
- package/dist/editor/field-types/richtext/utils/plugins.js +4 -0
- package/dist/editor/field-types/richtext/utils/plugins.js.map +1 -1
- package/dist/editor/field-types/textContextMenuFactory.js +3 -2
- package/dist/editor/field-types/textContextMenuFactory.js.map +1 -1
- package/dist/editor/media-selector/AiImageSearchPrompt.js +4 -2
- package/dist/editor/media-selector/AiImageSearchPrompt.js.map +1 -1
- package/dist/editor/media-selector/MediaFolderBrowser.js +1 -1
- package/dist/editor/media-selector/MediaFolderBrowser.js.map +1 -1
- package/dist/editor/media-selector/MediaSelector.js +7 -1
- package/dist/editor/media-selector/MediaSelector.js.map +1 -1
- package/dist/editor/media-selector/TreeSelector.js +40 -35
- package/dist/editor/media-selector/TreeSelector.js.map +1 -1
- package/dist/editor/menubar/ActiveUsers.js +1 -1
- package/dist/editor/menubar/ActiveUsers.js.map +1 -1
- package/dist/editor/menubar/GenericToolbar.js +4 -2
- package/dist/editor/menubar/GenericToolbar.js.map +1 -1
- package/dist/editor/menubar/ItemLanguageVersion.js +2 -2
- package/dist/editor/menubar/ItemLanguageVersion.js.map +1 -1
- package/dist/editor/menubar/PageSelector.js +26 -147
- package/dist/editor/menubar/PageSelector.js.map +1 -1
- package/dist/editor/menubar/Separator.js +1 -1
- package/dist/editor/menubar/VersionSelector.js +2 -4
- package/dist/editor/menubar/VersionSelector.js.map +1 -1
- package/dist/editor/menubar/WorkflowButton.js +39 -12
- package/dist/editor/menubar/WorkflowButton.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/CustomCommandsToolbar.js +16 -38
- package/dist/editor/menubar/toolbar-sections/CustomCommandsToolbar.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/EditControls.js +3 -3
- package/dist/editor/menubar/toolbar-sections/EditControls.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/HelpButton.js +1 -0
- package/dist/editor/menubar/toolbar-sections/HelpButton.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/ManualBrowser.d.ts +6 -10
- package/dist/editor/menubar/toolbar-sections/ManualBrowser.js +597 -220
- package/dist/editor/menubar/toolbar-sections/ManualBrowser.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/UtilityControls.js +13 -2
- package/dist/editor/menubar/toolbar-sections/UtilityControls.js.map +1 -1
- package/dist/editor/page-editor-chrome/CommentHighlighting.js +42 -1
- package/dist/editor/page-editor-chrome/CommentHighlighting.js.map +1 -1
- package/dist/editor/page-editor-chrome/FrameMenu.js +1 -1
- package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -1
- package/dist/editor/page-editor-chrome/InlineEditor.js +97 -48
- package/dist/editor/page-editor-chrome/InlineEditor.js.map +1 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js +38 -17
- package/dist/editor/page-editor-chrome/PlaceholderDropZone.js.map +1 -1
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js +17 -11
- package/dist/editor/page-editor-chrome/PlaceholderDropZones.js.map +1 -1
- package/dist/editor/page-editor-chrome/useInlineAICompletion.js +301 -301
- package/dist/editor/page-editor-chrome/useInlineAICompletion.js.map +1 -1
- package/dist/editor/page-viewer/DeviceToolbar.js +1 -1
- package/dist/editor/page-viewer/DeviceToolbar.js.map +1 -1
- package/dist/editor/page-viewer/EditorForm.js +69 -11
- package/dist/editor/page-viewer/EditorForm.js.map +1 -1
- package/dist/editor/page-viewer/MiniMap.d.ts +2 -4
- package/dist/editor/page-viewer/MiniMap.js +91 -28
- package/dist/editor/page-viewer/MiniMap.js.map +1 -1
- package/dist/editor/page-viewer/PageViewer.d.ts +3 -1
- package/dist/editor/page-viewer/PageViewer.js +92 -19
- package/dist/editor/page-viewer/PageViewer.js.map +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.d.ts +2 -1
- package/dist/editor/page-viewer/PageViewerFrame.js +348 -115
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
- package/dist/editor/page-viewer/pageModelSkeletonBuilder.js +114 -49
- package/dist/editor/page-viewer/pageModelSkeletonBuilder.js.map +1 -1
- package/dist/editor/page-viewer/pageViewContext.d.ts +1 -0
- package/dist/editor/page-viewer/pageViewContext.js +51 -14
- package/dist/editor/page-viewer/pageViewContext.js.map +1 -1
- package/dist/editor/pageModel.d.ts +14 -1
- package/dist/editor/reviews/Comment.d.ts +2 -1
- package/dist/editor/reviews/Comment.js +92 -15
- package/dist/editor/reviews/Comment.js.map +1 -1
- package/dist/editor/reviews/CommentDisplayPopover.js +70 -5
- package/dist/editor/reviews/CommentDisplayPopover.js.map +1 -1
- package/dist/editor/reviews/CommentView.d.ts +3 -1
- package/dist/editor/reviews/CommentView.js +26 -6
- package/dist/editor/reviews/CommentView.js.map +1 -1
- package/dist/editor/reviews/Comments.js +140 -75
- package/dist/editor/reviews/Comments.js.map +1 -1
- package/dist/editor/reviews/CreateReviewDialog.js +281 -177
- package/dist/editor/reviews/CreateReviewDialog.js.map +1 -1
- package/dist/editor/reviews/DecisionsMatrix.js +96 -25
- package/dist/editor/reviews/DecisionsMatrix.js.map +1 -1
- package/dist/editor/reviews/DiffView.js +7 -14
- package/dist/editor/reviews/DiffView.js.map +1 -1
- package/dist/editor/reviews/EditReviewSettingsDialog.js +6 -4
- package/dist/editor/reviews/EditReviewSettingsDialog.js.map +1 -1
- package/dist/editor/reviews/MultiReviewManager.js +25 -3
- package/dist/editor/reviews/MultiReviewManager.js.map +1 -1
- package/dist/editor/reviews/PagesPanel.js +31 -15
- package/dist/editor/reviews/PagesPanel.js.map +1 -1
- package/dist/editor/reviews/PreviewInfo.js +1 -4
- package/dist/editor/reviews/PreviewInfo.js.map +1 -1
- package/dist/editor/reviews/ReviewCard.js +13 -7
- package/dist/editor/reviews/ReviewCard.js.map +1 -1
- package/dist/editor/reviews/ReviewDetail.js +3 -2
- package/dist/editor/reviews/ReviewDetail.js.map +1 -1
- package/dist/editor/reviews/ReviewsList.js +7 -3
- package/dist/editor/reviews/ReviewsList.js.map +1 -1
- package/dist/editor/reviews/SuggestedEdit.js +34 -3
- package/dist/editor/reviews/SuggestedEdit.js.map +1 -1
- package/dist/editor/reviews/SuggestionDisplayPopover.js +31 -5
- package/dist/editor/reviews/SuggestionDisplayPopover.js.map +1 -1
- package/dist/editor/reviews/commentAi.js +25 -6
- package/dist/editor/reviews/commentAi.js.map +1 -1
- package/dist/editor/reviews/reviewCommands.js +4 -1
- package/dist/editor/reviews/reviewCommands.js.map +1 -1
- package/dist/editor/reviews/useMultiReview.js +2 -2
- package/dist/editor/reviews/useMultiReview.js.map +1 -1
- package/dist/editor/reviews/useReviews.d.ts +4 -3
- package/dist/editor/reviews/useReviews.js +21 -32
- package/dist/editor/reviews/useReviews.js.map +1 -1
- package/dist/editor/services/agentService.d.ts +240 -5
- package/dist/editor/services/agentService.js +299 -39
- package/dist/editor/services/agentService.js.map +1 -1
- package/dist/editor/services/aiService.d.ts +57 -1
- package/dist/editor/services/aiService.js +79 -6
- package/dist/editor/services/aiService.js.map +1 -1
- package/dist/editor/services/contentService.d.ts +6 -3
- package/dist/editor/services/contentService.js +13 -12
- package/dist/editor/services/contentService.js.map +1 -1
- package/dist/editor/services/editService.d.ts +52 -1
- package/dist/editor/services/editService.js +94 -2
- package/dist/editor/services/editService.js.map +1 -1
- package/dist/editor/services/indexService.js +1 -1
- package/dist/editor/services/indexService.js.map +1 -1
- package/dist/editor/services/reviewsService.d.ts +3 -6
- package/dist/editor/services/reviewsService.js +2 -11
- package/dist/editor/services/reviewsService.js.map +1 -1
- package/dist/editor/services/serviceHelper.d.ts +2 -1
- package/dist/editor/services/serviceHelper.js +112 -20
- package/dist/editor/services/serviceHelper.js.map +1 -1
- package/dist/editor/services/systemService.d.ts +2 -1
- package/dist/editor/services/systemService.js +3 -0
- package/dist/editor/services/systemService.js.map +1 -1
- package/dist/editor/services-server/api.d.ts +1 -2
- package/dist/editor/services-server/api.js +11 -6
- package/dist/editor/services-server/api.js.map +1 -1
- package/dist/editor/settings/About.js +317 -3
- package/dist/editor/settings/About.js.map +1 -1
- package/dist/editor/settings/IndexOverview.js +3 -1
- package/dist/editor/settings/IndexOverview.js.map +1 -1
- package/dist/editor/settings/QuotaInfo.js +210 -4
- package/dist/editor/settings/QuotaInfo.js.map +1 -1
- package/dist/editor/settings/SettingsView.js +25 -23
- package/dist/editor/settings/SettingsView.js.map +1 -1
- package/dist/editor/settings/Status.js +7 -6
- package/dist/editor/settings/Status.js.map +1 -1
- package/dist/editor/settings/index/CollectionWarningsDisplay.d.ts +10 -0
- package/dist/editor/settings/index/CollectionWarningsDisplay.js +16 -0
- package/dist/editor/settings/index/CollectionWarningsDisplay.js.map +1 -0
- package/dist/editor/settings/index/useIndexStatus.js +23 -22
- package/dist/editor/settings/index/useIndexStatus.js.map +1 -1
- package/dist/editor/settings/panels/AgentsPanel.d.ts +0 -4
- package/dist/editor/settings/panels/AgentsPanel.js +95 -121
- package/dist/editor/settings/panels/AgentsPanel.js.map +1 -1
- package/dist/editor/settings/panels/ModelConfigPanel.js +1 -1
- package/dist/editor/settings/panels/ModelConfigPanel.js.map +1 -1
- package/dist/editor/settings/panels/ModelsPanel.js +324 -108
- package/dist/editor/settings/panels/ModelsPanel.js.map +1 -1
- package/dist/editor/settings/panels/ProvidersPanel.d.ts +1 -1
- package/dist/editor/settings/panels/ProvidersPanel.js +86 -59
- package/dist/editor/settings/panels/ProvidersPanel.js.map +1 -1
- package/dist/editor/settings/panels/SearchConfigPanel.js +67 -6
- package/dist/editor/settings/panels/SearchConfigPanel.js.map +1 -1
- package/dist/editor/settings/panels/StatusPanel.js +7 -2
- package/dist/editor/settings/panels/StatusPanel.js.map +1 -1
- package/dist/editor/settings/panels/index.d.ts +3 -2
- package/dist/editor/settings/panels/index.js +3 -2
- package/dist/editor/settings/panels/index.js.map +1 -1
- package/dist/editor/settings/status/coreStatusChecks.js +124 -19
- package/dist/editor/settings/status/coreStatusChecks.js.map +1 -1
- package/dist/editor/settings/status/useStartupChecks.d.ts +3 -1
- package/dist/editor/settings/status/useStartupChecks.js +9 -5
- package/dist/editor/settings/status/useStartupChecks.js.map +1 -1
- package/dist/editor/setup-wizard/steps/CompleteStep.d.ts +2 -1
- package/dist/editor/setup-wizard/steps/CompleteStep.js +2 -1
- package/dist/editor/setup-wizard/steps/CompleteStep.js.map +1 -1
- package/dist/editor/sidebar/ComponentPalette.js +2 -1
- package/dist/editor/sidebar/ComponentPalette.js.map +1 -1
- package/dist/editor/sidebar/ComponentTree.d.ts +8 -1
- package/dist/editor/sidebar/ComponentTree.js +216 -69
- package/dist/editor/sidebar/ComponentTree.js.map +1 -1
- package/dist/editor/sidebar/EditHistory.js +22 -46
- package/dist/editor/sidebar/EditHistory.js.map +1 -1
- package/dist/editor/sidebar/Favorites.js +4 -8
- package/dist/editor/sidebar/Favorites.js.map +1 -1
- package/dist/editor/sidebar/MainContentTree.js +4 -3
- package/dist/editor/sidebar/MainContentTree.js.map +1 -1
- package/dist/editor/sidebar/OperationItem.js +21 -7
- package/dist/editor/sidebar/OperationItem.js.map +1 -1
- package/dist/editor/sidebar/SidebarPanel.d.ts +3 -1
- package/dist/editor/sidebar/SidebarPanel.js +44 -12
- package/dist/editor/sidebar/SidebarPanel.js.map +1 -1
- package/dist/editor/sidebar/SidebarStack.d.ts +2 -1
- package/dist/editor/sidebar/SidebarStack.js +4 -3
- package/dist/editor/sidebar/SidebarStack.js.map +1 -1
- package/dist/editor/sidebar/Validation.js +24 -12
- package/dist/editor/sidebar/Validation.js.map +1 -1
- package/dist/editor/sidebar/Workbox.js +53 -3
- package/dist/editor/sidebar/Workbox.js.map +1 -1
- package/dist/editor/sidebar/WorkspaceRail.d.ts +0 -1
- package/dist/editor/sidebar/WorkspaceRail.js +56 -167
- package/dist/editor/sidebar/WorkspaceRail.js.map +1 -1
- package/dist/editor/template-wizard/TemplateStructureInlineEditor.js +3 -2
- package/dist/editor/template-wizard/TemplateStructureInlineEditor.js.map +1 -1
- package/dist/editor/tree-indicators/GutterColumns.d.ts +3 -1
- package/dist/editor/tree-indicators/GutterColumns.js +26 -5
- package/dist/editor/tree-indicators/GutterColumns.js.map +1 -1
- package/dist/editor/tree-indicators/GutterContext.d.ts +4 -0
- package/dist/editor/tree-indicators/GutterContext.js +23 -0
- package/dist/editor/tree-indicators/GutterContext.js.map +1 -1
- package/dist/editor/tree-indicators/index.d.ts +0 -1
- package/dist/editor/tree-indicators/index.js +0 -1
- package/dist/editor/tree-indicators/index.js.map +1 -1
- package/dist/editor/tree-indicators/types.d.ts +12 -1
- package/dist/editor/ui/CopyMoveTargetSelectorDialog.js +1 -1
- package/dist/editor/ui/CopyMoveTargetSelectorDialog.js.map +1 -1
- package/dist/editor/ui/Icons.js +1 -1
- package/dist/editor/ui/Icons.js.map +1 -1
- package/dist/editor/ui/ItemNameDialogNew.d.ts +2 -0
- package/dist/editor/ui/ItemNameDialogNew.js +33 -17
- package/dist/editor/ui/ItemNameDialogNew.js.map +1 -1
- package/dist/editor/ui/ItemSearch.js +7 -11
- package/dist/editor/ui/ItemSearch.js.map +1 -1
- package/dist/editor/ui/SimpleIconButton.js +1 -1
- package/dist/editor/ui/SimpleIconButton.js.map +1 -1
- package/dist/editor/ui/SimpleTabs.d.ts +1 -0
- package/dist/editor/ui/SimpleTabs.js +45 -25
- package/dist/editor/ui/SimpleTabs.js.map +1 -1
- package/dist/editor/ui/Splitter.d.ts +1 -0
- package/dist/editor/ui/Splitter.js +102 -86
- package/dist/editor/ui/Splitter.js.map +1 -1
- package/dist/editor/ui/TemplateSelectorDialog.js +4 -4
- package/dist/editor/ui/TemplateSelectorDialog.js.map +1 -1
- package/dist/editor/ui/TreeListSelector.d.ts +6 -1
- package/dist/editor/ui/TreeListSelector.js +2 -2
- package/dist/editor/ui/TreeListSelector.js.map +1 -1
- package/dist/editor/utils/keyboardNavigation.d.ts +6 -20
- package/dist/editor/utils/keyboardNavigation.js +48 -140
- package/dist/editor/utils/keyboardNavigation.js.map +1 -1
- package/dist/editor/utils.js +19 -9
- package/dist/editor/utils.js.map +1 -1
- package/dist/editor/views/CompareView.d.ts +3 -1
- package/dist/editor/views/CompareView.js +7 -5
- package/dist/editor/views/CompareView.js.map +1 -1
- package/dist/editor/views/EditView.js +1 -1
- package/dist/editor/views/EditView.js.map +1 -1
- package/dist/editor/views/EditorSlot.js +27 -34
- package/dist/editor/views/EditorSlot.js.map +1 -1
- package/dist/editor/views/ItemEditor.js +7 -3
- package/dist/editor/views/ItemEditor.js.map +1 -1
- package/dist/editor/views/MediaFolderEditView.js +1 -1
- package/dist/editor/views/MediaFolderEditView.js.map +1 -1
- package/dist/editor/views/ParheliaView.js +5 -6
- package/dist/editor/views/ParheliaView.js.map +1 -1
- package/dist/editor/views/SingleEditView.d.ts +2 -1
- package/dist/editor/views/SingleEditView.js +10 -8
- package/dist/editor/views/SingleEditView.js.map +1 -1
- package/dist/editor/views/editorSlotContext.js +35 -6
- package/dist/editor/views/editorSlotContext.js.map +1 -1
- package/dist/index.d.ts +16 -2
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/setup/services/setupWizardService.d.ts +48 -14
- package/dist/setup/services/setupWizardService.js +52 -17
- package/dist/setup/services/setupWizardService.js.map +1 -1
- package/dist/setup/wizard/steps/AddModelDialog.js +12 -3
- package/dist/setup/wizard/steps/AddModelDialog.js.map +1 -1
- package/dist/setup/wizard/steps/ImportModelDialog.js +46 -22
- package/dist/setup/wizard/steps/ImportModelDialog.js.map +1 -1
- package/dist/splash-screen/ModernSplashScreen.js +112 -32
- package/dist/splash-screen/ModernSplashScreen.js.map +1 -1
- package/dist/splash-screen/NewPage.js +33 -50
- package/dist/splash-screen/NewPage.js.map +1 -1
- package/dist/splash-screen/OpenPage.js +2 -6
- package/dist/splash-screen/OpenPage.js.map +1 -1
- package/dist/splash-screen/ParheliaAssistantChat.js +12 -29
- package/dist/splash-screen/ParheliaAssistantChat.js.map +1 -1
- package/dist/splash-screen/ParheliaLogo.js +87 -37
- package/dist/splash-screen/ParheliaLogo.js.map +1 -1
- package/dist/splash-screen/RecentPages.js +3 -3
- package/dist/splash-screen/RecentPages.js.map +1 -1
- package/dist/tour/Tour.d.ts +2 -1
- package/dist/tour/Tour.js +256 -75
- package/dist/tour/Tour.js.map +1 -1
- package/dist/tour/default-tour.js +222 -96
- package/dist/tour/default-tour.js.map +1 -1
- package/dist/types.d.ts +70 -29
- package/package.json +19 -15
- package/styles.css +39 -10
- package/dist/editor/ComponentInfo.d.ts +0 -4
- package/dist/editor/ComponentInfo.js +0 -41
- package/dist/editor/ComponentInfo.js.map +0 -1
- package/dist/editor/ai/HelpTerminal.d.ts +0 -5
- package/dist/editor/ai/HelpTerminal.js +0 -166
- package/dist/editor/ai/HelpTerminal.js.map +0 -1
- package/dist/editor/field-types/ReactQuill.d.ts +0 -125
- package/dist/editor/field-types/ReactQuill.js +0 -385
- package/dist/editor/field-types/ReactQuill.js.map +0 -1
- package/dist/editor/services-server/graphQL.d.ts +0 -29
- package/dist/editor/services-server/graphQL.js +0 -53
- package/dist/editor/services-server/graphQL.js.map +0 -1
- package/dist/editor/settings/AllAgentsPanel.d.ts +0 -5
- package/dist/editor/settings/AllAgentsPanel.js +0 -139
- package/dist/editor/settings/AllAgentsPanel.js.map +0 -1
- package/dist/editor/settings/LatestFeedback.d.ts +0 -1
- package/dist/editor/settings/LatestFeedback.js +0 -136
- package/dist/editor/settings/LatestFeedback.js.map +0 -1
- package/dist/editor/settings/Setup.d.ts +0 -1
- package/dist/editor/settings/Setup.js +0 -211
- package/dist/editor/settings/Setup.js.map +0 -1
- package/dist/editor/settings/panels/DatabasePanel.d.ts +0 -6
- package/dist/editor/settings/panels/DatabasePanel.js +0 -50
- package/dist/editor/settings/panels/DatabasePanel.js.map +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/EmbeddingsModelSection.d.ts +0 -2
- package/dist/editor/settings/setup-steps/AiSetupStep/EmbeddingsModelSection.js +0 -195
- package/dist/editor/settings/setup-steps/AiSetupStep/EmbeddingsModelSection.js.map +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/index.d.ts +0 -2
- package/dist/editor/settings/setup-steps/AiSetupStep/index.js +0 -21
- package/dist/editor/settings/setup-steps/AiSetupStep/index.js.map +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/provider/ProviderSection.d.ts +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/provider/ProviderSection.js +0 -233
- package/dist/editor/settings/setup-steps/AiSetupStep/provider/ProviderSection.js.map +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersList.d.ts +0 -15
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersList.js +0 -14
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersList.js.map +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersSection.d.ts +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersSection.js +0 -94
- package/dist/editor/settings/setup-steps/AiSetupStep/required-containers/RequiredContainersSection.js.map +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/types.d.ts +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/types.js +0 -2
- package/dist/editor/settings/setup-steps/AiSetupStep/types.js.map +0 -1
- package/dist/editor/settings/setup-steps/AiSetupStep/utils.d.ts +0 -5
- package/dist/editor/settings/setup-steps/AiSetupStep/utils.js +0 -44
- package/dist/editor/settings/setup-steps/AiSetupStep/utils.js.map +0 -1
- package/dist/editor/settings/setup-steps/IndexSetupStep.d.ts +0 -2
- package/dist/editor/settings/setup-steps/IndexSetupStep.js +0 -36
- package/dist/editor/settings/setup-steps/IndexSetupStep.js.map +0 -1
- package/dist/editor/settings/setup-steps/SettingsSetupStep.d.ts +0 -2
- package/dist/editor/settings/setup-steps/SettingsSetupStep.js +0 -111
- package/dist/editor/settings/setup-steps/SettingsSetupStep.js.map +0 -1
- package/dist/editor/settings/setup-steps/SetupOverview.d.ts +0 -14
- package/dist/editor/settings/setup-steps/SetupOverview.js +0 -38
- package/dist/editor/settings/setup-steps/SetupOverview.js.map +0 -1
- package/dist/editor/sidebar/Debug.d.ts +0 -1
- package/dist/editor/sidebar/Debug.js +0 -70
- package/dist/editor/sidebar/Debug.js.map +0 -1
- package/dist/editor/sidebar/GraphQL.d.ts +0 -2
- package/dist/editor/sidebar/GraphQL.js +0 -234
- package/dist/editor/sidebar/GraphQL.js.map +0 -1
- package/dist/editor/sidebar/LeftToolbar.d.ts +0 -1
- package/dist/editor/sidebar/LeftToolbar.js +0 -12
- package/dist/editor/sidebar/LeftToolbar.js.map +0 -1
- package/dist/editor/sidebar/NavigationSidebar.d.ts +0 -4
- package/dist/editor/sidebar/NavigationSidebar.js +0 -254
- package/dist/editor/sidebar/NavigationSidebar.js.map +0 -1
- package/dist/editor/tree-indicators/GutterSelector.d.ts +0 -5
- package/dist/editor/tree-indicators/GutterSelector.js +0 -91
- package/dist/editor/tree-indicators/GutterSelector.js.map +0 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useMemo, memo, useEffect, useRef } from "react";
|
|
3
3
|
import { JsonView, defaultStyles } from "react-json-view-lite";
|
|
4
4
|
import "react-json-view-lite/dist/index.css";
|
|
5
5
|
import { Spinner } from "../ui/Spinner";
|
|
6
6
|
import { Button } from "../../components/ui/button";
|
|
7
7
|
import { CopyButton } from "../../components/ui/copy-button";
|
|
8
|
-
import {
|
|
8
|
+
import { Tooltip, TooltipTrigger, TooltipContent, } from "../../components/ui/tooltip";
|
|
9
|
+
import { approveToolCall, approveToolCalls, createOperationAllowance, rejectToolCall, updateAgentSettings, } from "../services/agentService";
|
|
10
|
+
import { formatTime } from "../utils";
|
|
9
11
|
// Custom dark theme styles for JSON view
|
|
10
12
|
const darkJsonStyles = {
|
|
11
13
|
...defaultStyles,
|
|
@@ -29,7 +31,7 @@ const JsonLightThemeStyles = () => (_jsx("style", { children: `
|
|
|
29
31
|
.dark-json-null { color: #dc2626; }
|
|
30
32
|
.dark-json-undefined { color: #dc2626; }
|
|
31
33
|
` }));
|
|
32
|
-
import { FileText, Search, Code, FolderOpen, FileSearch, Trash2, Globe, Brain, CheckSquare, Edit, FileEdit, Wrench, ChevronDown, ChevronRight, } from "lucide-react";
|
|
34
|
+
import { FileText, Search, Code, FolderOpen, FileSearch, Trash2, Globe, Brain, CheckSquare, Edit, FileEdit, Wrench, ChevronDown, ChevronRight, Check, X, ShieldCheck, } from "lucide-react";
|
|
33
35
|
// Function to get the appropriate icon for each tool
|
|
34
36
|
const getToolIcon = (toolName) => {
|
|
35
37
|
const iconMap = {
|
|
@@ -49,7 +51,7 @@ const getToolIcon = (toolName) => {
|
|
|
49
51
|
"remove-component": _jsx(Trash2, { strokeWidth: 1, size: 14 }),
|
|
50
52
|
"move-components": _jsx(Edit, { strokeWidth: 1, size: 14 }),
|
|
51
53
|
"get-placeholders": _jsx(Code, { strokeWidth: 1, size: 14 }),
|
|
52
|
-
"get-component-
|
|
54
|
+
"get-component-schema-with-placeholders": _jsx(Code, { strokeWidth: 1, size: 14 }),
|
|
53
55
|
// Search operations
|
|
54
56
|
"search-content": _jsx(Search, { strokeWidth: 1, size: 14 }),
|
|
55
57
|
"search-images": _jsx(FileSearch, { strokeWidth: 1, size: 14 }),
|
|
@@ -68,6 +70,45 @@ const getToolIcon = (toolName) => {
|
|
|
68
70
|
};
|
|
69
71
|
return iconMap[toolName] || iconMap.default;
|
|
70
72
|
};
|
|
73
|
+
const formatToolDuration = (durationMs) => {
|
|
74
|
+
if (typeof durationMs !== "number" ||
|
|
75
|
+
!Number.isFinite(durationMs) ||
|
|
76
|
+
durationMs < 0) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
if (durationMs < 1000) {
|
|
80
|
+
return `${Math.round(durationMs)}ms`;
|
|
81
|
+
}
|
|
82
|
+
if (durationMs < 10_000) {
|
|
83
|
+
return `${(durationMs / 1000).toFixed(1)}s`;
|
|
84
|
+
}
|
|
85
|
+
if (durationMs < 60_000) {
|
|
86
|
+
return `${Math.round(durationMs / 1000)}s`;
|
|
87
|
+
}
|
|
88
|
+
const totalSeconds = Math.round(durationMs / 1000);
|
|
89
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
90
|
+
const seconds = totalSeconds % 60;
|
|
91
|
+
if (minutes < 60) {
|
|
92
|
+
return seconds > 0 ? `${minutes}m ${seconds}s` : `${minutes}m`;
|
|
93
|
+
}
|
|
94
|
+
const hours = Math.floor(minutes / 60);
|
|
95
|
+
const remainingMinutes = minutes % 60;
|
|
96
|
+
return remainingMinutes > 0 ? `${hours}h ${remainingMinutes}m` : `${hours}h`;
|
|
97
|
+
};
|
|
98
|
+
const formatToolCallMeta = (createdDate, durationMs) => {
|
|
99
|
+
const parts = [];
|
|
100
|
+
if (createdDate) {
|
|
101
|
+
const parsed = new Date(createdDate);
|
|
102
|
+
if (!Number.isNaN(parsed.getTime())) {
|
|
103
|
+
parts.push(formatTime(parsed));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const duration = formatToolDuration(durationMs);
|
|
107
|
+
if (duration) {
|
|
108
|
+
parts.push(duration);
|
|
109
|
+
}
|
|
110
|
+
return parts.length > 0 ? parts.join(" • ") : null;
|
|
111
|
+
};
|
|
71
112
|
// Helper function to normalize tool calls to a common format
|
|
72
113
|
const normalizeToolCall = (toolCall) => {
|
|
73
114
|
if ("functionName" in toolCall) {
|
|
@@ -78,10 +119,14 @@ const normalizeToolCall = (toolCall) => {
|
|
|
78
119
|
function: {
|
|
79
120
|
name: toolCall.functionName,
|
|
80
121
|
arguments: toolCall.functionArguments,
|
|
81
|
-
result: toolCall.functionResult,
|
|
122
|
+
result: toolCall.functionResultRichContent || toolCall.functionResult,
|
|
82
123
|
error: toolCall.functionError,
|
|
83
124
|
},
|
|
84
125
|
requiresApproval: toolCall.requiresApproval,
|
|
126
|
+
isPruned: toolCall.isPruned,
|
|
127
|
+
prunedAt: toolCall.prunedAt,
|
|
128
|
+
responseTimeMs: toolCall.responseTimeMs,
|
|
129
|
+
createdDate: toolCall.createdDate,
|
|
85
130
|
};
|
|
86
131
|
}
|
|
87
132
|
// Already in base format
|
|
@@ -133,6 +178,129 @@ const parseJsonString = (json) => {
|
|
|
133
178
|
}
|
|
134
179
|
}
|
|
135
180
|
};
|
|
181
|
+
const isImageDataUrl = (value) => {
|
|
182
|
+
return typeof value === "string" && /^data:image\//i.test(value.trim());
|
|
183
|
+
};
|
|
184
|
+
const getInlineImageSource = (value) => {
|
|
185
|
+
if (isImageDataUrl(value)) {
|
|
186
|
+
return value.trim();
|
|
187
|
+
}
|
|
188
|
+
if (!value || typeof value !== "object") {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
const candidate = value;
|
|
192
|
+
if (isImageDataUrl(candidate.dataUrl)) {
|
|
193
|
+
return candidate.dataUrl.trim();
|
|
194
|
+
}
|
|
195
|
+
if (isImageDataUrl(candidate.url)) {
|
|
196
|
+
return candidate.url.trim();
|
|
197
|
+
}
|
|
198
|
+
if (isImageDataUrl(candidate.src)) {
|
|
199
|
+
return candidate.src.trim();
|
|
200
|
+
}
|
|
201
|
+
const imageUrlCandidate = candidate.imageUrl ?? candidate.image_url;
|
|
202
|
+
if (imageUrlCandidate && typeof imageUrlCandidate === "object") {
|
|
203
|
+
const imageUrlRecord = imageUrlCandidate;
|
|
204
|
+
if (isImageDataUrl(imageUrlRecord.url)) {
|
|
205
|
+
return imageUrlRecord.url.trim();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return null;
|
|
209
|
+
};
|
|
210
|
+
const extractInlineToolResultImage = (value) => {
|
|
211
|
+
const directSource = getInlineImageSource(value);
|
|
212
|
+
if (directSource) {
|
|
213
|
+
return {
|
|
214
|
+
src: directSource,
|
|
215
|
+
alt: "Tool result image",
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
if (Array.isArray(value)) {
|
|
219
|
+
for (const entry of value) {
|
|
220
|
+
const preview = extractInlineToolResultImage(entry);
|
|
221
|
+
if (preview) {
|
|
222
|
+
return preview;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return null;
|
|
226
|
+
}
|
|
227
|
+
if (!value || typeof value !== "object") {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
const candidate = value;
|
|
231
|
+
const nestedImage = candidate.image && typeof candidate.image === "object"
|
|
232
|
+
? candidate.image
|
|
233
|
+
: undefined;
|
|
234
|
+
const richImageSource = getInlineImageSource(candidate.imageUrl ??
|
|
235
|
+
candidate.image_url);
|
|
236
|
+
const src = isImageDataUrl(nestedImage?.dataUrl)
|
|
237
|
+
? nestedImage?.dataUrl.trim()
|
|
238
|
+
: isImageDataUrl(candidate.dataUrl)
|
|
239
|
+
? candidate.dataUrl.trim()
|
|
240
|
+
: richImageSource
|
|
241
|
+
? richImageSource
|
|
242
|
+
: null;
|
|
243
|
+
if (!src) {
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
const width = typeof candidate.imageWidth === "number" &&
|
|
247
|
+
Number.isFinite(candidate.imageWidth)
|
|
248
|
+
? candidate.imageWidth
|
|
249
|
+
: typeof nestedImage?.width === "number" &&
|
|
250
|
+
Number.isFinite(nestedImage.width)
|
|
251
|
+
? nestedImage.width
|
|
252
|
+
: undefined;
|
|
253
|
+
const height = typeof candidate.imageHeight === "number" &&
|
|
254
|
+
Number.isFinite(candidate.imageHeight)
|
|
255
|
+
? candidate.imageHeight
|
|
256
|
+
: typeof nestedImage?.height === "number" &&
|
|
257
|
+
Number.isFinite(nestedImage.height)
|
|
258
|
+
? nestedImage.height
|
|
259
|
+
: undefined;
|
|
260
|
+
return {
|
|
261
|
+
src,
|
|
262
|
+
alt: candidate.scope
|
|
263
|
+
? `Screenshot result (${candidate.scope})`
|
|
264
|
+
: "Tool result image",
|
|
265
|
+
fileName: nestedImage?.fileName || candidate.fileName,
|
|
266
|
+
dimensions: width && height
|
|
267
|
+
? `${Math.round(width)} x ${Math.round(height)}`
|
|
268
|
+
: undefined,
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
const sanitizeInlineImageDataForDisplay = (value) => {
|
|
272
|
+
if (isImageDataUrl(value)) {
|
|
273
|
+
return "[image data URL omitted from preview]";
|
|
274
|
+
}
|
|
275
|
+
if (Array.isArray(value)) {
|
|
276
|
+
let hasChanges = false;
|
|
277
|
+
const sanitizedItems = value.map((entry) => {
|
|
278
|
+
const sanitizedEntry = sanitizeInlineImageDataForDisplay(entry);
|
|
279
|
+
if (sanitizedEntry !== entry) {
|
|
280
|
+
hasChanges = true;
|
|
281
|
+
}
|
|
282
|
+
return sanitizedEntry;
|
|
283
|
+
});
|
|
284
|
+
return hasChanges ? sanitizedItems : value;
|
|
285
|
+
}
|
|
286
|
+
if (!value || typeof value !== "object") {
|
|
287
|
+
return value;
|
|
288
|
+
}
|
|
289
|
+
const candidate = value;
|
|
290
|
+
let hasChanges = false;
|
|
291
|
+
const clone = {};
|
|
292
|
+
Object.entries(candidate).forEach(([key, entryValue]) => {
|
|
293
|
+
const sanitizedValue = sanitizeInlineImageDataForDisplay(entryValue);
|
|
294
|
+
clone[key] = sanitizedValue;
|
|
295
|
+
if (sanitizedValue !== entryValue) {
|
|
296
|
+
hasChanges = true;
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
return hasChanges ? clone : value;
|
|
300
|
+
};
|
|
301
|
+
const InlineToolResultPreview = ({ preview, }) => {
|
|
302
|
+
return (_jsxs("a", { href: preview.src, target: "_blank", rel: "noopener noreferrer", className: "mb-2 block overflow-hidden rounded border border-gray-200 bg-white transition-colors hover:border-gray-300", children: [_jsx("img", { src: preview.src, alt: preview.alt, loading: "lazy", className: "max-h-40 w-auto max-w-full bg-gray-100 object-contain" }), (preview.fileName || preview.dimensions) && (_jsxs("div", { className: "flex items-center justify-between gap-3 border-t border-gray-100 px-2 py-1 text-[10px] text-gray-500", children: [_jsx("span", { className: "truncate", children: preview.fileName || "Screenshot" }), preview.dimensions && (_jsx("span", { className: "shrink-0", children: preview.dimensions }))] }))] }));
|
|
303
|
+
};
|
|
136
304
|
// Helper function to render JSON or text
|
|
137
305
|
const renderJsonOrText = (json) => {
|
|
138
306
|
const parsed = parseJsonString(json);
|
|
@@ -141,7 +309,7 @@ const renderJsonOrText = (json) => {
|
|
|
141
309
|
}
|
|
142
310
|
// If parsing failed, display as plain text
|
|
143
311
|
const jsonString = typeof json === "string" ? json : String(json);
|
|
144
|
-
return (_jsx("div", { className: "font-mono text-xs break-
|
|
312
|
+
return (_jsx("div", { className: "font-mono text-xs wrap-break-word whitespace-pre-wrap text-gray-700", children: jsonString }));
|
|
145
313
|
};
|
|
146
314
|
// Expandable panel component
|
|
147
315
|
const ExpandablePanel = ({ title, children, defaultExpanded = false, actionButton, }) => {
|
|
@@ -149,9 +317,15 @@ const ExpandablePanel = ({ title, children, defaultExpanded = false, actionButto
|
|
|
149
317
|
return (_jsxs("div", { className: "border-b border-gray-100 last:border-b-0", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex flex-1 cursor-pointer items-center gap-1.5 px-3 py-1.5 transition-colors hover:bg-gray-50/50", onClick: () => setIsExpanded(!isExpanded), children: [isExpanded ? (_jsx(ChevronDown, { size: 12, strokeWidth: 1.5, className: "text-gray-400 transition-transform" })) : (_jsx(ChevronRight, { size: 12, strokeWidth: 1.5, className: "text-gray-400 transition-transform" })), _jsx("span", { className: "text-[10px] font-medium text-gray-500", children: title })] }), actionButton && (_jsx("div", { className: "pr-2", onClick: (e) => e.stopPropagation(), children: actionButton }))] }), isExpanded && (_jsx("div", { className: "w-full overflow-auto px-3 pb-2", children: children }))] }));
|
|
150
318
|
};
|
|
151
319
|
// Helper function to create expandable tool call details
|
|
152
|
-
const ToolCallDetails = memo(({ toolCall, result }) => {
|
|
153
|
-
const
|
|
154
|
-
const
|
|
320
|
+
const ToolCallDetails = memo(({ toolCall, result, }) => {
|
|
321
|
+
const isPruned = !!toolCall.isPruned;
|
|
322
|
+
const hasError = !!toolCall.function?.error && !isPruned;
|
|
323
|
+
const hasOutput = !!result || hasError || isPruned;
|
|
324
|
+
const prunedOutput = useMemo(() => {
|
|
325
|
+
if (!isPruned)
|
|
326
|
+
return "";
|
|
327
|
+
return result || toolCall.function?.error || "";
|
|
328
|
+
}, [isPruned, result, toolCall.function?.error]);
|
|
155
329
|
// Memoize parsed input data to prevent re-parsing on every render
|
|
156
330
|
const parsedInput = useMemo(() => {
|
|
157
331
|
return parseJsonString(toolCall.function?.arguments || "");
|
|
@@ -160,6 +334,31 @@ const ToolCallDetails = memo(({ toolCall, result }) => {
|
|
|
160
334
|
const parsedOutput = useMemo(() => {
|
|
161
335
|
return parseJsonString(result || "");
|
|
162
336
|
}, [result]);
|
|
337
|
+
const parsedPrunedOutput = useMemo(() => {
|
|
338
|
+
return parseJsonString(prunedOutput);
|
|
339
|
+
}, [prunedOutput]);
|
|
340
|
+
const outputPreview = useMemo(() => {
|
|
341
|
+
if (isPruned) {
|
|
342
|
+
return extractInlineToolResultImage(parsedPrunedOutput ?? prunedOutput);
|
|
343
|
+
}
|
|
344
|
+
if (hasError) {
|
|
345
|
+
return null;
|
|
346
|
+
}
|
|
347
|
+
return extractInlineToolResultImage(parsedOutput ?? (result || ""));
|
|
348
|
+
}, [
|
|
349
|
+
hasError,
|
|
350
|
+
isPruned,
|
|
351
|
+
parsedOutput,
|
|
352
|
+
parsedPrunedOutput,
|
|
353
|
+
prunedOutput,
|
|
354
|
+
result,
|
|
355
|
+
]);
|
|
356
|
+
const displayPrunedOutput = useMemo(() => {
|
|
357
|
+
return sanitizeInlineImageDataForDisplay(parsedPrunedOutput ?? prunedOutput);
|
|
358
|
+
}, [parsedPrunedOutput, prunedOutput]);
|
|
359
|
+
const displayOutput = useMemo(() => {
|
|
360
|
+
return sanitizeInlineImageDataForDisplay(parsedOutput ?? (result || ""));
|
|
361
|
+
}, [parsedOutput, result]);
|
|
163
362
|
// Get text to copy for input
|
|
164
363
|
const inputTextToCopy = useMemo(() => {
|
|
165
364
|
const args = toolCall.function?.arguments || "";
|
|
@@ -170,63 +369,215 @@ const ToolCallDetails = memo(({ toolCall, result }) => {
|
|
|
170
369
|
}, [toolCall.function?.arguments, parsedInput]);
|
|
171
370
|
// Get text to copy for output
|
|
172
371
|
const outputTextToCopy = useMemo(() => {
|
|
372
|
+
if (isPruned) {
|
|
373
|
+
if (parsedPrunedOutput !== null) {
|
|
374
|
+
return JSON.stringify(parsedPrunedOutput, null, 2);
|
|
375
|
+
}
|
|
376
|
+
return typeof prunedOutput === "object"
|
|
377
|
+
? JSON.stringify(prunedOutput, null, 2)
|
|
378
|
+
: prunedOutput;
|
|
379
|
+
}
|
|
173
380
|
if (hasError) {
|
|
174
381
|
return toolCall.function?.error || "";
|
|
175
382
|
}
|
|
176
383
|
if (parsedOutput !== null) {
|
|
177
384
|
return JSON.stringify(parsedOutput, null, 2);
|
|
178
385
|
}
|
|
386
|
+
if (typeof result === "object") {
|
|
387
|
+
return JSON.stringify(result, null, 2);
|
|
388
|
+
}
|
|
179
389
|
return result || "";
|
|
180
|
-
}, [
|
|
181
|
-
|
|
390
|
+
}, [
|
|
391
|
+
hasError,
|
|
392
|
+
isPruned,
|
|
393
|
+
toolCall.function?.error,
|
|
394
|
+
parsedOutput,
|
|
395
|
+
parsedPrunedOutput,
|
|
396
|
+
prunedOutput,
|
|
397
|
+
result,
|
|
398
|
+
]);
|
|
399
|
+
return (_jsxs("div", { className: "mt-1 ml-5 overflow-hidden rounded border border-gray-200/60 bg-gray-50/40", children: [_jsx(ExpandablePanel, { title: "Input", defaultExpanded: !hasOutput, actionButton: _jsx(CopyButton, { textToCopy: inputTextToCopy, iconOnly: true, className: "cursor-pointer text-gray-400 hover:text-gray-600" }), children: _jsx("div", { className: "rounded bg-white p-2 text-xs", children: parsedInput !== null ? (_jsx(MemoizedJsonView, { data: parsedInput })) : (_jsx("div", { className: "font-mono text-xs wrap-break-word whitespace-pre-wrap text-gray-700", children: toolCall.function?.arguments || "" })) }) }), hasOutput && (_jsx(ExpandablePanel, { title: isPruned ? "Pruned" : hasError ? "Error" : "Output", defaultExpanded: true, actionButton: _jsx(CopyButton, { textToCopy: outputTextToCopy, iconOnly: true, className: "cursor-pointer text-gray-400 hover:text-gray-600" }), children: isPruned ? (_jsxs("div", { className: "rounded border-l-2 border-slate-400 bg-slate-50/70 p-2 text-xs text-slate-700", children: [_jsx("div", { className: "mb-1 text-[10px] font-medium text-slate-600", children: "Pruned from AI context" }), _jsx("div", { className: "mb-2 text-slate-600", children: "This tool call completed, but its output was pruned from future agent context to save tokens." }), prunedOutput ? (_jsxs("div", { className: "rounded bg-white p-2 text-xs", children: [outputPreview && (_jsx(InlineToolResultPreview, { preview: outputPreview })), displayPrunedOutput !== null &&
|
|
400
|
+
typeof displayPrunedOutput === "object" ? (_jsx(MemoizedJsonView, { data: displayPrunedOutput })) : (_jsx("div", { className: "font-mono text-xs wrap-break-word whitespace-pre-wrap text-gray-700", children: String(displayPrunedOutput ?? prunedOutput) }))] })) : null] })) : hasError ? (_jsxs("div", { className: "rounded border-l-2 border-red-400 bg-red-50/60 p-2 text-xs text-red-700", children: [_jsx("div", { className: "mb-1 text-[10px] font-medium text-red-600", children: "Error" }), _jsx("div", { className: "text-red-600", children: toolCall.function?.error })] })) : (_jsxs("div", { className: "rounded bg-white p-2 text-xs", children: [outputPreview && (_jsx(InlineToolResultPreview, { preview: outputPreview })), displayOutput !== null && typeof displayOutput === "object" ? (_jsx(MemoizedJsonView, { data: displayOutput })) : (_jsx("div", { className: "font-mono text-xs wrap-break-word whitespace-pre-wrap text-gray-700", children: String(displayOutput ?? (result || "")) }))] })) }))] }));
|
|
182
401
|
}, (prevProps, nextProps) => {
|
|
183
402
|
// Only re-render if the data actually changed
|
|
184
403
|
return (prevProps.toolCall.id === nextProps.toolCall.id &&
|
|
185
404
|
prevProps.toolCall.function?.arguments ===
|
|
186
405
|
nextProps.toolCall.function?.arguments &&
|
|
187
406
|
prevProps.result === nextProps.result &&
|
|
188
|
-
prevProps.toolCall.function?.error ===
|
|
407
|
+
prevProps.toolCall.function?.error ===
|
|
408
|
+
nextProps.toolCall.function?.error &&
|
|
409
|
+
prevProps.toolCall.isPruned === nextProps.toolCall.isPruned);
|
|
189
410
|
});
|
|
190
411
|
ToolCallDetails.displayName = "ToolCallDetails";
|
|
191
|
-
export function ToolCallDisplay({ toolCalls, finished, openPopovers, setOpenPopovers, messageId, agentId, allPendingApprovals = [], onSwitchToAutonomous, seenApprovalDialogs, onApprovalDialogShown, }) {
|
|
192
|
-
const [
|
|
412
|
+
export function ToolCallDisplay({ toolCalls, finished, openPopovers, setOpenPopovers, messageId, agentId, allPendingApprovals = [], onSwitchToAutonomous, seenApprovalDialogs, onApprovalDialogShown, browserCaptureInlinePrompt, }) {
|
|
413
|
+
const [batchRiskAction, setBatchRiskAction] = useState(null);
|
|
193
414
|
const [isSwitchingMode, setIsSwitchingMode] = useState(false);
|
|
415
|
+
const [isGroupExpanded, setIsGroupExpanded] = useState(() => {
|
|
416
|
+
return (toolCalls?.some((tc) => {
|
|
417
|
+
if (!tc.requiresApproval)
|
|
418
|
+
return false;
|
|
419
|
+
const funcName = ("functionName" in tc
|
|
420
|
+
? tc.functionName
|
|
421
|
+
: normalizeToolCall(tc).function?.name) || "";
|
|
422
|
+
return (!funcName.includes("(approved)") && !funcName.includes("(rejected)"));
|
|
423
|
+
}) ?? false);
|
|
424
|
+
});
|
|
425
|
+
const [userToggled, setUserToggled] = useState(false);
|
|
426
|
+
const hasPendingApprovalsInGroup = useMemo(() => {
|
|
427
|
+
if (!toolCalls)
|
|
428
|
+
return false;
|
|
429
|
+
return toolCalls.some((tc) => {
|
|
430
|
+
if (!tc.requiresApproval)
|
|
431
|
+
return false;
|
|
432
|
+
const funcName = ("functionName" in tc
|
|
433
|
+
? tc.functionName
|
|
434
|
+
: normalizeToolCall(tc).function?.name) || "";
|
|
435
|
+
return (!funcName.includes("(approved)") && !funcName.includes("(rejected)"));
|
|
436
|
+
});
|
|
437
|
+
}, [toolCalls]);
|
|
438
|
+
useEffect(() => {
|
|
439
|
+
if (!userToggled) {
|
|
440
|
+
setIsGroupExpanded(hasPendingApprovalsInGroup);
|
|
441
|
+
}
|
|
442
|
+
}, [userToggled, hasPendingApprovalsInGroup]);
|
|
443
|
+
const groupSummary = useMemo(() => {
|
|
444
|
+
if (!toolCalls || toolCalls.length === 0)
|
|
445
|
+
return null;
|
|
446
|
+
const uniqueNames = [
|
|
447
|
+
...new Set(toolCalls
|
|
448
|
+
.map((tc) => {
|
|
449
|
+
const normalized = normalizeToolCall(tc);
|
|
450
|
+
return (("functionName" in tc
|
|
451
|
+
? tc.functionName
|
|
452
|
+
: normalized.function?.name) || "")
|
|
453
|
+
.replace(/ \(approved\)/g, "")
|
|
454
|
+
.replace(/ \(rejected\)/g, "")
|
|
455
|
+
.replace(/ \(pending approval\)/g, "")
|
|
456
|
+
.trim();
|
|
457
|
+
})
|
|
458
|
+
.filter(Boolean)),
|
|
459
|
+
];
|
|
460
|
+
const errorCount = toolCalls.filter((tc) => {
|
|
461
|
+
const normalized = normalizeToolCall(tc);
|
|
462
|
+
return !!normalized.function?.error && !normalized.isPruned;
|
|
463
|
+
}).length;
|
|
464
|
+
return { uniqueNames, errorCount };
|
|
465
|
+
}, [toolCalls]);
|
|
466
|
+
const shouldShowGroupBrowserCaptureInlinePrompt = useMemo(() => {
|
|
467
|
+
if (!browserCaptureInlinePrompt || !toolCalls?.length)
|
|
468
|
+
return false;
|
|
469
|
+
return toolCalls.some((tc) => {
|
|
470
|
+
const normalized = normalizeToolCall(tc);
|
|
471
|
+
const originalFunctionName = ("functionName" in tc ? tc.functionName : normalized.function?.name) || "";
|
|
472
|
+
const baseFunctionName = originalFunctionName
|
|
473
|
+
.replace(" (approved)", "")
|
|
474
|
+
.replace(" (rejected)", "")
|
|
475
|
+
.replace(" (pending approval)", "")
|
|
476
|
+
.trim()
|
|
477
|
+
.toLowerCase();
|
|
478
|
+
const approvalInfo = tc.requiresApproval || normalized.requiresApproval;
|
|
479
|
+
const isCompleted = "isCompleted" in tc
|
|
480
|
+
? tc.isCompleted
|
|
481
|
+
: !!(normalized.function?.result || normalized.function?.error) &&
|
|
482
|
+
!approvalInfo;
|
|
483
|
+
return (browserCaptureInlinePrompt.toolNames.includes(baseFunctionName) &&
|
|
484
|
+
!isCompleted &&
|
|
485
|
+
!normalized.function?.error);
|
|
486
|
+
});
|
|
487
|
+
}, [browserCaptureInlinePrompt, toolCalls]);
|
|
488
|
+
const allToolCallsCompleted = useMemo(() => {
|
|
489
|
+
if (!toolCalls || toolCalls.length === 0)
|
|
490
|
+
return false;
|
|
491
|
+
return toolCalls.every((tc) => {
|
|
492
|
+
const isAgentToolCall = "isCompleted" in tc;
|
|
493
|
+
if (isAgentToolCall)
|
|
494
|
+
return tc.isCompleted;
|
|
495
|
+
const normalized = normalizeToolCall(tc);
|
|
496
|
+
const approvalInfo = tc.requiresApproval || normalized.requiresApproval;
|
|
497
|
+
return !!(normalized.function?.result || normalized.function?.error) && !approvalInfo;
|
|
498
|
+
});
|
|
499
|
+
}, [toolCalls]);
|
|
194
500
|
if (!toolCalls || toolCalls.length === 0) {
|
|
195
501
|
return null;
|
|
196
502
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
if (!agentId || isApprovingAll)
|
|
200
|
-
return;
|
|
201
|
-
const matchingPending = allPendingApprovals.filter((p) => (p.riskLevel || undefined) === riskLevel);
|
|
202
|
-
if (matchingPending.length === 0)
|
|
503
|
+
const resolvePendingToolCalls = async (pendingToolCalls, approved) => {
|
|
504
|
+
if (!agentId || pendingToolCalls.length === 0)
|
|
203
505
|
return;
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
506
|
+
const actionLabel = approved ? "approve" : "reject";
|
|
507
|
+
if (approved && pendingToolCalls.length > 1) {
|
|
508
|
+
const result = await approveToolCalls({
|
|
509
|
+
agentId,
|
|
510
|
+
toolCalls: pendingToolCalls.map((pending) => ({
|
|
511
|
+
messageId: pending.dbMessageId || pending.messageId,
|
|
512
|
+
toolCallId: pending.toolCallId,
|
|
513
|
+
})),
|
|
514
|
+
});
|
|
515
|
+
const approvedToolCallIds = new Set(result.approvedToolCallIds || []);
|
|
516
|
+
pendingToolCalls.forEach((pending) => {
|
|
517
|
+
if (!approvedToolCallIds.has(pending.toolCallId)) {
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
window.dispatchEvent(new CustomEvent("agent:toolApprovalResolved", {
|
|
521
|
+
detail: {
|
|
211
522
|
messageId: pending.dbMessageId || pending.messageId,
|
|
212
523
|
toolCallId: pending.toolCallId,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
524
|
+
approved: true,
|
|
525
|
+
},
|
|
526
|
+
}));
|
|
527
|
+
});
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
await Promise.all(pendingToolCalls.map(async (pending) => {
|
|
531
|
+
try {
|
|
532
|
+
const params = {
|
|
533
|
+
agentId,
|
|
534
|
+
messageId: pending.dbMessageId || pending.messageId,
|
|
535
|
+
toolCallId: pending.toolCallId,
|
|
536
|
+
};
|
|
537
|
+
if (approved) {
|
|
538
|
+
await approveToolCall(params);
|
|
222
539
|
}
|
|
223
|
-
|
|
224
|
-
|
|
540
|
+
else {
|
|
541
|
+
await rejectToolCall(params);
|
|
225
542
|
}
|
|
226
|
-
|
|
543
|
+
window.dispatchEvent(new CustomEvent("agent:toolApprovalResolved", {
|
|
544
|
+
detail: {
|
|
545
|
+
messageId: pending.dbMessageId || pending.messageId,
|
|
546
|
+
toolCallId: pending.toolCallId,
|
|
547
|
+
approved,
|
|
548
|
+
},
|
|
549
|
+
}));
|
|
550
|
+
}
|
|
551
|
+
catch (error) {
|
|
552
|
+
console.error(`Failed to ${actionLabel} tool call ${pending.toolCallId}:`, error);
|
|
553
|
+
}
|
|
554
|
+
}));
|
|
555
|
+
};
|
|
556
|
+
// Helper to approve/reject all pending tool calls at once
|
|
557
|
+
const handleApproveAllPending = async () => {
|
|
558
|
+
if (!agentId || batchRiskAction)
|
|
559
|
+
return;
|
|
560
|
+
if (allPendingApprovals.length === 0)
|
|
561
|
+
return;
|
|
562
|
+
setBatchRiskAction("approve");
|
|
563
|
+
try {
|
|
564
|
+
await resolvePendingToolCalls(allPendingApprovals, true);
|
|
227
565
|
}
|
|
228
566
|
finally {
|
|
229
|
-
|
|
567
|
+
setBatchRiskAction(null);
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
const handleRejectAllPending = async () => {
|
|
571
|
+
if (!agentId || batchRiskAction)
|
|
572
|
+
return;
|
|
573
|
+
if (allPendingApprovals.length === 0)
|
|
574
|
+
return;
|
|
575
|
+
setBatchRiskAction("reject");
|
|
576
|
+
try {
|
|
577
|
+
await resolvePendingToolCalls(allPendingApprovals, false);
|
|
578
|
+
}
|
|
579
|
+
finally {
|
|
580
|
+
setBatchRiskAction(null);
|
|
230
581
|
}
|
|
231
582
|
};
|
|
232
583
|
// Helper to switch to autonomous mode
|
|
@@ -235,29 +586,14 @@ export function ToolCallDisplay({ toolCalls, finished, openPopovers, setOpenPopo
|
|
|
235
586
|
return;
|
|
236
587
|
setIsSwitchingMode(true);
|
|
237
588
|
try {
|
|
238
|
-
await updateAgentSettings(agentId, { mode: "autonomous" });
|
|
589
|
+
const result = await updateAgentSettings(agentId, { mode: "autonomous" });
|
|
590
|
+
if (result.success === false || result.updates?.mode === false) {
|
|
591
|
+
throw new Error("Mode change was not applied");
|
|
592
|
+
}
|
|
239
593
|
onSwitchToAutonomous?.();
|
|
240
594
|
// After switching to autonomous, approve all remaining pending tool calls
|
|
241
595
|
if (allPendingApprovals.length > 0) {
|
|
242
|
-
await
|
|
243
|
-
try {
|
|
244
|
-
await approveToolCall({
|
|
245
|
-
agentId,
|
|
246
|
-
messageId: pending.dbMessageId || pending.messageId,
|
|
247
|
-
toolCallId: pending.toolCallId,
|
|
248
|
-
});
|
|
249
|
-
window.dispatchEvent(new CustomEvent("agent:toolApprovalResolved", {
|
|
250
|
-
detail: {
|
|
251
|
-
messageId: pending.dbMessageId || pending.messageId,
|
|
252
|
-
toolCallId: pending.toolCallId,
|
|
253
|
-
approved: true,
|
|
254
|
-
},
|
|
255
|
-
}));
|
|
256
|
-
}
|
|
257
|
-
catch (error) {
|
|
258
|
-
console.error(`Failed to approve tool call ${pending.toolCallId}:`, error);
|
|
259
|
-
}
|
|
260
|
-
}));
|
|
596
|
+
await resolvePendingToolCalls(allPendingApprovals, true);
|
|
261
597
|
}
|
|
262
598
|
}
|
|
263
599
|
catch (error) {
|
|
@@ -268,56 +604,130 @@ export function ToolCallDisplay({ toolCalls, finished, openPopovers, setOpenPopo
|
|
|
268
604
|
setIsSwitchingMode(false);
|
|
269
605
|
}
|
|
270
606
|
};
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
607
|
+
const showGroupHeader = toolCalls.length > 0;
|
|
608
|
+
return (_jsxs("div", { className: "flex flex-col", children: [showGroupHeader && (_jsxs("div", { className: "group flex cursor-pointer items-center gap-1.5 rounded-md px-1 py-1 text-xs text-gray-500 transition-all hover:bg-gray-100/60 hover:text-gray-700", onClick: () => {
|
|
609
|
+
setIsGroupExpanded((prev) => !prev);
|
|
610
|
+
setUserToggled(true);
|
|
611
|
+
}, children: [_jsx("div", { className: "flex items-center transition-transform group-hover:scale-110", children: isGroupExpanded ? (_jsx(ChevronDown, { size: 14, strokeWidth: 1.5, className: "text-gray-500" })) : (_jsx(ChevronRight, { size: 14, strokeWidth: 1.5, className: "text-gray-500" })) }), _jsx("div", { className: "flex items-center text-gray-500", children: _jsx(Wrench, { strokeWidth: 1, size: 14 }) }), _jsxs("span", { className: `font-medium ${!allToolCallsCompleted ? "animate-text-shimmer" : ""}`, children: [toolCalls.length, " tool call", toolCalls.length !== 1 ? "s" : ""] }), !isGroupExpanded && groupSummary && (_jsx("span", { className: "ml-1 min-w-0 flex-1 truncate text-[10px] text-gray-400", children: groupSummary.uniqueNames.length <= 3
|
|
612
|
+
? groupSummary.uniqueNames.join(", ")
|
|
613
|
+
: `${groupSummary.uniqueNames.slice(0, 2).join(", ")} +${groupSummary.uniqueNames.length - 2} more` })), groupSummary && groupSummary.errorCount > 0 && (_jsxs("span", { className: "ml-1 shrink-0 text-[10px] text-red-500", children: ["(", groupSummary.errorCount, " error", groupSummary.errorCount !== 1 ? "s" : "", ")"] }))] })), shouldShowGroupBrowserCaptureInlinePrompt && browserCaptureInlinePrompt && (_jsx("div", { className: "mt-2 ml-5 rounded-lg border border-blue-200 bg-blue-50 p-3 text-[11px] text-blue-900", children: _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "font-semibold", children: browserCaptureInlinePrompt.label }), _jsx("div", { className: "mt-1 text-blue-800", children: browserCaptureInlinePrompt.description })] }), _jsx("div", { className: "flex shrink-0 items-center gap-2", children: _jsx("button", { type: "button", className: "rounded border border-blue-300 bg-white px-2 py-1 text-[11px] font-medium text-blue-900 disabled:cursor-not-allowed disabled:opacity-60", disabled: browserCaptureInlinePrompt.isPending, onClick: (event) => {
|
|
614
|
+
event.stopPropagation();
|
|
615
|
+
browserCaptureInlinePrompt.onAction();
|
|
616
|
+
}, children: browserCaptureInlinePrompt.actionLabel }) })] }) })), isGroupExpanded && (_jsx("div", { className: "ml-4", children: toolCalls.map((originalToolCall, toolIndex) => {
|
|
617
|
+
const toolCall = normalizeToolCall(originalToolCall);
|
|
618
|
+
const toolResult = toolCall.function?.result;
|
|
619
|
+
const isAgentToolCall = "isCompleted" in originalToolCall;
|
|
620
|
+
const toolCallKey = ("toolCallId" in originalToolCall
|
|
621
|
+
? originalToolCall.toolCallId
|
|
622
|
+
: toolCall.id) || `${messageId}-${toolIndex}`;
|
|
623
|
+
const popoverKey = `${messageId}-${toolCallKey}`;
|
|
624
|
+
const isPruned = !!toolCall.isPruned;
|
|
625
|
+
const toolCallMeta = formatToolCallMeta(toolCall.createdDate, toolCall.responseTimeMs);
|
|
626
|
+
// Get approval information to check if tool call is pending approval
|
|
627
|
+
const approvalInfo = originalToolCall.requiresApproval || toolCall.requiresApproval;
|
|
628
|
+
const isCompleted = isAgentToolCall
|
|
629
|
+
? originalToolCall.isCompleted
|
|
630
|
+
: !!(toolResult || toolCall.function?.error) && !approvalInfo;
|
|
631
|
+
// Check if tool call is currently streaming (arguments still being generated)
|
|
632
|
+
const isStreaming = isAgentToolCall &&
|
|
633
|
+
"isStreaming" in originalToolCall &&
|
|
634
|
+
originalToolCall.isStreaming === true;
|
|
635
|
+
// Use the approval info from the backend
|
|
636
|
+
const finalApprovalInfo = approvalInfo;
|
|
637
|
+
// Check if this tool call's approval dialog has already been shown (for deduplication)
|
|
638
|
+
const toolCallIdForApproval = "toolCallId" in originalToolCall
|
|
639
|
+
? originalToolCall.toolCallId
|
|
640
|
+
: toolCall.id;
|
|
641
|
+
const approvalAlreadyShown = seenApprovalDialogs?.has(toolCallIdForApproval) ?? false;
|
|
642
|
+
// Check if this tool call has been approved/rejected (look for status indicators in function name)
|
|
643
|
+
// The AgentTerminal adds " (approved)" or " (rejected)" or " (pending approval)" to the functionName field
|
|
644
|
+
const originalFunctionName = ("functionName" in originalToolCall
|
|
645
|
+
? originalToolCall.functionName
|
|
646
|
+
: toolCall?.function?.name) || "";
|
|
647
|
+
const baseFunctionName = originalFunctionName
|
|
648
|
+
.replace(" (approved)", "")
|
|
649
|
+
.replace(" (rejected)", "")
|
|
650
|
+
.replace(" (pending approval)", "")
|
|
651
|
+
.trim()
|
|
652
|
+
.toLowerCase();
|
|
653
|
+
const isApproved = originalFunctionName.includes("(approved)");
|
|
654
|
+
const isRejected = originalFunctionName.includes("(rejected)");
|
|
655
|
+
const isPending = originalFunctionName.includes("(pending approval)");
|
|
656
|
+
// Treat only approved/rejected as final; pending should still show buttons
|
|
657
|
+
const hasApprovalStatus = isApproved || isRejected;
|
|
658
|
+
// Debug logging removed for performance
|
|
659
|
+
const isExpanded = openPopovers[popoverKey] || false;
|
|
660
|
+
const shouldShowBrowserCaptureInlinePrompt = !!browserCaptureInlinePrompt &&
|
|
661
|
+
browserCaptureInlinePrompt.toolNames.includes(baseFunctionName) &&
|
|
662
|
+
!isCompleted &&
|
|
663
|
+
!toolCall.function?.error;
|
|
664
|
+
const toolCallMessageId = originalToolCall.messageId || toolCall.messageId || messageId;
|
|
665
|
+
return (_jsxs("div", { children: [_jsxs("div", { className: "group flex cursor-pointer items-center gap-1.5 rounded-md px-1 py-1 text-xs text-gray-600 transition-all hover:bg-gray-100/60 hover:text-gray-800", onClick: () => {
|
|
666
|
+
setOpenPopovers((prev) => ({
|
|
667
|
+
...prev,
|
|
668
|
+
[popoverKey]: !prev[popoverKey],
|
|
669
|
+
}));
|
|
670
|
+
}, children: [_jsx("div", { className: "flex items-center transition-transform group-hover:scale-110", children: isExpanded ? (_jsx(ChevronDown, { size: 14, strokeWidth: 1.5, className: "text-gray-500" })) : (_jsx(ChevronRight, { size: 14, strokeWidth: 1.5, className: "text-gray-500" })) }), isCompleted ? (_jsx("div", { className: `flex items-center transition-all ${toolCall.function?.error && !isPruned
|
|
671
|
+
? "text-red-500"
|
|
672
|
+
: isPruned
|
|
673
|
+
? "text-slate-500"
|
|
674
|
+
: "text-green-600"}`, children: getToolIcon(toolCall?.function?.name || "") })) : finalApprovalInfo && !hasApprovalStatus ? (_jsx("div", { className: "flex items-center text-amber-600 transition-all", children: getToolIcon(toolCall?.function?.name || "") })) : isStreaming || !finished ? (
|
|
675
|
+
// Show spinner when tool call arguments are still being streamed or tool is executing
|
|
676
|
+
_jsx(Spinner, { size: "xs" })) : (
|
|
677
|
+
// Turn finished but tool call not completed - show static icon
|
|
678
|
+
_jsx("div", { className: "flex items-center text-gray-400 transition-all", children: getToolIcon(toolCall?.function?.name || "") })), _jsxs("div", { className: "inline-flex min-w-0 flex-1 items-center gap-2", children: [_jsxs("span", { className: `shrink-0 font-medium transition-colors ${toolCall.function?.error && !isPruned
|
|
679
|
+
? "text-red-600"
|
|
680
|
+
: isPruned
|
|
681
|
+
? "text-slate-600"
|
|
682
|
+
: ""}`, children: [(originalFunctionName ||
|
|
683
|
+
toolCall?.function?.name ||
|
|
684
|
+
toolCall?.displayName ||
|
|
685
|
+
"(function name missing)")
|
|
686
|
+
.replace(" (approved)", "")
|
|
687
|
+
.replace(" (rejected)", "")
|
|
688
|
+
.replace(" (pending approval)", ""), toolCall.function?.error && !isRejected && !isPruned && (_jsx("span", { className: "ml-1 text-red-500", children: "(error)" })), isPruned && (_jsxs("span", { className: "ml-2 inline-flex items-center gap-1 rounded-full bg-slate-100 px-2 py-0.5 text-[10px] font-semibold text-slate-700", children: [_jsx("span", { children: "\u2702" }), " Pruned"] })), finalApprovalInfo && isRejected && (_jsxs("span", { className: "ml-2 inline-flex items-center gap-1 rounded-full bg-red-100 px-2 py-0.5 text-[10px] font-semibold text-red-700", children: [_jsx("span", { children: "\u2717" }), " Rejected"] }))] }), finalApprovalInfo?.summary && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("span", { className: "min-w-0 flex-1 cursor-help truncate text-xs text-gray-500 italic", children: finalApprovalInfo.summary }) }), _jsx(TooltipContent, { side: "top", className: "max-w-md", children: finalApprovalInfo.summary })] })), _jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: [!isCompleted &&
|
|
689
|
+
finalApprovalInfo &&
|
|
690
|
+
!hasApprovalStatus && (_jsx(ApprovalDialog, { toolCallId: toolCallIdForApproval, onApprovalDialogShown: onApprovalDialogShown, finalApprovalInfo: finalApprovalInfo, isAgentToolCall: isAgentToolCall, originalToolCall: originalToolCall, toolCall: toolCall, messageId: toolCallMessageId, agentId: agentId })), toolCallMeta && (_jsx("span", { className: "text-[10px] text-gray-400", children: toolCallMeta }))] })] })] }), isExpanded && (_jsx(ToolCallDetails, { toolCall: toolCall, result: toolResult })), !shouldShowGroupBrowserCaptureInlinePrompt &&
|
|
691
|
+
shouldShowBrowserCaptureInlinePrompt &&
|
|
692
|
+
browserCaptureInlinePrompt && (_jsx("div", { className: "mt-2 ml-5 rounded-lg border border-blue-200 bg-blue-50 p-3 text-[11px] text-blue-900", children: _jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "font-semibold", children: browserCaptureInlinePrompt.label }), _jsx("div", { className: "mt-1 text-blue-800", children: browserCaptureInlinePrompt.description })] }), _jsx("div", { className: "flex shrink-0 items-center gap-2", children: _jsx("button", { type: "button", className: "rounded border border-blue-300 bg-white px-2 py-1 text-[11px] font-medium text-blue-900 disabled:cursor-not-allowed disabled:opacity-60", disabled: browserCaptureInlinePrompt.isPending, onClick: (event) => {
|
|
693
|
+
event.stopPropagation();
|
|
694
|
+
browserCaptureInlinePrompt.onAction();
|
|
695
|
+
}, children: browserCaptureInlinePrompt.actionLabel }) })] }) }))] }, toolCallKey));
|
|
696
|
+
}) })), (() => {
|
|
697
|
+
if (!hasPendingApprovalsInGroup)
|
|
698
|
+
return null;
|
|
699
|
+
const totalPending = allPendingApprovals.length;
|
|
700
|
+
const uniqueRisks = Array.from(new Set(allPendingApprovals.map((p) => p.riskLevel || undefined)));
|
|
701
|
+
const singleRisk = uniqueRisks.length === 1 ? uniqueRisks[0] : undefined;
|
|
702
|
+
const riskLabel = singleRisk
|
|
703
|
+
? `${singleRisk.charAt(0).toUpperCase()}${singleRisk.slice(1)} `
|
|
704
|
+
: "";
|
|
705
|
+
// Hide autonomous switch if any pending tool call in the group is a delete
|
|
706
|
+
const hideAutonomousSwitch = toolCalls.some((tc) => {
|
|
707
|
+
if (!tc.requiresApproval)
|
|
708
|
+
return false;
|
|
709
|
+
const name = ("functionName" in tc
|
|
710
|
+
? tc.functionName
|
|
711
|
+
: normalizeToolCall(tc).function?.name) || "";
|
|
712
|
+
const base = name
|
|
713
|
+
.replace(" (approved)", "")
|
|
714
|
+
.replace(" (rejected)", "")
|
|
715
|
+
.replace(" (pending approval)", "")
|
|
716
|
+
.trim()
|
|
717
|
+
.toLowerCase();
|
|
718
|
+
return base === "delete-item" || base === "delete-items";
|
|
719
|
+
});
|
|
720
|
+
return (_jsxs("div", { className: "mt-2 flex flex-wrap items-center justify-end gap-2 p-2", children: [!hideAutonomousSwitch && (_jsx(Button, { size: "sm", variant: "outline", disabled: isSwitchingMode, onClick: handleSwitchToAutonomous, className: "text-xs", children: isSwitchingMode ? "Switching..." : "Switch to Autonomous" })), _jsx(Button, { size: "sm", variant: "outline", "data-testid": "agent-reject-all-button", disabled: batchRiskAction !== null, onClick: handleRejectAllPending, className: "text-xs", children: batchRiskAction === "reject"
|
|
721
|
+
? "Rejecting..."
|
|
722
|
+
: `Reject All ${riskLabel}(${totalPending})` }), _jsx(Button, { size: "sm", "data-testid": "agent-approve-all-button", disabled: batchRiskAction !== null, onClick: handleApproveAllPending, className: "text-xs", children: batchRiskAction === "approve"
|
|
723
|
+
? "Approving..."
|
|
724
|
+
: `Approve All ${riskLabel}(${totalPending})` })] }));
|
|
725
|
+
})()] }));
|
|
317
726
|
}
|
|
318
727
|
// Separate component for approval dialog to properly handle useEffect
|
|
319
|
-
function ApprovalDialog({ toolCallId, onApprovalDialogShown, finalApprovalInfo, isAgentToolCall, originalToolCall, toolCall, messageId, agentId,
|
|
728
|
+
function ApprovalDialog({ toolCallId, onApprovalDialogShown, finalApprovalInfo, isAgentToolCall, originalToolCall, toolCall, messageId, agentId, }) {
|
|
320
729
|
const hasMarkedAsShown = useRef(false);
|
|
730
|
+
const [isCreatingAllowance, setIsCreatingAllowance] = useState(false);
|
|
321
731
|
// Mark dialog as shown on mount to prevent duplicate dialogs
|
|
322
732
|
// The dialog stays visible until hasApprovalStatus becomes true (after approve/reject)
|
|
323
733
|
useEffect(() => {
|
|
@@ -340,106 +750,108 @@ function ApprovalDialog({ toolCallId, onApprovalDialogShown, finalApprovalInfo,
|
|
|
340
750
|
hasMarkedAsShown.current = true;
|
|
341
751
|
}
|
|
342
752
|
};
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
753
|
+
const getActualMessageId = () => {
|
|
754
|
+
return isAgentToolCall
|
|
755
|
+
? originalToolCall.dbMessageId || originalToolCall.messageId
|
|
756
|
+
: messageId;
|
|
757
|
+
};
|
|
758
|
+
const dispatchApprovalResolved = (actualMessageId, approved) => {
|
|
759
|
+
const ev = new CustomEvent("agent:toolApprovalResolved", {
|
|
760
|
+
detail: {
|
|
761
|
+
messageId: actualMessageId,
|
|
762
|
+
toolCallId: toolCall.id,
|
|
763
|
+
approved,
|
|
764
|
+
},
|
|
765
|
+
});
|
|
766
|
+
window.dispatchEvent(ev);
|
|
767
|
+
};
|
|
768
|
+
const approveCurrentToolCall = async () => {
|
|
769
|
+
const actualMessageId = getActualMessageId();
|
|
770
|
+
if (!agentId) {
|
|
771
|
+
console.error("Cannot approve tool call: agentId is missing");
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
if (!actualMessageId) {
|
|
775
|
+
console.error("Cannot approve tool call: messageId is missing");
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
await approveToolCall({
|
|
779
|
+
agentId,
|
|
780
|
+
messageId: actualMessageId,
|
|
781
|
+
toolCallId: toolCall.id,
|
|
782
|
+
});
|
|
783
|
+
dispatchApprovalResolved(actualMessageId, true);
|
|
784
|
+
};
|
|
785
|
+
const allowableScope = finalApprovalInfo.allowableScope;
|
|
786
|
+
const showAllowInScopeButton = !!agentId &&
|
|
787
|
+
allowableScope?.operationType === "delete" &&
|
|
788
|
+
!!allowableScope.parentItemId &&
|
|
789
|
+
!!allowableScope.parentItemPath;
|
|
790
|
+
const riskLevel = finalApprovalInfo.riskLevel;
|
|
791
|
+
const riskTagClass = riskLevel === "high"
|
|
792
|
+
? "bg-red-100 text-red-700"
|
|
793
|
+
: riskLevel === "medium"
|
|
794
|
+
? "bg-amber-100 text-amber-700"
|
|
795
|
+
: "bg-green-100 text-green-700";
|
|
796
|
+
return (_jsxs(_Fragment, { children: [riskLevel && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("span", { className: `shrink-0 cursor-help rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase ${riskTagClass}`, children: riskLevel }) }), _jsxs(TooltipContent, { side: "top", className: "max-w-xs", children: [_jsxs("div", { className: "font-semibold", children: ["Risk: ", riskLevel.toUpperCase()] }), _jsx("div", { className: "mt-0.5 font-normal opacity-90", children: finalApprovalInfo.summary })] })] })), showAllowInScopeButton && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", "aria-label": isCreatingAllowance
|
|
797
|
+
? "Allowing..."
|
|
798
|
+
: `Allow deletes in ${allowableScope?.parentItemPath}`, disabled: isCreatingAllowance, className: "flex size-5 shrink-0 items-center justify-center rounded text-gray-500 hover:bg-gray-100 hover:text-gray-900 disabled:cursor-not-allowed disabled:opacity-60", onClick: async (e) => {
|
|
799
|
+
e.stopPropagation();
|
|
800
|
+
markAsShown();
|
|
801
|
+
if (!agentId || !allowableScope?.parentItemId)
|
|
802
|
+
return;
|
|
803
|
+
setIsCreatingAllowance(true);
|
|
804
|
+
try {
|
|
805
|
+
await createOperationAllowance({
|
|
367
806
|
agentId,
|
|
368
|
-
|
|
369
|
-
|
|
807
|
+
itemId: allowableScope.parentItemId,
|
|
808
|
+
operationType: "delete",
|
|
809
|
+
scopeType: "itemSubtree",
|
|
370
810
|
});
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
: messageId;
|
|
397
|
-
if (!agentId) {
|
|
398
|
-
console.error("❌ Cannot approve tool call: agentId is missing");
|
|
399
|
-
return;
|
|
400
|
-
}
|
|
401
|
-
if (!actualMessageId) {
|
|
402
|
-
console.error("❌ Cannot approve tool call: messageId is missing");
|
|
403
|
-
return;
|
|
404
|
-
}
|
|
405
|
-
console.log("✅ Approving tool call:", {
|
|
811
|
+
await approveCurrentToolCall();
|
|
812
|
+
}
|
|
813
|
+
catch (error) {
|
|
814
|
+
console.error("Failed to create operation allowance:", error);
|
|
815
|
+
alert(`Failed to allow deletes in scope: ${error?.message || "Unknown error"}`);
|
|
816
|
+
}
|
|
817
|
+
finally {
|
|
818
|
+
setIsCreatingAllowance(false);
|
|
819
|
+
}
|
|
820
|
+
}, children: _jsx(ShieldCheck, { className: "size-3" }) }) }), _jsx(TooltipContent, { side: "top", children: isCreatingAllowance
|
|
821
|
+
? "Allowing..."
|
|
822
|
+
: `Allow deletes in ${allowableScope?.parentItemPath}` })] })), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", "aria-label": "Reject", "data-testid": "agent-reject-button", className: "flex size-5 shrink-0 items-center justify-center rounded text-red-600 hover:bg-red-50 hover:text-red-700", onClick: async (e) => {
|
|
823
|
+
e.stopPropagation();
|
|
824
|
+
markAsShown();
|
|
825
|
+
const actualMessageId = getActualMessageId();
|
|
826
|
+
if (!agentId) {
|
|
827
|
+
console.error("❌ Cannot reject tool call: agentId is missing");
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
if (!actualMessageId) {
|
|
831
|
+
console.error("❌ Cannot reject tool call: messageId is missing");
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
try {
|
|
835
|
+
await rejectToolCall({
|
|
406
836
|
agentId,
|
|
407
837
|
messageId: actualMessageId,
|
|
408
838
|
toolCallId: toolCall.id,
|
|
409
839
|
});
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
catch (error) {
|
|
427
|
-
console.error("❌ Approve failed:", error);
|
|
428
|
-
alert(`Failed to approve: ${error?.message || "Unknown error"}`);
|
|
429
|
-
}
|
|
430
|
-
}, children: "Approve" })] }), (() => {
|
|
431
|
-
const currentRiskLevel = finalApprovalInfo?.riskLevel;
|
|
432
|
-
const sameRiskCount = allPendingApprovals.filter((p) => (p.riskLevel || undefined) === currentRiskLevel).length;
|
|
433
|
-
const totalPendingCount = allPendingApprovals.length;
|
|
434
|
-
// Only show batch actions if there's more than 1 pending approval
|
|
435
|
-
if (totalPendingCount <= 1)
|
|
436
|
-
return null;
|
|
437
|
-
const riskLabel = currentRiskLevel
|
|
438
|
-
? currentRiskLevel.charAt(0).toUpperCase() + currentRiskLevel.slice(1)
|
|
439
|
-
: "Same";
|
|
440
|
-
return (_jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2 border-t border-amber-200/60 pt-2", children: [_jsx(Button, { size: "sm", variant: "outline", disabled: isSwitchingMode, onClick: handleSwitchToAutonomous, className: "text-xs", children: isSwitchingMode ? "Switching..." : "Switch to Autonomous" }), sameRiskCount > 1 && (_jsx(Button, { size: "sm", variant: "outline", disabled: isApprovingAll, onClick: () => handleApproveAllByRisk(currentRiskLevel), className: "text-xs", children: isApprovingAll
|
|
441
|
-
? "Approving..."
|
|
442
|
-
: `Approve All ${riskLabel} (${sameRiskCount})` }))] }));
|
|
443
|
-
})()] })] }));
|
|
840
|
+
dispatchApprovalResolved(actualMessageId, false);
|
|
841
|
+
}
|
|
842
|
+
catch (error) {
|
|
843
|
+
console.error("❌ Reject failed:", error);
|
|
844
|
+
}
|
|
845
|
+
}, children: _jsx(X, { className: "size-3" }) }) }), _jsx(TooltipContent, { side: "top", children: "Reject" })] }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", "aria-label": "Approve", "data-testid": "agent-approve-button", className: "flex size-5 shrink-0 items-center justify-center rounded text-green-600 hover:bg-green-50 hover:text-green-700", onClick: async (e) => {
|
|
846
|
+
e.stopPropagation();
|
|
847
|
+
markAsShown();
|
|
848
|
+
try {
|
|
849
|
+
await approveCurrentToolCall();
|
|
850
|
+
}
|
|
851
|
+
catch (error) {
|
|
852
|
+
console.error("❌ Approve failed:", error);
|
|
853
|
+
alert(`Failed to approve: ${error?.message || "Unknown error"}`);
|
|
854
|
+
}
|
|
855
|
+
}, children: _jsx(Check, { className: "size-3" }) }) }), _jsx(TooltipContent, { side: "top", children: "Approve" })] })] }));
|
|
444
856
|
}
|
|
445
857
|
//# sourceMappingURL=ToolCallDisplay.js.map
|