@parhelia/core 0.1.12554 → 0.1.12555
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 +98 -187
- 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 +483 -2377
- 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 -460
- package/dist/editor/ai/AgentTerminalStatusBar.js.map +1 -1
- package/dist/editor/ai/Agents.js +113 -150
- package/dist/editor/ai/Agents.js.map +1 -1
- package/dist/editor/ai/AiResponseMessage.d.ts +1 -10
- package/dist/editor/ai/AiResponseMessage.js +23 -238
- 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 +147 -518
- 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 +99 -86
- 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 +230 -730
- 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 +7 -68
- 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 -22
- 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 -14
|
@@ -1,188 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useCallback, useRef, useEffect, useLayoutEffect, useMemo } from "react";
|
|
4
|
-
import { Sparkles, Check, X, SendHorizonal, Wand2, RotateCcw, Maximize2,
|
|
4
|
+
import { Sparkles, Check, X, Loader2, SendHorizonal, Wand2, RotateCcw, Type, Scissors, Maximize2, Feather, Briefcase, History, HelpCircle, Cpu, } from "lucide-react";
|
|
5
5
|
import { Button } from "../../components/ui/button";
|
|
6
|
-
import { Badge } from "../../components/ui/badge";
|
|
7
6
|
import { Textarea } from "../../components/ui/textarea";
|
|
8
7
|
import { Popover, PopoverTrigger, PopoverContent } from "../../components/ui/popover";
|
|
9
8
|
import { cn } from "../../lib/utils";
|
|
10
|
-
import { sanitizeSvg } from "../../lib/sanitize";
|
|
11
9
|
import { useEditContext } from "../client/editContext";
|
|
12
10
|
import { startAgent, closeAgent } from "../services/agentService";
|
|
13
11
|
import { getAiTextEditPrompts, getEditorSettings } from "../services/systemService";
|
|
14
12
|
import { loadAiProfiles } from "../services/aiService";
|
|
15
|
-
import { localStorageService } from "../services/localStorageService";
|
|
16
13
|
// Default Profile ID for the Inline Text Editor profile
|
|
17
14
|
const DEFAULT_INLINE_TEXT_EDITOR_PROFILE_ID = "d7e8f9a0-b1c2-4d3e-a5f6-789012345678";
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const normalizedKey = normalizeProfileIdForStorage(profileId);
|
|
29
|
-
// Prefer exact normalized key, then find any key that normalizes to the same
|
|
30
|
-
let ids = parsed?.[normalizedKey] ?? null;
|
|
31
|
-
if (!ids && parsed && typeof parsed === "object") {
|
|
32
|
-
for (const key of Object.keys(parsed)) {
|
|
33
|
-
if (normalizeProfileIdForStorage(key) === normalizedKey) {
|
|
34
|
-
ids = parsed[key] ?? null;
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return Array.isArray(ids) && ids.length > 0 ? ids : null;
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function setStoredModelIds(profileId, modelIds) {
|
|
46
|
-
try {
|
|
47
|
-
const parsed = localStorageService.getItem(AI_TEXT_EDIT_MODELS_STORAGE_KEY) || {};
|
|
48
|
-
const normalizedKey = normalizeProfileIdForStorage(profileId);
|
|
49
|
-
// Merge: keep other profiles' keys as-is, but normalize keys we care about so we don't accumulate duplicates
|
|
50
|
-
const data = {};
|
|
51
|
-
const seen = new Set();
|
|
52
|
-
for (const key of Object.keys(parsed)) {
|
|
53
|
-
const n = normalizeProfileIdForStorage(key);
|
|
54
|
-
if (seen.has(n))
|
|
55
|
-
continue;
|
|
56
|
-
seen.add(n);
|
|
57
|
-
data[n] = parsed[key] ?? [];
|
|
58
|
-
}
|
|
59
|
-
data[normalizedKey] = modelIds;
|
|
60
|
-
localStorageService.setItem(AI_TEXT_EDIT_MODELS_STORAGE_KEY, data);
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
// ignore
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
const AI_TEXT_EDIT_RESPONSE_FORMAT_INSTRUCTION = `Return ONLY valid JSON (no markdown, no code fences, no extra text).
|
|
67
|
-
Use exactly one of these shapes:
|
|
68
|
-
{"replacementText":"<the modified text>"}
|
|
69
|
-
{"error":"<short explanation of why you cannot complete this request>"}`;
|
|
70
|
-
function tryExtractFirstJsonObject(input) {
|
|
71
|
-
const start = input.indexOf("{");
|
|
72
|
-
if (start < 0)
|
|
73
|
-
return null;
|
|
74
|
-
let depth = 0;
|
|
75
|
-
let inString = false;
|
|
76
|
-
let escaped = false;
|
|
77
|
-
for (let i = start; i < input.length; i++) {
|
|
78
|
-
const ch = input[i];
|
|
79
|
-
if (inString) {
|
|
80
|
-
if (escaped) {
|
|
81
|
-
escaped = false;
|
|
82
|
-
}
|
|
83
|
-
else if (ch === "\\") {
|
|
84
|
-
escaped = true;
|
|
85
|
-
}
|
|
86
|
-
else if (ch === "\"") {
|
|
87
|
-
inString = false;
|
|
88
|
-
}
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
91
|
-
if (ch === "\"") {
|
|
92
|
-
inString = true;
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
if (ch === "{")
|
|
96
|
-
depth++;
|
|
97
|
-
if (ch === "}") {
|
|
98
|
-
depth--;
|
|
99
|
-
if (depth === 0) {
|
|
100
|
-
return input.slice(start, i + 1);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
function cleanAgentResponse(raw) {
|
|
107
|
-
return raw
|
|
108
|
-
.trim()
|
|
109
|
-
.replace(/^```[\s\S]*?\n/, "")
|
|
110
|
-
.replace(/\n```$/, "")
|
|
111
|
-
.trim();
|
|
112
|
-
}
|
|
113
|
-
function parseAiTextEditResponse(raw) {
|
|
114
|
-
const cleaned = cleanAgentResponse(raw);
|
|
115
|
-
if (!cleaned) {
|
|
116
|
-
return { error: "AI returned an empty response." };
|
|
117
|
-
}
|
|
118
|
-
try {
|
|
119
|
-
let parsed = JSON.parse(cleaned);
|
|
120
|
-
// Some models return JSON wrapped as a JSON string; parse one extra level.
|
|
121
|
-
if (typeof parsed === "string") {
|
|
122
|
-
const reparsed = JSON.parse(parsed);
|
|
123
|
-
parsed = reparsed;
|
|
124
|
-
}
|
|
125
|
-
const parsedObj = parsed;
|
|
126
|
-
if (!parsedObj || typeof parsedObj !== "object") {
|
|
127
|
-
return { error: "AI returned an invalid response format." };
|
|
128
|
-
}
|
|
129
|
-
if (typeof parsedObj.error === "string" && parsedObj.error.trim().length > 0) {
|
|
130
|
-
return { error: parsedObj.error.trim() };
|
|
131
|
-
}
|
|
132
|
-
if (typeof parsedObj.replacementText === "string") {
|
|
133
|
-
return { replacementText: parsedObj.replacementText };
|
|
134
|
-
}
|
|
135
|
-
return { error: "AI response is missing `replacementText` or `error`." };
|
|
136
|
-
}
|
|
137
|
-
catch {
|
|
138
|
-
const extractedJson = tryExtractFirstJsonObject(cleaned);
|
|
139
|
-
if (extractedJson) {
|
|
140
|
-
try {
|
|
141
|
-
const recovered = JSON.parse(extractedJson);
|
|
142
|
-
if (recovered && typeof recovered === "object") {
|
|
143
|
-
if (typeof recovered.error === "string" && recovered.error.trim()) {
|
|
144
|
-
return { error: recovered.error.trim() };
|
|
145
|
-
}
|
|
146
|
-
if (typeof recovered.replacementText === "string") {
|
|
147
|
-
return { replacementText: recovered.replacementText };
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
catch {
|
|
152
|
-
// ignore and fall through to regular error handling
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
if (cleaned && !cleaned.includes("{")) {
|
|
156
|
-
return { error: cleaned.slice(0, 300) };
|
|
157
|
-
}
|
|
158
|
-
return { error: "AI returned invalid JSON. Please try again." };
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
function extractAgentErrorMessage(message) {
|
|
162
|
-
const payload = message?.payload ?? {};
|
|
163
|
-
const payloadData = payload?.data ?? {};
|
|
164
|
-
const candidates = [
|
|
165
|
-
payload?.error,
|
|
166
|
-
payload?.Error,
|
|
167
|
-
payload?.message,
|
|
168
|
-
payload?.Message,
|
|
169
|
-
payload?.statusMessage,
|
|
170
|
-
payload?.StatusMessage,
|
|
171
|
-
payloadData?.error,
|
|
172
|
-
payloadData?.Error,
|
|
173
|
-
payloadData?.message,
|
|
174
|
-
payloadData?.Message,
|
|
175
|
-
payloadData?.statusMessage,
|
|
176
|
-
payloadData?.StatusMessage,
|
|
177
|
-
message?.data?.error,
|
|
178
|
-
];
|
|
179
|
-
for (const candidate of candidates) {
|
|
180
|
-
if (typeof candidate === "string" && candidate.trim()) {
|
|
181
|
-
return candidate.trim();
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
15
|
+
// Map of supported icons for quick actions
|
|
16
|
+
const ICON_MAP = {
|
|
17
|
+
Type,
|
|
18
|
+
Scissors,
|
|
19
|
+
Maximize2,
|
|
20
|
+
Feather,
|
|
21
|
+
Briefcase,
|
|
22
|
+
Sparkles,
|
|
23
|
+
Wand2,
|
|
24
|
+
};
|
|
186
25
|
export function InlineAiDialog({ selectedText = "", contextBefore, contextAfter, onAccept, onClose, position, className, }) {
|
|
187
26
|
const editContext = useEditContext();
|
|
188
27
|
const [state, setState] = useState("input");
|
|
@@ -193,18 +32,15 @@ export function InlineAiDialog({ selectedText = "", contextBefore, contextAfter,
|
|
|
193
32
|
const [quickActions, setQuickActions] = useState([]);
|
|
194
33
|
const [profileId, setProfileId] = useState(DEFAULT_INLINE_TEXT_EDITOR_PROFILE_ID);
|
|
195
34
|
const [activeProfile, setActiveProfile] = useState(undefined);
|
|
196
|
-
const [
|
|
197
|
-
const [modelRuns, setModelRuns] = useState({});
|
|
35
|
+
const [selectedModelId, setSelectedModelId] = useState(undefined);
|
|
198
36
|
const inputRef = useRef(null);
|
|
199
37
|
const dialogRef = useRef(null);
|
|
200
38
|
const [isLarge, setIsLarge] = useState(false);
|
|
201
39
|
const [clampedPosition, setClampedPosition] = useState(position);
|
|
202
|
-
// Agent state
|
|
203
|
-
const
|
|
40
|
+
// Agent state - persisted across refinements
|
|
41
|
+
const agentIdRef = useRef(null);
|
|
204
42
|
const unsubscribeRef = useRef(null);
|
|
205
|
-
const
|
|
206
|
-
const latestRawContentRef = useRef({});
|
|
207
|
-
const lastParsedRawRef = useRef({});
|
|
43
|
+
const resultRef = useRef("");
|
|
208
44
|
// Model popover state
|
|
209
45
|
const [modelPopoverOpen, setModelPopoverOpen] = useState(false);
|
|
210
46
|
// ALT+letter quick select state
|
|
@@ -214,29 +50,14 @@ export function InlineAiDialog({ selectedText = "", contextBefore, contextAfter,
|
|
|
214
50
|
// Available models from the profile
|
|
215
51
|
const availableModels = activeProfile?.models || [];
|
|
216
52
|
const hasMultipleModels = availableModels.length > 1;
|
|
217
|
-
//
|
|
218
|
-
const
|
|
219
|
-
if (!availableModels.length)
|
|
220
|
-
return [];
|
|
221
|
-
const byId = new Map(availableModels.map((m) => [m.id, m]));
|
|
222
|
-
const selected = selectedModelIds.map((id) => byId.get(id)).filter(Boolean);
|
|
223
|
-
return selected.length ? selected : availableModels.slice(0, 1);
|
|
224
|
-
}, [selectedModelIds, availableModels]);
|
|
225
|
-
const selectedModelSummary = useMemo(() => {
|
|
226
|
-
if (!selectedModels.length)
|
|
53
|
+
// Get the selected model name for display
|
|
54
|
+
const selectedModelName = useMemo(() => {
|
|
55
|
+
if (!selectedModelId || !availableModels.length)
|
|
227
56
|
return null;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
const successfulRuns = useMemo(() => Object.values(modelRuns).filter((run) => run.status === "done" && typeof run.replacementText === "string" && run.replacementText.length > 0), [modelRuns]);
|
|
233
|
-
const hasMultipleResults = successfulRuns.length > 1;
|
|
234
|
-
// Automatically switch to larger mode when showing more than one response
|
|
235
|
-
useEffect(() => {
|
|
236
|
-
if (state === "preview" && hasMultipleResults) {
|
|
237
|
-
setIsLarge(true);
|
|
238
|
-
}
|
|
239
|
-
}, [state, hasMultipleResults]);
|
|
57
|
+
const model = availableModels.find(m => m.id === selectedModelId);
|
|
58
|
+
return model?.name || null;
|
|
59
|
+
}, [selectedModelId, availableModels]);
|
|
60
|
+
// Load settings and prompts on mount
|
|
240
61
|
useEffect(() => {
|
|
241
62
|
const loadSettings = async () => {
|
|
242
63
|
try {
|
|
@@ -264,19 +85,13 @@ export function InlineAiDialog({ selectedText = "", contextBefore, contextAfter,
|
|
|
264
85
|
return;
|
|
265
86
|
try {
|
|
266
87
|
const profiles = await loadAiProfiles();
|
|
267
|
-
const
|
|
268
|
-
const profile = profiles.find((p) => normalizeProfileIdForStorage(p.id) === normalizedProfileId);
|
|
88
|
+
const profile = profiles.find(p => p.id === profileId);
|
|
269
89
|
if (profile) {
|
|
270
90
|
setActiveProfile(profile);
|
|
271
|
-
|
|
91
|
+
// Set default model
|
|
272
92
|
const defaultModelId = profile.defaultModelId || profile.models?.[0]?.id;
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
if (validStored?.length) {
|
|
276
|
-
setSelectedModelIds(validStored);
|
|
277
|
-
}
|
|
278
|
-
else if (defaultModelId) {
|
|
279
|
-
setSelectedModelIds([defaultModelId]);
|
|
93
|
+
if (defaultModelId) {
|
|
94
|
+
setSelectedModelId(defaultModelId);
|
|
280
95
|
}
|
|
281
96
|
}
|
|
282
97
|
}
|
|
@@ -286,230 +101,136 @@ export function InlineAiDialog({ selectedText = "", contextBefore, contextAfter,
|
|
|
286
101
|
};
|
|
287
102
|
loadProfile();
|
|
288
103
|
}, [profileId]);
|
|
289
|
-
useEffect(() => {
|
|
290
|
-
modelRunsRef.current = modelRuns;
|
|
291
|
-
}, [modelRuns]);
|
|
292
|
-
// Persist model selection to localStorage when it or profileId changes
|
|
293
|
-
useEffect(() => {
|
|
294
|
-
if (profileId && selectedModelIds.length > 0) {
|
|
295
|
-
setStoredModelIds(profileId, selectedModelIds);
|
|
296
|
-
}
|
|
297
|
-
}, [profileId, selectedModelIds]);
|
|
298
104
|
// Focus input on mount
|
|
299
105
|
useEffect(() => {
|
|
300
106
|
if (inputRef.current) {
|
|
301
107
|
inputRef.current.focus();
|
|
302
108
|
}
|
|
303
109
|
}, []);
|
|
304
|
-
const evaluateRunCompletion = useCallback((runs) => {
|
|
305
|
-
const values = Object.values(runs);
|
|
306
|
-
if (!values.length)
|
|
307
|
-
return;
|
|
308
|
-
const allTerminal = values.every((run) => run.status === "done" || run.status === "error");
|
|
309
|
-
if (!allTerminal)
|
|
310
|
-
return;
|
|
311
|
-
const doneRuns = values.filter((run) => run.status === "done" && run.replacementText?.length);
|
|
312
|
-
if (doneRuns.length === 0) {
|
|
313
|
-
setError("All selected models failed. See each model’s card for details. You can retry or change your instruction.");
|
|
314
|
-
setResult("");
|
|
315
|
-
// Stay in preview so the user sees per-model error cards and can Retry/Discard
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
if (doneRuns.length === 1) {
|
|
319
|
-
setResult(doneRuns[0]?.replacementText ?? "");
|
|
320
|
-
}
|
|
321
|
-
else {
|
|
322
|
-
setResult("");
|
|
323
|
-
}
|
|
324
|
-
setError(null);
|
|
325
|
-
// State is already "preview" – we show results side-by-side as they stream in
|
|
326
|
-
}, []);
|
|
327
|
-
const updateModelRun = useCallback((agentId, updater) => {
|
|
328
|
-
setModelRuns((prev) => {
|
|
329
|
-
const current = prev[agentId];
|
|
330
|
-
if (!current)
|
|
331
|
-
return prev;
|
|
332
|
-
const updated = updater(current);
|
|
333
|
-
const next = { ...prev, [agentId]: updated };
|
|
334
|
-
modelRunsRef.current = next;
|
|
335
|
-
evaluateRunCompletion(next);
|
|
336
|
-
return next;
|
|
337
|
-
});
|
|
338
|
-
}, [evaluateRunCompletion]);
|
|
339
|
-
const subscribeAgent = useCallback((agentId) => {
|
|
340
|
-
const socket = globalThis.editorSocket;
|
|
341
|
-
if (!socket || socket.readyState !== WebSocket.OPEN) {
|
|
342
|
-
console.warn("[InlineAiDialog] WebSocket not available");
|
|
343
|
-
return;
|
|
344
|
-
}
|
|
345
|
-
socket.send(JSON.stringify({
|
|
346
|
-
type: "agent:subscribe",
|
|
347
|
-
agentId,
|
|
348
|
-
}));
|
|
349
|
-
}, []);
|
|
350
|
-
const unsubscribeAllAgents = useCallback(() => {
|
|
351
|
-
const socket = globalThis.editorSocket;
|
|
352
|
-
if (!socket || socket.readyState !== WebSocket.OPEN)
|
|
353
|
-
return;
|
|
354
|
-
for (const agentId of activeAgentIdsRef.current) {
|
|
355
|
-
socket.send(JSON.stringify({
|
|
356
|
-
type: "agent:unsubscribe",
|
|
357
|
-
agentId,
|
|
358
|
-
}));
|
|
359
|
-
}
|
|
360
|
-
}, []);
|
|
361
|
-
const closeAllActiveAgents = useCallback(() => {
|
|
362
|
-
for (const agentId of activeAgentIdsRef.current) {
|
|
363
|
-
closeAgent(agentId).catch(() => { });
|
|
364
|
-
}
|
|
365
|
-
activeAgentIdsRef.current.clear();
|
|
366
|
-
latestRawContentRef.current = {};
|
|
367
|
-
lastParsedRawRef.current = {};
|
|
368
|
-
}, []);
|
|
369
|
-
const handleStopModelRun = useCallback((agentId) => {
|
|
370
|
-
activeAgentIdsRef.current.delete(agentId);
|
|
371
|
-
delete latestRawContentRef.current[agentId];
|
|
372
|
-
delete lastParsedRawRef.current[agentId];
|
|
373
|
-
closeAgent(agentId).catch(() => { });
|
|
374
|
-
updateModelRun(agentId, (current) => ({
|
|
375
|
-
...current,
|
|
376
|
-
status: "error",
|
|
377
|
-
error: "Stopped by user",
|
|
378
|
-
}));
|
|
379
|
-
}, [updateModelRun]);
|
|
380
110
|
// Cleanup on unmount
|
|
381
111
|
useEffect(() => {
|
|
382
112
|
return () => {
|
|
383
|
-
|
|
113
|
+
// Unsubscribe from WebSocket
|
|
384
114
|
if (unsubscribeRef.current) {
|
|
385
115
|
unsubscribeRef.current();
|
|
386
116
|
}
|
|
387
|
-
|
|
117
|
+
// Close the agent if it exists
|
|
118
|
+
if (agentIdRef.current) {
|
|
119
|
+
closeAgent(agentIdRef.current).catch(() => { });
|
|
120
|
+
}
|
|
388
121
|
};
|
|
389
|
-
}, [
|
|
390
|
-
|
|
391
|
-
|
|
122
|
+
}, []);
|
|
123
|
+
// Subscribe to WebSocket messages for the agent
|
|
124
|
+
const subscribeToAgent = useCallback((agentId) => {
|
|
125
|
+
const socket = globalThis.editorSocket;
|
|
126
|
+
if (!socket || socket.readyState !== WebSocket.OPEN) {
|
|
127
|
+
console.warn("[InlineAiDialog] WebSocket not available");
|
|
392
128
|
return;
|
|
393
129
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
if (!content)
|
|
130
|
+
// Send subscription message
|
|
131
|
+
socket.send(JSON.stringify({
|
|
132
|
+
type: "agent:subscribe",
|
|
133
|
+
agentId: agentId,
|
|
134
|
+
}));
|
|
135
|
+
// Add message listener via editContext
|
|
136
|
+
if (editContext?.addSocketMessageListener) {
|
|
137
|
+
const handleMessage = (message) => {
|
|
138
|
+
// Only handle messages for our agent
|
|
139
|
+
if (message.agentId !== agentId && message.payload?.agentId !== agentId) {
|
|
405
140
|
return;
|
|
406
|
-
const previousRaw = latestRawContentRef.current[messageAgentId] || "";
|
|
407
|
-
const nextRaw = isIncremental ? previousRaw + content : content;
|
|
408
|
-
latestRawContentRef.current[messageAgentId] = nextRaw;
|
|
409
|
-
const existingRun = modelRunsRef.current[messageAgentId];
|
|
410
|
-
if (existingRun) {
|
|
411
|
-
modelRunsRef.current = {
|
|
412
|
-
...modelRunsRef.current,
|
|
413
|
-
[messageAgentId]: {
|
|
414
|
-
...existingRun,
|
|
415
|
-
status: "streaming",
|
|
416
|
-
rawContent: nextRaw,
|
|
417
|
-
},
|
|
418
|
-
};
|
|
419
|
-
}
|
|
420
|
-
updateModelRun(messageAgentId, (current) => {
|
|
421
|
-
const nextRawContent = isIncremental ? current.rawContent + content : content;
|
|
422
|
-
return {
|
|
423
|
-
...current,
|
|
424
|
-
status: "streaming",
|
|
425
|
-
rawContent: nextRawContent,
|
|
426
|
-
};
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
else if (msgType === "agent:run:status" || msgType === "agent:status:update") {
|
|
430
|
-
const statusData = message.payload?.data || message.payload || {};
|
|
431
|
-
const normalizedStatus = (statusData.state || statusData.status || "").toString().toLowerCase();
|
|
432
|
-
if (normalizedStatus === "error") {
|
|
433
|
-
const errorMsg = extractAgentErrorMessage(message) || "AI could not complete this request.";
|
|
434
|
-
updateModelRun(messageAgentId, (current) => {
|
|
435
|
-
if (current.status === "done")
|
|
436
|
-
return current; // don't overwrite success
|
|
437
|
-
return { ...current, status: "error", error: errorMsg };
|
|
438
|
-
});
|
|
439
141
|
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
142
|
+
const msgType = message.type;
|
|
143
|
+
if (msgType === "agent:run:delta") {
|
|
144
|
+
// Content chunks come via agent:run:delta with data.deltaContent
|
|
145
|
+
const deltaData = message.payload?.data;
|
|
146
|
+
const content = deltaData?.deltaContent || "";
|
|
147
|
+
const isIncremental = deltaData?.isIncremental !== false;
|
|
148
|
+
if (content) {
|
|
149
|
+
if (isIncremental) {
|
|
150
|
+
// Incremental: append to existing
|
|
151
|
+
resultRef.current += content;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
// Non-incremental: replace with totalContent or use deltaContent as full content
|
|
155
|
+
resultRef.current = content;
|
|
156
|
+
}
|
|
157
|
+
// Clean up markdown formatting
|
|
158
|
+
const cleanResult = resultRef.current
|
|
159
|
+
.replace(/^```[\s\S]*?\n/, "")
|
|
160
|
+
.replace(/\n```$/, "")
|
|
161
|
+
.trim();
|
|
162
|
+
setResult(cleanResult);
|
|
163
|
+
}
|
|
458
164
|
}
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
return;
|
|
165
|
+
else if (msgType === "agent:message:complete" || msgType === "agent:run:complete") {
|
|
166
|
+
// Message complete - switch to preview state
|
|
167
|
+
setState("preview");
|
|
463
168
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
status: "error",
|
|
470
|
-
error: parsed.error,
|
|
471
|
-
}));
|
|
169
|
+
else if (msgType === "agent:error") {
|
|
170
|
+
// Error occurred
|
|
171
|
+
const errorMsg = message.payload?.error || message.data?.error || "An error occurred";
|
|
172
|
+
setError(errorMsg);
|
|
173
|
+
setState("input");
|
|
472
174
|
}
|
|
473
|
-
else {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
175
|
+
else if (msgType === "agent:status:update") {
|
|
176
|
+
// Status update - check for running/completed
|
|
177
|
+
const status = message.payload?.status;
|
|
178
|
+
if (status === "completed" || status === "idle") {
|
|
179
|
+
setState("preview");
|
|
180
|
+
}
|
|
181
|
+
else if (status === "error") {
|
|
182
|
+
setError(message.payload?.message || "Agent error");
|
|
183
|
+
setState("input");
|
|
184
|
+
}
|
|
480
185
|
}
|
|
186
|
+
};
|
|
187
|
+
unsubscribeRef.current = editContext.addSocketMessageListener(handleMessage);
|
|
188
|
+
}
|
|
189
|
+
}, [editContext]);
|
|
190
|
+
// Unsubscribe from current agent
|
|
191
|
+
const unsubscribeFromAgent = useCallback(() => {
|
|
192
|
+
if (unsubscribeRef.current) {
|
|
193
|
+
unsubscribeRef.current();
|
|
194
|
+
unsubscribeRef.current = null;
|
|
195
|
+
}
|
|
196
|
+
if (agentIdRef.current) {
|
|
197
|
+
const socket = globalThis.editorSocket;
|
|
198
|
+
if (socket && socket.readyState === WebSocket.OPEN) {
|
|
199
|
+
socket.send(JSON.stringify({
|
|
200
|
+
type: "agent:unsubscribe",
|
|
201
|
+
agentId: agentIdRef.current,
|
|
202
|
+
}));
|
|
481
203
|
}
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
}, [editContext, updateModelRun]);
|
|
204
|
+
}
|
|
205
|
+
}, []);
|
|
485
206
|
const executeAiModification = useCallback(async (customInstruction) => {
|
|
486
207
|
if (!editContext)
|
|
487
208
|
return;
|
|
488
|
-
|
|
489
|
-
setError("Select at least one model.");
|
|
490
|
-
return;
|
|
491
|
-
}
|
|
209
|
+
setState("loading");
|
|
492
210
|
setError(null);
|
|
211
|
+
resultRef.current = "";
|
|
493
212
|
setResult("");
|
|
494
|
-
setModelRuns({});
|
|
495
|
-
modelRunsRef.current = {};
|
|
496
|
-
latestRawContentRef.current = {};
|
|
497
|
-
lastParsedRawRef.current = {};
|
|
498
|
-
unsubscribeAllAgents();
|
|
499
|
-
closeAllActiveAgents();
|
|
500
213
|
try {
|
|
501
|
-
//
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
|
|
214
|
+
// Create new agent ID if this is first request, otherwise reuse for refinement
|
|
215
|
+
const isNewAgent = !agentIdRef.current;
|
|
216
|
+
if (isNewAgent) {
|
|
217
|
+
agentIdRef.current = crypto.randomUUID();
|
|
218
|
+
}
|
|
219
|
+
const agentId = agentIdRef.current;
|
|
220
|
+
// Build the message - include context on first message
|
|
221
|
+
let message;
|
|
222
|
+
if (isNewAgent) {
|
|
223
|
+
// Include context around the selection if available
|
|
224
|
+
const hasContext = contextBefore || contextAfter;
|
|
225
|
+
const contextInfo = hasContext
|
|
226
|
+
? `CONTEXT (text surrounding the selection):
|
|
505
227
|
Before: "${contextBefore || ""}"
|
|
506
228
|
After: "${contextAfter || ""}"
|
|
507
229
|
|
|
508
230
|
`
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
message = `${contextInfo}I need you to modify ONLY the following selected portion of the text:
|
|
231
|
+
: "";
|
|
232
|
+
if (selectedText) {
|
|
233
|
+
message = `${contextInfo}I need you to modify ONLY the following selected portion of the text:
|
|
513
234
|
|
|
514
235
|
SELECTED TEXT TO MODIFY:
|
|
515
236
|
"""
|
|
@@ -518,22 +239,31 @@ ${selectedText}
|
|
|
518
239
|
|
|
519
240
|
${customInstruction}
|
|
520
241
|
|
|
521
|
-
Return ONLY the modified version of the selected text, not the entire field
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
message = `${contextInfo}I need you to generate text at the cursor position.
|
|
242
|
+
Remember: Return ONLY the modified version of the selected text, not the entire field.`;
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
message = `${contextInfo}I need you to generate text at the cursor position.
|
|
526
246
|
|
|
527
247
|
${customInstruction}
|
|
528
248
|
|
|
529
|
-
Return ONLY the text to insert at the cursor position, not the entire field
|
|
530
|
-
|
|
249
|
+
Remember: Return ONLY the text to insert at the cursor position, not the entire field.`;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
// For refinements, just send the instruction
|
|
254
|
+
message = customInstruction;
|
|
531
255
|
}
|
|
256
|
+
// Subscribe to WebSocket before starting
|
|
257
|
+
if (isNewAgent) {
|
|
258
|
+
subscribeToAgent(agentId);
|
|
259
|
+
}
|
|
260
|
+
// Track conversation history
|
|
532
261
|
setConversationHistory((prev) => [...prev, customInstruction]);
|
|
262
|
+
// Build context based on profile's editorContextMode setting
|
|
533
263
|
let agentContext = undefined;
|
|
534
264
|
const contextMode = activeProfile?.editorContextMode;
|
|
535
265
|
const shouldIncludeContext = contextMode === "onCreate" || contextMode === "live";
|
|
536
|
-
if (shouldIncludeContext) {
|
|
266
|
+
if (shouldIncludeContext && isNewAgent) {
|
|
537
267
|
const item = editContext.currentItemDescriptor;
|
|
538
268
|
if (item) {
|
|
539
269
|
agentContext = {
|
|
@@ -563,66 +293,25 @@ ${AI_TEXT_EDIT_RESPONSE_FORMAT_INSTRUCTION}`;
|
|
|
563
293
|
};
|
|
564
294
|
}
|
|
565
295
|
}
|
|
566
|
-
|
|
567
|
-
const
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
rawContent: "",
|
|
579
|
-
};
|
|
580
|
-
}
|
|
581
|
-
setModelRuns(initialRuns);
|
|
582
|
-
modelRunsRef.current = initialRuns;
|
|
583
|
-
setState("preview"); // Show results immediately side-by-side as they stream in
|
|
584
|
-
await Promise.all(Object.values(initialRuns).map(async (run) => {
|
|
585
|
-
subscribeAgent(run.agentId);
|
|
586
|
-
try {
|
|
587
|
-
await startAgent({
|
|
588
|
-
agentId: run.agentId,
|
|
589
|
-
message,
|
|
590
|
-
sessionId: editContext.sessionId,
|
|
591
|
-
profileId: profileId,
|
|
592
|
-
mode: "autonomous",
|
|
593
|
-
model: run.modelId,
|
|
594
|
-
context: agentContext,
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
catch (runErr) {
|
|
598
|
-
const errorMsg = runErr instanceof Error ? runErr.message : "Failed to start model run";
|
|
599
|
-
updateModelRun(run.agentId, (current) => ({
|
|
600
|
-
...current,
|
|
601
|
-
status: "error",
|
|
602
|
-
error: errorMsg,
|
|
603
|
-
}));
|
|
604
|
-
}
|
|
605
|
-
}));
|
|
296
|
+
// Start the agent
|
|
297
|
+
const request = {
|
|
298
|
+
agentId,
|
|
299
|
+
message,
|
|
300
|
+
sessionId: editContext.sessionId,
|
|
301
|
+
profileId: profileId,
|
|
302
|
+
mode: "autonomous",
|
|
303
|
+
model: selectedModelId,
|
|
304
|
+
context: agentContext,
|
|
305
|
+
};
|
|
306
|
+
console.log("[InlineAiDialog] Starting agent:", agentId, agentContext ? "with context" : "without context");
|
|
307
|
+
await startAgent(request);
|
|
606
308
|
}
|
|
607
309
|
catch (err) {
|
|
608
310
|
console.error("AI modification error:", err);
|
|
609
311
|
setError(err instanceof Error ? err.message : "An error occurred");
|
|
610
312
|
setState("input");
|
|
611
313
|
}
|
|
612
|
-
}, [
|
|
613
|
-
editContext,
|
|
614
|
-
selectedText,
|
|
615
|
-
contextBefore,
|
|
616
|
-
contextAfter,
|
|
617
|
-
profileId,
|
|
618
|
-
activeProfile,
|
|
619
|
-
selectedModels,
|
|
620
|
-
closeAllActiveAgents,
|
|
621
|
-
unsubscribeAllAgents,
|
|
622
|
-
ensureSocketListener,
|
|
623
|
-
subscribeAgent,
|
|
624
|
-
updateModelRun,
|
|
625
|
-
]);
|
|
314
|
+
}, [editContext, selectedText, contextBefore, contextAfter, subscribeToAgent, profileId, selectedModelId, activeProfile]);
|
|
626
315
|
const handleQuickAction = useCallback((action) => {
|
|
627
316
|
executeAiModification(action.instruction);
|
|
628
317
|
}, [executeAiModification]);
|
|
@@ -698,50 +387,38 @@ ${AI_TEXT_EDIT_RESPONSE_FORMAT_INSTRUCTION}`;
|
|
|
698
387
|
}
|
|
699
388
|
};
|
|
700
389
|
}, [state, isAltPressed, altSearchBuffer, quickActions, handleQuickAction]);
|
|
701
|
-
const
|
|
702
|
-
if (
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
}, [onAccept]);
|
|
706
|
-
const toggleModelSelection = useCallback((modelId) => {
|
|
707
|
-
setSelectedModelIds((prev) => {
|
|
708
|
-
if (prev.includes(modelId)) {
|
|
709
|
-
if (prev.length === 1) {
|
|
710
|
-
return prev;
|
|
711
|
-
}
|
|
712
|
-
return prev.filter((id) => id !== modelId);
|
|
713
|
-
}
|
|
714
|
-
return [...prev, modelId];
|
|
715
|
-
});
|
|
716
|
-
}, []);
|
|
390
|
+
const handleAccept = useCallback(() => {
|
|
391
|
+
if (result) {
|
|
392
|
+
onAccept(result);
|
|
393
|
+
}
|
|
394
|
+
}, [result, onAccept]);
|
|
717
395
|
const handleTryAgain = useCallback(() => {
|
|
718
396
|
// Go back to input state to refine
|
|
719
397
|
setState("input");
|
|
720
398
|
setResult("");
|
|
399
|
+
resultRef.current = "";
|
|
400
|
+
// Keep the agent for conversation history
|
|
721
401
|
}, []);
|
|
722
|
-
const handleRetry = useCallback(() => {
|
|
723
|
-
const lastInstruction = conversationHistory[conversationHistory.length - 1];
|
|
724
|
-
if (lastInstruction) {
|
|
725
|
-
executeAiModification(lastInstruction);
|
|
726
|
-
}
|
|
727
|
-
}, [conversationHistory, executeAiModification]);
|
|
728
402
|
const handleStartOver = useCallback(() => {
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
403
|
+
// Close existing agent and start fresh
|
|
404
|
+
unsubscribeFromAgent();
|
|
405
|
+
if (agentIdRef.current) {
|
|
406
|
+
closeAgent(agentIdRef.current).catch(() => { });
|
|
407
|
+
agentIdRef.current = null;
|
|
408
|
+
}
|
|
735
409
|
setState("input");
|
|
736
410
|
setResult("");
|
|
411
|
+
resultRef.current = "";
|
|
737
412
|
setConversationHistory([]);
|
|
738
413
|
setError(null);
|
|
739
|
-
}, [
|
|
414
|
+
}, [unsubscribeFromAgent]);
|
|
740
415
|
const handleClose = useCallback(() => {
|
|
741
|
-
|
|
742
|
-
|
|
416
|
+
unsubscribeFromAgent();
|
|
417
|
+
if (agentIdRef.current) {
|
|
418
|
+
closeAgent(agentIdRef.current).catch(() => { });
|
|
419
|
+
}
|
|
743
420
|
onClose();
|
|
744
|
-
}, [
|
|
421
|
+
}, [unsubscribeFromAgent, onClose]);
|
|
745
422
|
const toggleLarge = useCallback(() => {
|
|
746
423
|
setIsLarge((prev) => !prev);
|
|
747
424
|
}, []);
|
|
@@ -816,7 +493,7 @@ ${AI_TEXT_EDIT_RESPONSE_FORMAT_INSTRUCTION}`;
|
|
|
816
493
|
resizeObserver.disconnect();
|
|
817
494
|
};
|
|
818
495
|
// Re-clamp when the content changes (height changes) or when the requested position changes.
|
|
819
|
-
}, [position?.x, position?.y, state, result, selectedText, isLarge
|
|
496
|
+
}, [position?.x, position?.y, state, result, selectedText, isLarge]);
|
|
820
497
|
return (_jsxs("div", { ref: dialogRef, className: cn("bg-white/95 backdrop-blur-sm rounded-xl shadow-[0_10px_40px_rgba(0,0,0,0.1)] border border-gray-100 max-h-[80vh] flex flex-col overflow-hidden agent-inline-dialog transition-all duration-300 ease-in-out", isLarge ? "w-[800px]" : "w-[420px]", "animate-in fade-in-0 zoom-in-95 duration-200 ease-out", className), style: clampedPosition
|
|
821
498
|
? {
|
|
822
499
|
position: "fixed",
|
|
@@ -825,13 +502,14 @@ ${AI_TEXT_EDIT_RESPONSE_FORMAT_INSTRUCTION}`;
|
|
|
825
502
|
zIndex: 95,
|
|
826
503
|
}
|
|
827
504
|
: undefined, onKeyDown: handleKeyDown, children: [_jsxs("div", { className: "flex-shrink-0 flex items-center gap-2.5 px-4 py-3 bg-gradient-to-r from-violet-500/5 to-purple-500/5 border-b border-gray-100", children: [_jsx("div", { className: "flex items-center justify-center w-6 h-6 rounded-lg bg-violet-600 shadow-sm shadow-violet-200", children: _jsx(Sparkles, { className: "w-3.5 h-3.5 text-white" }) }), _jsxs("div", { className: "flex flex-col", children: [_jsx("span", { className: "text-sm font-semibold text-gray-800 leading-tight", children: "AI Text Edit" }), conversationHistory.length > 0 && (_jsxs("span", { className: "text-[10px] text-gray-400 font-medium", children: [conversationHistory.length, " ", conversationHistory.length === 1 ? "turn" : "turns", " in history"] }))] }), _jsxs("div", { className: "ml-auto flex items-center gap-1", children: [_jsx("button", { onClick: toggleLarge, className: cn("p-1.5 hover:bg-gray-100 rounded-lg transition-all duration-200 group", isLarge && "bg-violet-50 text-violet-600 hover:bg-violet-100"), title: isLarge ? "Make smaller" : "Make larger", children: _jsx(Maximize2, { className: cn("w-4 h-4 text-gray-400 group-hover:text-gray-600", isLarge && "text-violet-600") }) }), _jsx("button", { onClick: handleClose, className: "p-1.5 hover:bg-gray-100 rounded-lg transition-all duration-200 group", title: "Close", children: _jsx(X, { className: "w-4 h-4 text-gray-400 group-hover:text-gray-600" }) })] })] }), selectedText && (_jsxs("div", { className: "flex-shrink-0 px-4 py-3 bg-gray-50/50 border-b border-gray-100", children: [_jsxs("div", { className: "flex items-center gap-1.5 text-[10px] font-bold text-gray-400 uppercase tracking-wider mb-2", children: [_jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-gray-200" }), "Selected Content"] }), _jsxs("div", { className: "relative max-h-48 overflow-y-auto whitespace-pre-wrap transition-all duration-300", children: [_jsx("div", { className: "absolute left-0 top-0 bottom-0 w-0.5 bg-violet-200 rounded-full" }), _jsx("div", { className: "pl-3", children: renderTextWithContext(selectedText) })] })] })), _jsxs("div", { className: "p-4 min-h-0 flex-1 overflow-y-auto", children: [state === "input" && (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "space-y-2", children: [isAltPressed && (_jsxs("div", { className: "flex items-center gap-2 text-xs text-violet-600 bg-violet-50 px-2.5 py-1.5 rounded-lg animate-in fade-in duration-150", children: [_jsx("kbd", { className: "px-1.5 py-0.5 bg-violet-100 rounded text-[10px] font-mono font-bold", children: "ALT" }), _jsx("span", { className: "font-medium", children: altSearchBuffer ? (_jsxs(_Fragment, { children: ["Type to select: ", _jsx("span", { className: "font-bold", children: altSearchBuffer })] })) : ("Type first letters of an action...") })] })), _jsx("div", { className: "flex flex-wrap gap-2", children: quickActions.map((action) => {
|
|
828
|
-
const
|
|
505
|
+
const isSvgIcon = action.icon?.trim().startsWith("<svg") || action.icon?.trim().startsWith("<?xml");
|
|
506
|
+
const IconComponent = !isSvgIcon ? (ICON_MAP[action.icon] || HelpCircle) : null;
|
|
829
507
|
const labelLower = action.label.toLowerCase();
|
|
830
508
|
const isMatch = isAltPressed && altSearchBuffer && labelLower.startsWith(altSearchBuffer);
|
|
831
509
|
const isPartialMatch = isAltPressed && altSearchBuffer && labelLower.includes(altSearchBuffer) && !isMatch;
|
|
832
|
-
return (_jsxs("button", { onClick: () => handleQuickAction(action), className: cn("flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-lg transition-all duration-200", "bg-white border border-gray-200 text-gray-600", "hover:border-violet-300 hover:text-violet-700 hover:bg-violet-50", "active:scale-95 shadow-sm hover:shadow-md", isMatch && "border-violet-400 bg-violet-100 text-violet-700 ring-2 ring-violet-300", isPartialMatch && "border-violet-200 bg-violet-50/50", isAltPressed && !isMatch && !isPartialMatch && "opacity-50"), children: [
|
|
833
|
-
__html:
|
|
834
|
-
} })), isAltPressed && altSearchBuffer ? (_jsxs("span", { children: [_jsx("span", { className: cn(isMatch && "font-bold underline underline-offset-2"), children: action.label.slice(0, altSearchBuffer.length) }), action.label.slice(altSearchBuffer.length)] })) : (action.label)] }, action.id));
|
|
510
|
+
return (_jsxs("button", { onClick: () => handleQuickAction(action), className: cn("flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-lg transition-all duration-200", "bg-white border border-gray-200 text-gray-600", "hover:border-violet-300 hover:text-violet-700 hover:bg-violet-50", "active:scale-95 shadow-sm hover:shadow-md", isMatch && "border-violet-400 bg-violet-100 text-violet-700 ring-2 ring-violet-300", isPartialMatch && "border-violet-200 bg-violet-50/50", isAltPressed && !isMatch && !isPartialMatch && "opacity-50"), children: [isSvgIcon ? (_jsx("div", { className: "w-3.5 h-3.5 flex items-center justify-center [&>svg]:w-full [&>svg]:h-full", dangerouslySetInnerHTML: {
|
|
511
|
+
__html: action.icon,
|
|
512
|
+
} })) : (IconComponent && _jsx(IconComponent, { className: "w-3.5 h-3.5" })), isAltPressed && altSearchBuffer ? (_jsxs("span", { children: [_jsx("span", { className: cn(isMatch && "font-bold underline underline-offset-2"), children: action.label.slice(0, altSearchBuffer.length) }), action.label.slice(altSearchBuffer.length)] })) : (action.label)] }, action.id));
|
|
835
513
|
}) })] }), _jsxs("form", { onSubmit: (e) => {
|
|
836
514
|
e.preventDefault();
|
|
837
515
|
if (instruction.trim()) {
|
|
@@ -840,27 +518,27 @@ ${AI_TEXT_EDIT_RESPONSE_FORMAT_INSTRUCTION}`;
|
|
|
840
518
|
}
|
|
841
519
|
}, className: "relative group", children: [_jsx(Textarea, { ref: inputRef, value: instruction, onChange: (e) => setInstruction(e.target.value), onKeyDown: handleTextareaKeyDown, placeholder: conversationHistory.length > 0
|
|
842
520
|
? "How can I improve this further?"
|
|
843
|
-
: "Describe the change you want...", className: cn("w-full py-3 pl-3 pr-14 text-
|
|
521
|
+
: "Describe the change you want...", className: cn("w-full py-3 pl-3 pr-14 text-sm rounded-2xl border border-gray-200", "focus:border-violet-400 focus:ring-4 focus:ring-violet-500/10", "outline-none transition-all duration-200 bg-gray-50/30 resize-none", isLarge ? "min-h-[200px]" : "min-h-[100px]") }), _jsxs("div", { className: "absolute right-2 bottom-2 flex items-center gap-1", children: [hasMultipleModels && (_jsxs(Popover, { open: modelPopoverOpen, onOpenChange: setModelPopoverOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { type: "button", className: cn("p-1.5 rounded-lg transition-all duration-200", "text-gray-400 hover:text-violet-600 hover:bg-violet-50", modelPopoverOpen && "text-violet-600 bg-violet-50"), title: selectedModelName ? `Model: ${selectedModelName}` : "Select model", children: _jsx(Cpu, { className: "w-3.5 h-3.5" }) }) }), _jsxs(PopoverContent, { className: "w-48 p-1.5", align: "end", sideOffset: 8, children: [_jsx("div", { className: "text-[10px] font-semibold text-gray-400 uppercase tracking-wider px-2 py-1", children: "Model" }), _jsx("div", { className: "space-y-0.5", children: availableModels.map((model) => (_jsx("button", { type: "button", onClick: () => {
|
|
522
|
+
setSelectedModelId(model.id);
|
|
523
|
+
setModelPopoverOpen(false);
|
|
524
|
+
}, className: cn("w-full text-left px-2 py-1.5 text-xs rounded-md transition-colors", selectedModelId === model.id
|
|
844
525
|
? "bg-violet-100 text-violet-700 font-medium"
|
|
845
|
-
: "text-gray-600 hover:bg-gray-100"), children:
|
|
846
|
-
? "border-violet-600 bg-violet-600 text-white"
|
|
847
|
-
: "border-gray-300 bg-white text-transparent"), children: _jsx(Check, { className: "w-3 h-3" }) }), model.name] }, model.id))) })] })] })), _jsx("button", { type: "submit", disabled: !instruction.trim() || selectedModels.length === 0, className: cn("p-2.5 rounded-xl transition-all duration-300", instruction.trim() && selectedModels.length > 0
|
|
526
|
+
: "text-gray-600 hover:bg-gray-100"), children: model.name }, model.id))) })] })] })), _jsx("button", { type: "submit", disabled: !instruction.trim(), className: cn("p-2.5 rounded-xl transition-all duration-300", instruction.trim()
|
|
848
527
|
? "bg-violet-600 text-white shadow-lg shadow-violet-200 hover:bg-violet-700 hover:-translate-y-0.5"
|
|
849
|
-
: "bg-gray-100 text-gray-400 cursor-not-allowed"), title: "Send (Enter)", children: _jsx(SendHorizonal, { className: "w-4 h-4" }) })] })] }), conversationHistory.length > 0 && (_jsxs("div", { className: "flex items-center justify-between pt-1", children: [_jsxs("div", { className: "flex items-center gap-1.5 text-[10px] text-gray-400 font-medium", children: [_jsx(History, { className: "w-3 h-3" }), "Conversation active"] }), _jsxs("button", { onClick: handleStartOver, className: "text-[10px] font-bold text-violet-600 hover:text-violet-700 uppercase tracking-tight flex items-center gap-1 transition-colors", children: [_jsx(RotateCcw, { className: "w-3 h-3" }), "Clear History"] })] })), error && (_jsxs("div", { className: "text-xs text-red-600 bg-red-50 px-3 py-2 rounded-lg border border-red-100 flex items-start gap-2 animate-in fade-in slide-in-from-top-1 duration-200", children: [_jsx(X, { className: "w-3.5 h-3.5 mt-0.5 shrink-0" }), _jsx("span", { children: error })] }))] })), state === "
|
|
850
|
-
? "Responses (live)"
|
|
851
|
-
: "Model responses"] }), _jsx("div", { className: "flex gap-3 overflow-x-auto pb-1", children: Object.values(modelRuns).map((run) => (_jsxs("div", { className: cn("min-w-[280px] flex-1 rounded-xl p-3 flex flex-col gap-2 border", run.status === "done" && "border-green-100 bg-green-50/40", run.status === "error" && "border-red-100 bg-red-50/30", (run.status === "pending" || run.status === "streaming") && "border-violet-100 bg-violet-50/30"), children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsx("div", { className: "text-xs font-semibold text-gray-700 truncate", children: run.modelName }), _jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [(run.status === "pending" || run.status === "streaming") && (_jsx("button", { type: "button", onClick: () => handleStopModelRun(run.agentId), className: "p-1.5 rounded-lg text-gray-500 hover:text-red-600 hover:bg-red-50 transition-colors", title: "Stop this model", children: _jsx(StopCircle, { className: "w-4 h-4" }) })), _jsxs(Badge, { variant: "outline", className: cn("text-[10px]", run.status === "done" && "border-green-300 text-green-700", run.status === "error" && "border-red-300 text-red-700", (run.status === "pending" || run.status === "streaming") && "border-violet-300 text-violet-700"), children: [run.status === "pending" && "Queued", run.status === "streaming" && "Streaming…", run.status === "done" && "Ready", run.status === "error" && "Error"] })] })] }), _jsxs("div", { className: cn("text-xs whitespace-pre-wrap rounded-lg p-2 overflow-y-auto border min-h-[80px]", run.status === "done" && "bg-white/80 border-green-100", run.status === "error" && "bg-white/80 border-red-100 text-red-700", (run.status === "pending" || run.status === "streaming") && "bg-white/60 border-violet-100"), style: { maxHeight: isLarge ? "420px" : "200px" }, children: [run.status === "pending" && (_jsx("span", { className: "text-gray-400 italic", children: "Starting\u2026" })), run.status === "streaming" && (_jsx(_Fragment, { children: run.rawContent?.trim() ? (renderTextWithContext(run.rawContent, false)) : (_jsx("span", { className: "text-gray-400 italic", children: "Waiting for response\u2026" })) })), run.status === "done" && run.replacementText != null && (_jsxs(_Fragment, { children: [renderTextWithContext(run.replacementText, true), _jsxs(Button, { size: "sm", onClick: () => handleUseRunResult(run.replacementText), className: "mt-2 bg-violet-600 hover:bg-violet-700 text-white rounded-lg font-semibold w-full", children: [_jsx(Check, { className: "w-4 h-4 mr-1.5" }), "Use this"] })] })), run.status === "error" && (_jsx("div", { className: "text-red-700", children: run.error || "Something went wrong." }))] })] }, run.agentId))) })] })), _jsxs("form", { onSubmit: (e) => {
|
|
528
|
+
: "bg-gray-100 text-gray-400 cursor-not-allowed"), title: "Send (Enter)", children: _jsx(SendHorizonal, { className: "w-4 h-4" }) })] })] }), conversationHistory.length > 0 && (_jsxs("div", { className: "flex items-center justify-between pt-1", children: [_jsxs("div", { className: "flex items-center gap-1.5 text-[10px] text-gray-400 font-medium", children: [_jsx(History, { className: "w-3 h-3" }), "Conversation active"] }), _jsxs("button", { onClick: handleStartOver, className: "text-[10px] font-bold text-violet-600 hover:text-violet-700 uppercase tracking-tight flex items-center gap-1 transition-colors", children: [_jsx(RotateCcw, { className: "w-3 h-3" }), "Clear History"] })] })), error && (_jsxs("div", { className: "text-xs text-red-600 bg-red-50 px-3 py-2 rounded-lg border border-red-100 flex items-start gap-2 animate-in fade-in slide-in-from-top-1 duration-200", children: [_jsx(X, { className: "w-3.5 h-3.5 mt-0.5 shrink-0" }), _jsx("span", { children: error })] }))] })), state === "loading" && (_jsxs("div", { className: "flex flex-col items-center justify-center py-10 space-y-4", children: [_jsxs("div", { className: "relative", children: [_jsx("div", { className: "absolute inset-0 bg-violet-200 rounded-full animate-ping opacity-20" }), _jsx("div", { className: "relative bg-violet-50 p-4 rounded-full", children: _jsx(Loader2, { className: "w-8 h-8 text-violet-600 animate-spin" }) })] }), _jsxs("div", { className: "text-center", children: [_jsx("span", { className: "text-sm font-semibold text-gray-800 block", children: "AI is thinking..." }), _jsx("span", { className: "text-xs text-gray-500 mt-1 block px-10", children: "Updating your text based on your instructions." })] }), result && (_jsx("div", { className: "w-full mt-4 px-4 py-3 bg-violet-50/50 border border-violet-100 rounded-xl max-h-32 overflow-y-auto animate-in fade-in duration-300 whitespace-pre-wrap", children: renderTextWithContext(result, true) }))] })), state === "preview" && (_jsxs("div", { className: "space-y-4 animate-in fade-in slide-in-from-bottom-2 duration-300", children: [_jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-1.5 text-[10px] font-bold text-green-600 uppercase tracking-wider mb-2", children: [_jsx("div", { className: "w-1.5 h-1.5 rounded-full bg-green-500" }), "Suggested Edit"] }), _jsx("div", { className: "px-4 py-3 bg-green-50/50 border border-green-100 rounded-xl overflow-y-auto shadow-inner whitespace-pre-wrap transition-all duration-300", style: { maxHeight: isLarge ? '500px' : '192px' }, children: renderTextWithContext(result, true) })] }), _jsxs("form", { onSubmit: (e) => {
|
|
852
529
|
e.preventDefault();
|
|
853
530
|
if (instruction.trim()) {
|
|
854
531
|
executeAiModification(instruction.trim());
|
|
855
532
|
setInstruction("");
|
|
856
533
|
}
|
|
857
|
-
}, className: "relative group", children: [_jsx(Textarea, { ref: inputRef, value: instruction, onChange: (e) => setInstruction(e.target.value), onKeyDown: handleTextareaKeyDown, placeholder: "Not quite right? Ask for a change...", className: cn("w-full min-h-[80px] py-3 pl-3 pr-14 text-
|
|
534
|
+
}, className: "relative group", children: [_jsx(Textarea, { ref: inputRef, value: instruction, onChange: (e) => setInstruction(e.target.value), onKeyDown: handleTextareaKeyDown, placeholder: "Not quite right? Ask for a change...", className: cn("w-full min-h-[80px] py-3 pl-3 pr-14 text-sm rounded-2xl border border-gray-200", "focus:border-violet-400 focus:ring-4 focus:ring-violet-500/10", "outline-none transition-all duration-200 bg-gray-50/30 resize-none") }), _jsxs("div", { className: "absolute right-2 bottom-2 flex items-center gap-1", children: [hasMultipleModels && (_jsxs(Popover, { open: modelPopoverOpen, onOpenChange: setModelPopoverOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { type: "button", className: cn("p-1.5 rounded-lg transition-all duration-200", "text-gray-400 hover:text-violet-600 hover:bg-violet-50", modelPopoverOpen && "text-violet-600 bg-violet-50"), title: selectedModelName ? `Model: ${selectedModelName}` : "Select model", children: _jsx(Cpu, { className: "w-3.5 h-3.5" }) }) }), _jsxs(PopoverContent, { className: "w-48 p-1.5", align: "end", sideOffset: 8, children: [_jsx("div", { className: "text-[10px] font-semibold text-gray-400 uppercase tracking-wider px-2 py-1", children: "Model" }), _jsx("div", { className: "space-y-0.5", children: availableModels.map((model) => (_jsx("button", { type: "button", onClick: () => {
|
|
535
|
+
setSelectedModelId(model.id);
|
|
536
|
+
setModelPopoverOpen(false);
|
|
537
|
+
}, className: cn("w-full text-left px-2 py-1.5 text-xs rounded-md transition-colors", selectedModelId === model.id
|
|
858
538
|
? "bg-violet-100 text-violet-700 font-medium"
|
|
859
|
-
: "text-gray-600 hover:bg-gray-100"), children:
|
|
860
|
-
? "border-violet-600 bg-violet-600 text-white"
|
|
861
|
-
: "border-gray-300 bg-white text-transparent"), children: _jsx(Check, { className: "w-3 h-3" }) }), model.name] }, model.id))) })] })] })), _jsx("button", { type: "submit", disabled: !instruction.trim() || selectedModels.length === 0, className: cn("p-2.5 rounded-xl transition-all duration-300", instruction.trim() && selectedModels.length > 0
|
|
539
|
+
: "text-gray-600 hover:bg-gray-100"), children: model.name }, model.id))) })] })] })), _jsx("button", { type: "submit", disabled: !instruction.trim(), className: cn("p-2.5 rounded-xl transition-all duration-300", instruction.trim()
|
|
862
540
|
? "bg-violet-600 text-white shadow-lg shadow-violet-200 hover:bg-violet-700 hover:-translate-y-0.5"
|
|
863
|
-
: "bg-gray-100 text-gray-400 cursor-not-allowed"), title: "Refine (Enter)", children: _jsx(Wand2, { className: "w-4 h-4" }) })] })] }), _jsxs("div", { className: "flex gap-2.5 pt-1", children: [_jsxs(Button, { variant: "ghost", size: "sm", onClick: handleStartOver, className: "flex-1 text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded-xl font-medium", children: [_jsx(RotateCcw, { className: "w-4 h-4 mr-2" }), "Discard"] }), _jsxs(Button, {
|
|
541
|
+
: "bg-gray-100 text-gray-400 cursor-not-allowed"), title: "Refine (Enter)", children: _jsx(Wand2, { className: "w-4 h-4" }) })] })] }), _jsxs("div", { className: "flex gap-2.5 pt-1", children: [_jsxs(Button, { variant: "ghost", size: "sm", onClick: handleStartOver, className: "flex-1 text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded-xl font-medium", children: [_jsx(RotateCcw, { className: "w-4 h-4 mr-2" }), "Discard"] }), _jsxs(Button, { size: "sm", onClick: handleAccept, className: "flex-[1.5] bg-violet-600 hover:bg-violet-700 text-white shadow-md shadow-violet-200 rounded-xl font-semibold", children: [_jsx(Check, { className: "w-4 h-4 mr-2" }), "Replace Selection"] })] })] }))] })] }));
|
|
864
542
|
}
|
|
865
543
|
export default InlineAiDialog;
|
|
866
544
|
//# sourceMappingURL=InlineAiDialog.js.map
|