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