@codingame/monaco-vscode-chat-service-override 26.2.2 → 27.0.0
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/index.js +31 -1
- package/package.json +5 -5
- package/vscode/src/vs/platform/browserElements/common/browserElements.d.ts +15 -0
- package/vscode/src/vs/sessions/contrib/agentFeedback/browser/agentFeedbackService.d.ts +53 -0
- package/vscode/src/vs/sessions/contrib/agentFeedback/browser/agentFeedbackService.js +219 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/aiCustomizationWorkspaceService.d.ts +39 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/aiCustomizationWorkspaceService.js +83 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/newSession.d.ts +123 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/newSession.js +274 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionsConfigurationService.d.ts +71 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionsConfigurationService.js +284 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsManagementService.d.ts +79 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsManagementService.js +378 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityService.d.ts +1 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityService.js +27 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.d.ts +9 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.js +74 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.js +54 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +87 -53
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +71 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +43 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +22 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatForkActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatForkActions.js +154 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +6 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatNewActions.js +53 -43
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.js +84 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPluginActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPluginActions.js +33 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPromptNavigationActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQueueActions.js +15 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolActions.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatToolPicker.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +18 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.js +204 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.d.ts +77 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.js +541 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution.js +10 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.js +70 -65
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.d.ts +7 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.js +27 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsQuickAccess.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsQuickAccess.js +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjection.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.js +90 -51
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionsExperiments.contribution.js +20 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.js +43 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/media/agenttitlebarstatuswidget.css +7 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccess.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccess.js +84 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccessActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/{localAgentSessionsProvider.d.ts → localAgentSessionsController.d.ts} +7 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/{localAgentSessionsProvider.js → localAgentSessionsController.js} +24 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.js +171 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.d.ts +48 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.js +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.d.ts +181 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.js +943 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.contribution.js +248 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.js +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.d.ts +118 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.js +727 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditorInput.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditorInput.js +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWorkspaceService.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWorkspaceService.js +72 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCreatorService.d.ts +45 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCreatorService.js +165 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.d.ts +75 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.js +623 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationManagement.css +858 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.js +30 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgetRegistry.d.ts +32 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgetRegistry.js +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatVariables.js +19 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/simpleBrowserEditorOverlay.js +36 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +529 -363
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.js +419 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCollapsible.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCollapsible.js +46 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugDetailPanel.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugDetailPanel.js +198 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.d.ts +55 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.js +305 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditorInput.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditorInput.js +64 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventDetailRenderer.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventDetailRenderer.js +84 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventList.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventList.js +110 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFilters.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFilters.js +111 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowChartView.d.ts +71 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowChartView.js +611 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowGraph.d.ts +125 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowGraph.js +504 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowLayout.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowLayout.js +914 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHomeView.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHomeView.js +128 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.d.ts +58 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.js +429 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugMessageContentRenderer.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugMessageContentRenderer.js +113 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugModelTurnContentRenderer.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugModelTurnContentRenderer.js +126 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.js +279 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugToolCallContentRenderer.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugToolCallContentRenderer.js +122 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugTypes.d.ts +45 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugTypes.js +85 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/media/chatDebug.css +781 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationModelManager.js +5 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.js +16 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.js +63 -76
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatUsageWidget.js +26 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatManagementEditor.css +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +30 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/chatRepoInfo.d.ts +15 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatRepoInfo.js +40 -413
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.js +38 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.js +56 -46
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.js +15 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupGrowthSession.d.ts +52 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupGrowthSession.js +138 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.d.ts +11 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.js +166 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.js +37 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommands.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommands.js +351 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.js +118 -63
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/media/chatStatus.css +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.d.ts +182 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.js +892 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWindowNotifier.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWindowNotifier.js +55 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/contextContrib/chatContextService.js +28 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/createSlashCommandsUsageTracker.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/createSlashCommandsUsageTracker.js +62 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/defaultModelContribution.d.ts +36 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/defaultModelContribution.js +110 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/exploreAgentDefaultModel.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/exploreAgentDefaultModel.js +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelsConfigurationService.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelsConfigurationService.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/planAgentDefaultModel.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/planAgentDefaultModel.js +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.js +102 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.d.ts +16 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.js +69 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.js +2 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/skillActions.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/skillActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptsDebugContribution.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptsDebugContribution.js +76 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/sessionResourceMatching.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/sessionResourceMatching.js +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsConfirmationService.js +43 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.js +67 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.js +242 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.js +45 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolSetsContribution.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.js +311 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidgetService.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidgetService.js +10 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatQueuePickerActionItem.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatStatusWidget.js +8 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +64 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorContrib.js +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorHover.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/chatQuick.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditor.d.ts +15 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditor.js +42 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.d.ts +8 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.js +58 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl.js +6 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatViewPane.css +8 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatViewTitleControl.css +15 -6
- package/vscode/src/vs/workbench/contrib/chat/common/aiCustomizationWorkspaceService.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/chat/common/aiCustomizationWorkspaceService.js +27 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.d.ts +190 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.js +11 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.d.ts +36 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.js +188 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.d.ts +18 -8
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.js +192 -85
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceTelemetry.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceTelemetry.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatModelStore.d.ts +5 -6
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatModelStore.js +16 -8
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionStore.d.ts +8 -4
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionStore.js +111 -7
- package/vscode/src/vs/workbench/contrib/chat/common/participants/chatSlashCommands.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.d.ts +52 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.js +29 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.d.ts +73 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.js +622 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.d.ts +64 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.js +478 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +35 -16
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.js +1 -30
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.d.ts +0 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.js +2 -8
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/PromptHeaderDefinitionProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.js +23 -22
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +44 -14
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +345 -113
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +14 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +34 -24
- package/vscode/src/vs/workbench/contrib/chat/common/tools/chatTodoListService.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/chatTodoListService.js +13 -0
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +11 -5
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +248 -24
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatDefaultModel.d.ts +6 -11
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatDefaultModel.js +18 -81
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionService.js +2 -3
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +10 -10
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +14 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +10 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +6 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +1 -1
- package/vscode/src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.js +7 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/media/terminalChatWidget.css +6 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +16 -16
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +35 -26
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.js +1 -5
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +6 -6
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.js +13 -11
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +3 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/awaitTerminalTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/npmScriptAutoApprover.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.js +12 -12
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/killTerminalTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +280 -65
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/outputAnalyzer.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +2 -10
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +47 -19
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.js +31 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +14 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +7 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +14 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.d.ts +6 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.js +38 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCustomizationDiagnosticsAction.d.ts +0 -72
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCustomizationDiagnosticsAction.js +0 -587
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatProgressTypes/chatToolInvocation.d.ts +0 -71
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatProgressTypes/chatToolInvocation.js +0 -293
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/utils.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/utils.js +0 -31
|
@@ -0,0 +1,914 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
const NODE_HEIGHT = 36;
|
|
4
|
+
const MESSAGE_NODE_HEIGHT = 52;
|
|
5
|
+
const NODE_MIN_WIDTH = 140;
|
|
6
|
+
const NODE_MAX_WIDTH = 320;
|
|
7
|
+
const NODE_PADDING_H = 16;
|
|
8
|
+
const NODE_PADDING_V = 6;
|
|
9
|
+
const NODE_GAP_Y = 24;
|
|
10
|
+
const NODE_BORDER_RADIUS = 6;
|
|
11
|
+
const EDGE_STROKE_WIDTH = 1.5;
|
|
12
|
+
const FONT_SIZE = 12;
|
|
13
|
+
const SUBLABEL_FONT_SIZE = 10;
|
|
14
|
+
const SUBGRAPH_PADDING = 12;
|
|
15
|
+
const CANVAS_PADDING = 24;
|
|
16
|
+
const PARALLEL_GAP_X = 40;
|
|
17
|
+
const SUBGRAPH_HEADER_HEIGHT = 22;
|
|
18
|
+
const GUTTER_WIDTH = 3;
|
|
19
|
+
const MERGED_TOGGLE_WIDTH = 36;
|
|
20
|
+
const PARALLEL_TIME_THRESHOLD_MS = 5_000;
|
|
21
|
+
function groupChildren(children) {
|
|
22
|
+
const subagentIndices = [];
|
|
23
|
+
for (let i = 0; i < children.length; i++) {
|
|
24
|
+
if (children[i].kind === "subagentInvocation") {
|
|
25
|
+
subagentIndices.push(i);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (subagentIndices.length < 2) {
|
|
29
|
+
return [{
|
|
30
|
+
type: "sequential",
|
|
31
|
+
children
|
|
32
|
+
}];
|
|
33
|
+
}
|
|
34
|
+
const parallelClusters = [];
|
|
35
|
+
let cluster = [subagentIndices[0]];
|
|
36
|
+
for (let k = 1; k < subagentIndices.length; k++) {
|
|
37
|
+
const prevCreated = children[subagentIndices[k - 1]].created;
|
|
38
|
+
const currCreated = children[subagentIndices[k]].created;
|
|
39
|
+
if (Math.abs(currCreated - prevCreated) <= PARALLEL_TIME_THRESHOLD_MS) {
|
|
40
|
+
cluster.push(subagentIndices[k]);
|
|
41
|
+
} else {
|
|
42
|
+
if (cluster.length >= 2) {
|
|
43
|
+
parallelClusters.push(cluster);
|
|
44
|
+
}
|
|
45
|
+
cluster = [subagentIndices[k]];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (cluster.length >= 2) {
|
|
49
|
+
parallelClusters.push(cluster);
|
|
50
|
+
}
|
|
51
|
+
if (parallelClusters.length === 0) {
|
|
52
|
+
return [{
|
|
53
|
+
type: "sequential",
|
|
54
|
+
children
|
|
55
|
+
}];
|
|
56
|
+
}
|
|
57
|
+
const parallelIndices = ( new Set());
|
|
58
|
+
for (const c of parallelClusters) {
|
|
59
|
+
for (const idx of c) {
|
|
60
|
+
parallelIndices.add(idx);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const groups = [];
|
|
64
|
+
let clusterIdx = 0;
|
|
65
|
+
let i = 0;
|
|
66
|
+
while (i < children.length) {
|
|
67
|
+
if (clusterIdx < parallelClusters.length && i === parallelClusters[clusterIdx][0]) {
|
|
68
|
+
const cl = parallelClusters[clusterIdx];
|
|
69
|
+
const lastIdx = cl[cl.length - 1];
|
|
70
|
+
const setup = [];
|
|
71
|
+
const subagents = [];
|
|
72
|
+
for (let j = cl[0]; j <= lastIdx; j++) {
|
|
73
|
+
if (( parallelIndices.has(j))) {
|
|
74
|
+
subagents.push(children[j]);
|
|
75
|
+
} else {
|
|
76
|
+
setup.push(children[j]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (setup.length > 0) {
|
|
80
|
+
groups.push({
|
|
81
|
+
type: "sequential",
|
|
82
|
+
children: setup
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
groups.push({
|
|
86
|
+
type: "parallel",
|
|
87
|
+
children: subagents
|
|
88
|
+
});
|
|
89
|
+
i = lastIdx + 1;
|
|
90
|
+
clusterIdx++;
|
|
91
|
+
} else {
|
|
92
|
+
const start = i;
|
|
93
|
+
const nextStart = clusterIdx < parallelClusters.length ? parallelClusters[clusterIdx][0] : children.length;
|
|
94
|
+
while (i < nextStart && !( parallelIndices.has(i))) {
|
|
95
|
+
i++;
|
|
96
|
+
}
|
|
97
|
+
if (i > start) {
|
|
98
|
+
groups.push({
|
|
99
|
+
type: "sequential",
|
|
100
|
+
children: children.slice(start, i)
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return groups;
|
|
106
|
+
}
|
|
107
|
+
function isMessageKind(kind) {
|
|
108
|
+
return kind === "userMessage" || kind === "agentResponse";
|
|
109
|
+
}
|
|
110
|
+
function measureNodeWidth(label, sublabel) {
|
|
111
|
+
const charWidth = 7;
|
|
112
|
+
const labelWidth = label.length * charWidth + NODE_PADDING_H * 2;
|
|
113
|
+
const sublabelWidth = sublabel ? sublabel.length * (charWidth - 1) + NODE_PADDING_H * 2 : 0;
|
|
114
|
+
return Math.min(NODE_MAX_WIDTH, Math.max(NODE_MIN_WIDTH, labelWidth, sublabelWidth));
|
|
115
|
+
}
|
|
116
|
+
function subgraphHeaderLabel(node) {
|
|
117
|
+
return node.description ? `${node.label}: ${node.description}` : node.label;
|
|
118
|
+
}
|
|
119
|
+
function measureSubgraphHeaderWidth(headerLabel) {
|
|
120
|
+
return headerLabel.length * 6 + SUBGRAPH_PADDING * 2 + 20;
|
|
121
|
+
}
|
|
122
|
+
function countDescendants(node) {
|
|
123
|
+
let count = node.children.length;
|
|
124
|
+
for (const child of node.children) {
|
|
125
|
+
count += countDescendants(child);
|
|
126
|
+
}
|
|
127
|
+
return count;
|
|
128
|
+
}
|
|
129
|
+
function layoutGroups(
|
|
130
|
+
groups,
|
|
131
|
+
startX,
|
|
132
|
+
startY,
|
|
133
|
+
depth,
|
|
134
|
+
prevExitNodes,
|
|
135
|
+
result,
|
|
136
|
+
collapsedIds,
|
|
137
|
+
expandedMergedIds,
|
|
138
|
+
pendingExpansions
|
|
139
|
+
) {
|
|
140
|
+
let currentY = startY;
|
|
141
|
+
let maxWidth = 0;
|
|
142
|
+
let exitNodes = prevExitNodes;
|
|
143
|
+
for (const group of groups) {
|
|
144
|
+
if (group.type === "parallel") {
|
|
145
|
+
const pg = layoutParallelGroup(
|
|
146
|
+
group.children,
|
|
147
|
+
startX,
|
|
148
|
+
currentY,
|
|
149
|
+
depth,
|
|
150
|
+
collapsedIds,
|
|
151
|
+
expandedMergedIds,
|
|
152
|
+
pendingExpansions
|
|
153
|
+
);
|
|
154
|
+
result.nodes.push(...pg.nodes);
|
|
155
|
+
result.edges.push(...pg.edges);
|
|
156
|
+
result.subgraphs.push(...pg.subgraphs);
|
|
157
|
+
for (const prev of exitNodes) {
|
|
158
|
+
for (const entry of pg.entryNodes) {
|
|
159
|
+
result.edges.push(makeEdge(prev, entry));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
exitNodes = pg.exitNodes;
|
|
163
|
+
maxWidth = Math.max(maxWidth, pg.width);
|
|
164
|
+
currentY += pg.height + NODE_GAP_Y;
|
|
165
|
+
} else {
|
|
166
|
+
for (const child of group.children) {
|
|
167
|
+
const sub = layoutSubtree(
|
|
168
|
+
child,
|
|
169
|
+
startX,
|
|
170
|
+
currentY,
|
|
171
|
+
depth,
|
|
172
|
+
collapsedIds,
|
|
173
|
+
expandedMergedIds,
|
|
174
|
+
pendingExpansions
|
|
175
|
+
);
|
|
176
|
+
result.nodes.push(...sub.nodes);
|
|
177
|
+
result.edges.push(...sub.edges);
|
|
178
|
+
result.subgraphs.push(...sub.subgraphs);
|
|
179
|
+
for (const prev of exitNodes) {
|
|
180
|
+
result.edges.push(makeEdge(prev, sub.entryNode));
|
|
181
|
+
}
|
|
182
|
+
exitNodes = sub.exitNodes;
|
|
183
|
+
maxWidth = Math.max(maxWidth, sub.width);
|
|
184
|
+
currentY += sub.height + NODE_GAP_Y;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return {
|
|
189
|
+
exitNodes,
|
|
190
|
+
maxWidth,
|
|
191
|
+
endY: currentY
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
function makeEdge(from, to) {
|
|
195
|
+
return {
|
|
196
|
+
fromId: from.id,
|
|
197
|
+
toId: to.id,
|
|
198
|
+
fromX: from.x + from.width / 2,
|
|
199
|
+
fromY: from.y + from.height,
|
|
200
|
+
toX: to.x + to.width / 2,
|
|
201
|
+
toY: to.y
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function layoutFlowGraph(roots, options) {
|
|
205
|
+
if (roots.length === 0) {
|
|
206
|
+
return {
|
|
207
|
+
nodes: [],
|
|
208
|
+
edges: [],
|
|
209
|
+
subgraphs: [],
|
|
210
|
+
width: 0,
|
|
211
|
+
height: 0
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
const collapsedIds = options?.collapsedIds;
|
|
215
|
+
const expandedMergedIds = options?.expandedMergedIds;
|
|
216
|
+
const groups = groupChildren(roots);
|
|
217
|
+
const pendingExpansions = [];
|
|
218
|
+
const result = {
|
|
219
|
+
nodes: [],
|
|
220
|
+
edges: [],
|
|
221
|
+
subgraphs: []
|
|
222
|
+
};
|
|
223
|
+
const {
|
|
224
|
+
maxWidth,
|
|
225
|
+
endY
|
|
226
|
+
} = layoutGroups(
|
|
227
|
+
groups,
|
|
228
|
+
CANVAS_PADDING,
|
|
229
|
+
CANVAS_PADDING,
|
|
230
|
+
0,
|
|
231
|
+
[],
|
|
232
|
+
result,
|
|
233
|
+
collapsedIds,
|
|
234
|
+
expandedMergedIds,
|
|
235
|
+
pendingExpansions
|
|
236
|
+
);
|
|
237
|
+
resolvePendingExpansions(pendingExpansions, result);
|
|
238
|
+
let width = maxWidth + CANVAS_PADDING * 2;
|
|
239
|
+
let height = endY - NODE_GAP_Y + CANVAS_PADDING;
|
|
240
|
+
for (const n of result.nodes) {
|
|
241
|
+
width = Math.max(width, n.x + n.width + CANVAS_PADDING);
|
|
242
|
+
height = Math.max(height, n.y + n.height + CANVAS_PADDING);
|
|
243
|
+
}
|
|
244
|
+
centerLayout(result, width / 2);
|
|
245
|
+
return {
|
|
246
|
+
nodes: result.nodes,
|
|
247
|
+
edges: result.edges,
|
|
248
|
+
subgraphs: result.subgraphs,
|
|
249
|
+
width,
|
|
250
|
+
height
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function resolvePendingExpansions(pendingExpansions, result) {
|
|
254
|
+
for (const expansion of pendingExpansions) {
|
|
255
|
+
const {
|
|
256
|
+
mergedNode,
|
|
257
|
+
children
|
|
258
|
+
} = expansion;
|
|
259
|
+
const childrenTotalHeight = children.length * NODE_HEIGHT + (children.length - 1) * NODE_GAP_Y;
|
|
260
|
+
const rangeTop = mergedNode.y;
|
|
261
|
+
const rangeBottom = mergedNode.y + childrenTotalHeight;
|
|
262
|
+
let maxRightX = mergedNode.x + mergedNode.width;
|
|
263
|
+
for (const n of result.nodes) {
|
|
264
|
+
if (n.y + n.height > rangeTop && n.y < rangeBottom) {
|
|
265
|
+
maxRightX = Math.max(maxRightX, n.x + n.width);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
for (const sg of result.subgraphs) {
|
|
269
|
+
if (sg.y + sg.height > rangeTop && sg.y < rangeBottom) {
|
|
270
|
+
maxRightX = Math.max(maxRightX, sg.x + sg.width);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
const expandX = maxRightX + PARALLEL_GAP_X;
|
|
274
|
+
let expandY = mergedNode.y;
|
|
275
|
+
const childNodes = [];
|
|
276
|
+
for (const child of children) {
|
|
277
|
+
const childWidth = measureNodeWidth(child.label, child.sublabel);
|
|
278
|
+
const childNode = {
|
|
279
|
+
id: child.id,
|
|
280
|
+
kind: child.kind,
|
|
281
|
+
label: child.label,
|
|
282
|
+
sublabel: child.sublabel,
|
|
283
|
+
tooltip: child.tooltip,
|
|
284
|
+
isError: child.isError,
|
|
285
|
+
x: expandX,
|
|
286
|
+
y: expandY,
|
|
287
|
+
width: childWidth,
|
|
288
|
+
height: NODE_HEIGHT
|
|
289
|
+
};
|
|
290
|
+
childNodes.push(childNode);
|
|
291
|
+
result.nodes.push(childNode);
|
|
292
|
+
expandY += NODE_HEIGHT + NODE_GAP_Y;
|
|
293
|
+
}
|
|
294
|
+
result.edges.push({
|
|
295
|
+
fromId: mergedNode.id,
|
|
296
|
+
toId: childNodes[0].id,
|
|
297
|
+
fromX: mergedNode.x + mergedNode.width,
|
|
298
|
+
fromY: mergedNode.y + mergedNode.height / 2,
|
|
299
|
+
toX: expandX,
|
|
300
|
+
toY: childNodes[0].y + childNodes[0].height / 2
|
|
301
|
+
});
|
|
302
|
+
for (let k = 0; k < childNodes.length - 1; k++) {
|
|
303
|
+
result.edges.push(makeEdge(childNodes[k], childNodes[k + 1]));
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
function layoutSubtree(node, startX, y, depth, collapsedIds, expandedMergedIds, pendingExpansions) {
|
|
308
|
+
const isMerged = (node.mergedNodes?.length ?? 0) >= 2;
|
|
309
|
+
const isMergedExpanded = isMerged && expandedMergedIds?.has(node.id);
|
|
310
|
+
const mergedExtra = isMerged ? MERGED_TOGGLE_WIDTH : 0;
|
|
311
|
+
const nodeWidth = measureNodeWidth(node.label, node.sublabel) + mergedExtra;
|
|
312
|
+
const isSubagent = node.kind === "subagentInvocation";
|
|
313
|
+
const isCollapsed = isSubagent && collapsedIds?.has(node.id);
|
|
314
|
+
const nodeHeight = isMessageKind(node.kind) && node.sublabel ? MESSAGE_NODE_HEIGHT : NODE_HEIGHT;
|
|
315
|
+
const layoutNode = {
|
|
316
|
+
id: node.id,
|
|
317
|
+
kind: node.kind,
|
|
318
|
+
label: node.label,
|
|
319
|
+
sublabel: node.sublabel,
|
|
320
|
+
tooltip: node.tooltip,
|
|
321
|
+
isError: node.isError,
|
|
322
|
+
x: startX,
|
|
323
|
+
y: y,
|
|
324
|
+
width: nodeWidth,
|
|
325
|
+
height: nodeHeight,
|
|
326
|
+
mergedCount: isMerged ? node.mergedNodes.length : undefined,
|
|
327
|
+
isMergedExpanded
|
|
328
|
+
};
|
|
329
|
+
const result = {
|
|
330
|
+
nodes: [layoutNode],
|
|
331
|
+
edges: [],
|
|
332
|
+
subgraphs: [],
|
|
333
|
+
width: nodeWidth,
|
|
334
|
+
height: nodeHeight,
|
|
335
|
+
entryNode: layoutNode,
|
|
336
|
+
exitNodes: [layoutNode]
|
|
337
|
+
};
|
|
338
|
+
if (isMergedExpanded && pendingExpansions) {
|
|
339
|
+
pendingExpansions.push({
|
|
340
|
+
mergedNode: layoutNode,
|
|
341
|
+
children: node.mergedNodes
|
|
342
|
+
});
|
|
343
|
+
return result;
|
|
344
|
+
}
|
|
345
|
+
if (node.children.length === 0 && !isCollapsed) {
|
|
346
|
+
return result;
|
|
347
|
+
}
|
|
348
|
+
if (isCollapsed) {
|
|
349
|
+
const collapsedHeight = SUBGRAPH_HEADER_HEIGHT + SUBGRAPH_PADDING * 2;
|
|
350
|
+
const totalChildCount = countDescendants(node);
|
|
351
|
+
const sgY = (y + nodeHeight + NODE_GAP_Y) - NODE_GAP_Y / 2;
|
|
352
|
+
const headerLabel = subgraphHeaderLabel(node);
|
|
353
|
+
const sgWidth = Math.max(NODE_MIN_WIDTH, measureSubgraphHeaderWidth(headerLabel)) + SUBGRAPH_PADDING * 2;
|
|
354
|
+
result.subgraphs.push({
|
|
355
|
+
label: headerLabel,
|
|
356
|
+
x: startX - SUBGRAPH_PADDING,
|
|
357
|
+
y: sgY,
|
|
358
|
+
width: sgWidth,
|
|
359
|
+
height: collapsedHeight,
|
|
360
|
+
depth,
|
|
361
|
+
nodeId: node.id,
|
|
362
|
+
collapsedChildCount: totalChildCount
|
|
363
|
+
});
|
|
364
|
+
result.edges.push({
|
|
365
|
+
fromX: startX + nodeWidth / 2,
|
|
366
|
+
fromY: y + nodeHeight,
|
|
367
|
+
toX: startX - SUBGRAPH_PADDING + sgWidth / 2,
|
|
368
|
+
toY: sgY
|
|
369
|
+
});
|
|
370
|
+
result.width = Math.max(nodeWidth, sgWidth);
|
|
371
|
+
result.height = nodeHeight + NODE_GAP_Y + collapsedHeight;
|
|
372
|
+
return result;
|
|
373
|
+
}
|
|
374
|
+
if (node.children.length === 0) {
|
|
375
|
+
return result;
|
|
376
|
+
}
|
|
377
|
+
const childDepth = isSubagent ? depth + 1 : depth;
|
|
378
|
+
const indentX = isSubagent ? SUBGRAPH_PADDING : 0;
|
|
379
|
+
const groups = groupChildren(node.children);
|
|
380
|
+
let childStartY = y + nodeHeight + NODE_GAP_Y;
|
|
381
|
+
if (isSubagent) {
|
|
382
|
+
childStartY += SUBGRAPH_HEADER_HEIGHT;
|
|
383
|
+
}
|
|
384
|
+
const {
|
|
385
|
+
exitNodes,
|
|
386
|
+
maxWidth,
|
|
387
|
+
endY
|
|
388
|
+
} = layoutGroups(
|
|
389
|
+
groups,
|
|
390
|
+
startX + indentX,
|
|
391
|
+
childStartY,
|
|
392
|
+
childDepth,
|
|
393
|
+
[layoutNode],
|
|
394
|
+
result,
|
|
395
|
+
collapsedIds,
|
|
396
|
+
expandedMergedIds,
|
|
397
|
+
pendingExpansions
|
|
398
|
+
);
|
|
399
|
+
const totalChildrenHeight = endY - childStartY - NODE_GAP_Y;
|
|
400
|
+
let sgContentWidth = maxWidth;
|
|
401
|
+
if (isSubagent) {
|
|
402
|
+
const headerLabel = subgraphHeaderLabel(node);
|
|
403
|
+
sgContentWidth = Math.max(maxWidth, measureSubgraphHeaderWidth(headerLabel));
|
|
404
|
+
result.subgraphs.push({
|
|
405
|
+
label: headerLabel,
|
|
406
|
+
x: startX - SUBGRAPH_PADDING,
|
|
407
|
+
y: (y + nodeHeight + NODE_GAP_Y) - NODE_GAP_Y / 2,
|
|
408
|
+
width: sgContentWidth + SUBGRAPH_PADDING * 2,
|
|
409
|
+
height: totalChildrenHeight + SUBGRAPH_HEADER_HEIGHT + NODE_GAP_Y,
|
|
410
|
+
depth,
|
|
411
|
+
nodeId: node.id
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
result.width = Math.max(
|
|
415
|
+
nodeWidth,
|
|
416
|
+
maxWidth + indentX * 2,
|
|
417
|
+
isSubagent ? sgContentWidth + indentX * 2 : 0
|
|
418
|
+
);
|
|
419
|
+
result.height = nodeHeight + NODE_GAP_Y + totalChildrenHeight + (isSubagent ? SUBGRAPH_HEADER_HEIGHT : 0);
|
|
420
|
+
result.exitNodes = exitNodes;
|
|
421
|
+
return result;
|
|
422
|
+
}
|
|
423
|
+
function layoutParallelGroup(
|
|
424
|
+
children,
|
|
425
|
+
startX,
|
|
426
|
+
y,
|
|
427
|
+
depth,
|
|
428
|
+
collapsedIds,
|
|
429
|
+
expandedMergedIds,
|
|
430
|
+
pendingExpansions
|
|
431
|
+
) {
|
|
432
|
+
const subtreeLayouts = [];
|
|
433
|
+
let totalWidth = 0;
|
|
434
|
+
let maxHeight = 0;
|
|
435
|
+
for (const child of children) {
|
|
436
|
+
const subtree = layoutSubtree(child, 0, y, depth, collapsedIds, expandedMergedIds, pendingExpansions);
|
|
437
|
+
subtreeLayouts.push(subtree);
|
|
438
|
+
totalWidth += subtree.width;
|
|
439
|
+
maxHeight = Math.max(maxHeight, subtree.height);
|
|
440
|
+
}
|
|
441
|
+
totalWidth += (children.length - 1) * PARALLEL_GAP_X;
|
|
442
|
+
const nodes = [];
|
|
443
|
+
const edges = [];
|
|
444
|
+
const subgraphs = [];
|
|
445
|
+
const entryNodes = [];
|
|
446
|
+
const exitNodes = [];
|
|
447
|
+
let currentX = startX;
|
|
448
|
+
for (const subtree of subtreeLayouts) {
|
|
449
|
+
const dx = currentX;
|
|
450
|
+
const offsetNodes = ( subtree.nodes.map(n => ({
|
|
451
|
+
...n,
|
|
452
|
+
x: n.x + dx
|
|
453
|
+
})));
|
|
454
|
+
const offsetEdges = ( subtree.edges.map(e => ({
|
|
455
|
+
fromId: e.fromId,
|
|
456
|
+
toId: e.toId,
|
|
457
|
+
fromX: e.fromX + dx,
|
|
458
|
+
fromY: e.fromY,
|
|
459
|
+
toX: e.toX + dx,
|
|
460
|
+
toY: e.toY
|
|
461
|
+
})));
|
|
462
|
+
const offsetSubgraphs = ( subtree.subgraphs.map(s => ({
|
|
463
|
+
...s,
|
|
464
|
+
x: s.x + dx
|
|
465
|
+
})));
|
|
466
|
+
nodes.push(...offsetNodes);
|
|
467
|
+
edges.push(...offsetEdges);
|
|
468
|
+
subgraphs.push(...offsetSubgraphs);
|
|
469
|
+
entryNodes.push(offsetNodes.find(n => n.id === subtree.entryNode.id));
|
|
470
|
+
const exitIds = ( new Set(( subtree.exitNodes.map(n => n.id))));
|
|
471
|
+
exitNodes.push(...offsetNodes.filter(n => ( exitIds.has(n.id))));
|
|
472
|
+
currentX += subtree.width + PARALLEL_GAP_X;
|
|
473
|
+
}
|
|
474
|
+
return {
|
|
475
|
+
nodes,
|
|
476
|
+
edges,
|
|
477
|
+
subgraphs,
|
|
478
|
+
entryNodes,
|
|
479
|
+
exitNodes,
|
|
480
|
+
width: totalWidth,
|
|
481
|
+
height: maxHeight
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
function centerLayout(layout, centerX) {
|
|
485
|
+
if (layout.nodes.length === 0) {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
let minX = Infinity;
|
|
489
|
+
let maxX = -Infinity;
|
|
490
|
+
for (const node of layout.nodes) {
|
|
491
|
+
minX = Math.min(minX, node.x);
|
|
492
|
+
maxX = Math.max(maxX, node.x + node.width);
|
|
493
|
+
}
|
|
494
|
+
const dx = centerX - (minX + maxX) / 2;
|
|
495
|
+
for (let i = 0; i < layout.nodes.length; i++) {
|
|
496
|
+
const n = layout.nodes[i];
|
|
497
|
+
layout.nodes[i] = {
|
|
498
|
+
...n,
|
|
499
|
+
x: n.x + dx
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
for (let i = 0; i < layout.edges.length; i++) {
|
|
503
|
+
const e = layout.edges[i];
|
|
504
|
+
layout.edges[i] = {
|
|
505
|
+
fromId: e.fromId,
|
|
506
|
+
toId: e.toId,
|
|
507
|
+
fromX: e.fromX + dx,
|
|
508
|
+
fromY: e.fromY,
|
|
509
|
+
toX: e.toX + dx,
|
|
510
|
+
toY: e.toY
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
for (let i = 0; i < layout.subgraphs.length; i++) {
|
|
514
|
+
const s = layout.subgraphs[i];
|
|
515
|
+
layout.subgraphs[i] = {
|
|
516
|
+
...s,
|
|
517
|
+
x: s.x + dx
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
const SVG_NS = "http://www.w3.org/2000/svg";
|
|
522
|
+
function svgEl(tag, attrs) {
|
|
523
|
+
const el = document.createElementNS(SVG_NS, tag);
|
|
524
|
+
for (const [k, v] of Object.entries(attrs)) {
|
|
525
|
+
el.setAttribute(k, String(v));
|
|
526
|
+
}
|
|
527
|
+
return el;
|
|
528
|
+
}
|
|
529
|
+
function getNodeColor(kind, isError) {
|
|
530
|
+
if (isError) {
|
|
531
|
+
return "var(--vscode-errorForeground)";
|
|
532
|
+
}
|
|
533
|
+
switch (kind) {
|
|
534
|
+
case "userMessage":
|
|
535
|
+
return "var(--vscode-textLink-foreground)";
|
|
536
|
+
case "modelTurn":
|
|
537
|
+
return "var(--vscode-charts-blue, var(--vscode-textLink-foreground))";
|
|
538
|
+
case "toolCall":
|
|
539
|
+
return "var(--vscode-testing-iconPassed, #73c991)";
|
|
540
|
+
case "subagentInvocation":
|
|
541
|
+
return "var(--vscode-charts-purple, #b267e6)";
|
|
542
|
+
case "agentResponse":
|
|
543
|
+
return "var(--vscode-foreground)";
|
|
544
|
+
case "generic":
|
|
545
|
+
return "var(--vscode-descriptionForeground)";
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
const SUBGRAPH_COLORS = [
|
|
549
|
+
"var(--vscode-charts-purple, #b267e6)",
|
|
550
|
+
"var(--vscode-charts-blue, #3dc9b0)",
|
|
551
|
+
"var(--vscode-charts-yellow, #e5c07b)",
|
|
552
|
+
"var(--vscode-charts-orange, #d19a66)"
|
|
553
|
+
];
|
|
554
|
+
function renderFlowChartSVG(layout) {
|
|
555
|
+
const focusableElements = ( new Map());
|
|
556
|
+
const svg = svgEl("svg", {
|
|
557
|
+
width: layout.width,
|
|
558
|
+
height: layout.height,
|
|
559
|
+
viewBox: `0 0 ${layout.width} ${layout.height}`,
|
|
560
|
+
role: "img",
|
|
561
|
+
"aria-label": `Agent flow chart with ${layout.nodes.length} nodes`
|
|
562
|
+
});
|
|
563
|
+
svg.classList.add("chat-debug-flowchart-svg");
|
|
564
|
+
renderSubgraphs(svg, layout.subgraphs, focusableElements);
|
|
565
|
+
renderEdges(svg, layout.edges);
|
|
566
|
+
renderNodes(svg, layout.nodes, focusableElements);
|
|
567
|
+
const positionByKey = ( new Map());
|
|
568
|
+
for (const sg of layout.subgraphs) {
|
|
569
|
+
positionByKey.set(`sg:${sg.nodeId}`, {
|
|
570
|
+
y: sg.y,
|
|
571
|
+
x: sg.x
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
for (const node of layout.nodes) {
|
|
575
|
+
positionByKey.set(node.id, {
|
|
576
|
+
y: node.y,
|
|
577
|
+
x: node.x
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
const sortedFocusable = ( new Map([...focusableElements.entries()].sort((a, b) => {
|
|
581
|
+
const posA = positionByKey.get(a[0]);
|
|
582
|
+
const posB = positionByKey.get(b[0]);
|
|
583
|
+
if (!posA || !posB) {
|
|
584
|
+
return 0;
|
|
585
|
+
}
|
|
586
|
+
return posA.y !== posB.y ? posA.y - posB.y : posA.x - posB.x;
|
|
587
|
+
})));
|
|
588
|
+
const adjacency = ( new Map());
|
|
589
|
+
for (const edge of layout.edges) {
|
|
590
|
+
if (edge.fromId && edge.toId) {
|
|
591
|
+
let fromEntry = adjacency.get(edge.fromId);
|
|
592
|
+
if (!fromEntry) {
|
|
593
|
+
fromEntry = {
|
|
594
|
+
next: [],
|
|
595
|
+
prev: []
|
|
596
|
+
};
|
|
597
|
+
adjacency.set(edge.fromId, fromEntry);
|
|
598
|
+
}
|
|
599
|
+
fromEntry.next.push(edge.toId);
|
|
600
|
+
let toEntry = adjacency.get(edge.toId);
|
|
601
|
+
if (!toEntry) {
|
|
602
|
+
toEntry = {
|
|
603
|
+
next: [],
|
|
604
|
+
prev: []
|
|
605
|
+
};
|
|
606
|
+
adjacency.set(edge.toId, toEntry);
|
|
607
|
+
}
|
|
608
|
+
toEntry.prev.push(edge.fromId);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
return {
|
|
612
|
+
svg,
|
|
613
|
+
focusableElements: sortedFocusable,
|
|
614
|
+
adjacency,
|
|
615
|
+
positions: positionByKey
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
function renderSubgraphs(svg, subgraphs, focusableElements) {
|
|
619
|
+
for (let sgIdx = 0; sgIdx < subgraphs.length; sgIdx++) {
|
|
620
|
+
const sg = subgraphs[sgIdx];
|
|
621
|
+
const color = SUBGRAPH_COLORS[sg.depth % SUBGRAPH_COLORS.length];
|
|
622
|
+
const isCollapsed = sg.collapsedChildCount !== undefined;
|
|
623
|
+
const g = document.createElementNS(SVG_NS, "g");
|
|
624
|
+
g.classList.add("chat-debug-flowchart-subgraph");
|
|
625
|
+
const rectAttrs = {
|
|
626
|
+
x: sg.x,
|
|
627
|
+
y: sg.y,
|
|
628
|
+
width: sg.width,
|
|
629
|
+
height: sg.height,
|
|
630
|
+
rx: NODE_BORDER_RADIUS,
|
|
631
|
+
ry: NODE_BORDER_RADIUS
|
|
632
|
+
};
|
|
633
|
+
const clipId = `sg-clip-${sgIdx}`;
|
|
634
|
+
const clipPath = svgEl("clipPath", {
|
|
635
|
+
id: clipId
|
|
636
|
+
});
|
|
637
|
+
clipPath.appendChild(svgEl("rect", rectAttrs));
|
|
638
|
+
svg.appendChild(clipPath);
|
|
639
|
+
g.appendChild(svgEl("rect", {
|
|
640
|
+
...rectAttrs,
|
|
641
|
+
fill: color,
|
|
642
|
+
opacity: 0.06 + sg.depth * 0.02
|
|
643
|
+
}));
|
|
644
|
+
g.appendChild(svgEl("rect", {
|
|
645
|
+
...rectAttrs,
|
|
646
|
+
fill: "none",
|
|
647
|
+
stroke: color,
|
|
648
|
+
"stroke-width": 1,
|
|
649
|
+
"stroke-dasharray": "6,3",
|
|
650
|
+
opacity: 0.5
|
|
651
|
+
}));
|
|
652
|
+
g.appendChild(svgEl("rect", {
|
|
653
|
+
x: sg.x,
|
|
654
|
+
y: sg.y,
|
|
655
|
+
width: GUTTER_WIDTH,
|
|
656
|
+
height: sg.height,
|
|
657
|
+
fill: color,
|
|
658
|
+
opacity: 0.7,
|
|
659
|
+
"clip-path": `url(#${clipId})`
|
|
660
|
+
}));
|
|
661
|
+
const headerGroup = document.createElementNS(SVG_NS, "g");
|
|
662
|
+
headerGroup.setAttribute("data-subgraph-id", sg.nodeId);
|
|
663
|
+
headerGroup.classList.add("chat-debug-flowchart-subgraph-header");
|
|
664
|
+
headerGroup.setAttribute("tabindex", "0");
|
|
665
|
+
headerGroup.setAttribute("role", "button");
|
|
666
|
+
headerGroup.setAttribute("aria-expanded", String(!isCollapsed));
|
|
667
|
+
headerGroup.setAttribute(
|
|
668
|
+
"aria-label",
|
|
669
|
+
`${sg.label}: ${isCollapsed ? "collapsed" : "expanded"}${isCollapsed && sg.collapsedChildCount !== undefined ? `, ${sg.collapsedChildCount} items hidden` : ""}`
|
|
670
|
+
);
|
|
671
|
+
const headerBar = svgEl("rect", {
|
|
672
|
+
x: sg.x,
|
|
673
|
+
y: sg.y,
|
|
674
|
+
width: sg.width,
|
|
675
|
+
height: SUBGRAPH_HEADER_HEIGHT,
|
|
676
|
+
fill: color,
|
|
677
|
+
opacity: 0.15,
|
|
678
|
+
"clip-path": `url(#${clipId})`
|
|
679
|
+
});
|
|
680
|
+
headerGroup.appendChild(headerBar);
|
|
681
|
+
const chevron = isCollapsed ? "▶" : "▼";
|
|
682
|
+
const headerText = svgEl("text", {
|
|
683
|
+
x: sg.x + GUTTER_WIDTH + 8,
|
|
684
|
+
y: sg.y + SUBGRAPH_HEADER_HEIGHT / 2 + 4,
|
|
685
|
+
"font-size": SUBLABEL_FONT_SIZE,
|
|
686
|
+
fill: color,
|
|
687
|
+
"font-family": "var(--vscode-font-family, sans-serif)",
|
|
688
|
+
"font-weight": "600"
|
|
689
|
+
});
|
|
690
|
+
headerText.textContent = `${chevron} ${sg.label}`;
|
|
691
|
+
headerGroup.appendChild(headerText);
|
|
692
|
+
g.appendChild(headerGroup);
|
|
693
|
+
focusableElements.set(`sg:${sg.nodeId}`, headerGroup);
|
|
694
|
+
if (isCollapsed && sg.collapsedChildCount !== undefined) {
|
|
695
|
+
const badgeText = svgEl("text", {
|
|
696
|
+
x: sg.x + sg.width / 2,
|
|
697
|
+
y: sg.y + SUBGRAPH_HEADER_HEIGHT + SUBGRAPH_PADDING + 4,
|
|
698
|
+
"font-size": SUBLABEL_FONT_SIZE,
|
|
699
|
+
fill: "var(--vscode-descriptionForeground)",
|
|
700
|
+
"font-family": "var(--vscode-font-family, sans-serif)",
|
|
701
|
+
"font-style": "italic",
|
|
702
|
+
"text-anchor": "middle"
|
|
703
|
+
});
|
|
704
|
+
badgeText.textContent = `+${sg.collapsedChildCount} items`;
|
|
705
|
+
g.appendChild(badgeText);
|
|
706
|
+
}
|
|
707
|
+
svg.appendChild(g);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
function renderEdges(svg, edges) {
|
|
711
|
+
const strokeAttrs = {
|
|
712
|
+
fill: "none",
|
|
713
|
+
stroke: "var(--vscode-descriptionForeground)",
|
|
714
|
+
"stroke-width": EDGE_STROKE_WIDTH,
|
|
715
|
+
"stroke-linecap": "round"
|
|
716
|
+
};
|
|
717
|
+
const r = 6;
|
|
718
|
+
for (const edge of edges) {
|
|
719
|
+
const midY = (edge.fromY + edge.toY) / 2;
|
|
720
|
+
let d;
|
|
721
|
+
const isHorizontal = edge.fromY === edge.toY;
|
|
722
|
+
if (isHorizontal) {
|
|
723
|
+
d = `M ${edge.fromX} ${edge.fromY} L ${edge.toX} ${edge.toY}`;
|
|
724
|
+
} else if (edge.fromX === edge.toX) {
|
|
725
|
+
d = `M ${edge.fromX} ${edge.fromY} L ${edge.toX} ${edge.toY}`;
|
|
726
|
+
} else {
|
|
727
|
+
const dx = edge.toX - edge.fromX;
|
|
728
|
+
const signX = dx > 0 ? 1 : -1;
|
|
729
|
+
const absDx = Math.abs(dx);
|
|
730
|
+
const cr = Math.min(r, absDx / 2, (edge.toY - edge.fromY) / 4);
|
|
731
|
+
d =
|
|
732
|
+
`M ${edge.fromX} ${edge.fromY}` + ` L ${edge.fromX} ${midY - cr}` + ` Q ${edge.fromX} ${midY}, ${edge.fromX + signX * cr} ${midY}` + ` L ${edge.toX - signX * cr} ${midY}` + ` Q ${edge.toX} ${midY}, ${edge.toX} ${midY + cr}` + ` L ${edge.toX} ${edge.toY}`;
|
|
733
|
+
}
|
|
734
|
+
svg.appendChild(svgEl("path", {
|
|
735
|
+
...strokeAttrs,
|
|
736
|
+
d
|
|
737
|
+
}));
|
|
738
|
+
const a = 5;
|
|
739
|
+
let arrowD;
|
|
740
|
+
if (isHorizontal) {
|
|
741
|
+
const signX = edge.toX > edge.fromX ? 1 : -1;
|
|
742
|
+
arrowD = `M ${edge.toX - signX * a * 1.5} ${edge.toY - a} L ${edge.toX} ${edge.toY} L ${edge.toX - signX * a * 1.5} ${edge.toY + a}`;
|
|
743
|
+
} else {
|
|
744
|
+
arrowD = `M ${edge.toX - a} ${edge.toY - a * 1.5} L ${edge.toX} ${edge.toY} L ${edge.toX + a} ${edge.toY - a * 1.5}`;
|
|
745
|
+
}
|
|
746
|
+
svg.appendChild(svgEl("path", {
|
|
747
|
+
...strokeAttrs,
|
|
748
|
+
"stroke-linejoin": "round",
|
|
749
|
+
d: arrowD
|
|
750
|
+
}));
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
function renderNodes(svg, nodes, focusableElements) {
|
|
754
|
+
const fontFamily = "var(--vscode-font-family, sans-serif)";
|
|
755
|
+
const nodeFill = "var(--vscode-editor-background, var(--vscode-editorWidget-background))";
|
|
756
|
+
for (const node of nodes) {
|
|
757
|
+
const g = document.createElementNS(SVG_NS, "g");
|
|
758
|
+
g.classList.add("chat-debug-flowchart-node");
|
|
759
|
+
g.setAttribute("data-node-id", node.id);
|
|
760
|
+
g.setAttribute("tabindex", "0");
|
|
761
|
+
g.setAttribute("role", "img");
|
|
762
|
+
const ariaLabel = node.sublabel ? `${node.label}, ${node.sublabel}` : node.label;
|
|
763
|
+
g.setAttribute("aria-label", ariaLabel);
|
|
764
|
+
focusableElements.set(node.id, g);
|
|
765
|
+
if (node.tooltip) {
|
|
766
|
+
const title = document.createElementNS(SVG_NS, "title");
|
|
767
|
+
title.textContent = node.tooltip;
|
|
768
|
+
g.appendChild(title);
|
|
769
|
+
}
|
|
770
|
+
const color = getNodeColor(node.kind, node.isError);
|
|
771
|
+
const safeId = node.id.replace(/[^a-zA-Z0-9]/g, "_");
|
|
772
|
+
const rectAttrs = {
|
|
773
|
+
x: node.x,
|
|
774
|
+
y: node.y,
|
|
775
|
+
width: node.width,
|
|
776
|
+
height: node.height,
|
|
777
|
+
rx: NODE_BORDER_RADIUS,
|
|
778
|
+
ry: NODE_BORDER_RADIUS
|
|
779
|
+
};
|
|
780
|
+
const clipId = `clip-${safeId}`;
|
|
781
|
+
const clipPath = svgEl("clipPath", {
|
|
782
|
+
id: clipId
|
|
783
|
+
});
|
|
784
|
+
clipPath.appendChild(svgEl("rect", rectAttrs));
|
|
785
|
+
svg.appendChild(clipPath);
|
|
786
|
+
const focusOffset = 3;
|
|
787
|
+
g.appendChild(svgEl("rect", {
|
|
788
|
+
class: "chat-debug-flowchart-focus-ring",
|
|
789
|
+
x: node.x - focusOffset,
|
|
790
|
+
y: node.y - focusOffset,
|
|
791
|
+
width: node.width + focusOffset * 2,
|
|
792
|
+
height: node.height + focusOffset * 2,
|
|
793
|
+
rx: NODE_BORDER_RADIUS + focusOffset,
|
|
794
|
+
ry: NODE_BORDER_RADIUS + focusOffset,
|
|
795
|
+
fill: "none",
|
|
796
|
+
stroke: "var(--vscode-focusBorder)",
|
|
797
|
+
"stroke-width": 2
|
|
798
|
+
}));
|
|
799
|
+
g.appendChild(svgEl("rect", {
|
|
800
|
+
...rectAttrs,
|
|
801
|
+
fill: nodeFill,
|
|
802
|
+
stroke: color,
|
|
803
|
+
"stroke-width": node.isError ? 2 : 1.5
|
|
804
|
+
}));
|
|
805
|
+
g.appendChild(svgEl("rect", {
|
|
806
|
+
x: node.x,
|
|
807
|
+
y: node.y,
|
|
808
|
+
width: 4,
|
|
809
|
+
height: node.height,
|
|
810
|
+
fill: color,
|
|
811
|
+
"clip-path": `url(#${clipId})`
|
|
812
|
+
}));
|
|
813
|
+
const textX = node.x + NODE_PADDING_H;
|
|
814
|
+
const isMessage = isMessageKind(node.kind);
|
|
815
|
+
if (isMessage && node.sublabel) {
|
|
816
|
+
const header = svgEl("text", {
|
|
817
|
+
x: textX,
|
|
818
|
+
y: node.y + NODE_PADDING_V + SUBLABEL_FONT_SIZE,
|
|
819
|
+
"font-size": SUBLABEL_FONT_SIZE,
|
|
820
|
+
fill: "var(--vscode-descriptionForeground)",
|
|
821
|
+
"font-family": fontFamily,
|
|
822
|
+
"clip-path": `url(#${clipId})`
|
|
823
|
+
});
|
|
824
|
+
header.textContent = node.label;
|
|
825
|
+
g.appendChild(header);
|
|
826
|
+
const msg = svgEl("text", {
|
|
827
|
+
x: textX,
|
|
828
|
+
y: node.y + node.height - NODE_PADDING_V - 2,
|
|
829
|
+
"font-size": FONT_SIZE,
|
|
830
|
+
fill: "var(--vscode-foreground)",
|
|
831
|
+
"font-family": fontFamily,
|
|
832
|
+
"clip-path": `url(#${clipId})`
|
|
833
|
+
});
|
|
834
|
+
msg.textContent = node.sublabel;
|
|
835
|
+
g.appendChild(msg);
|
|
836
|
+
} else if (node.sublabel) {
|
|
837
|
+
const label = svgEl("text", {
|
|
838
|
+
x: textX,
|
|
839
|
+
y: node.y + NODE_PADDING_V + FONT_SIZE,
|
|
840
|
+
"font-size": FONT_SIZE,
|
|
841
|
+
fill: "var(--vscode-foreground)",
|
|
842
|
+
"font-family": fontFamily,
|
|
843
|
+
"clip-path": `url(#${clipId})`
|
|
844
|
+
});
|
|
845
|
+
label.textContent = node.label;
|
|
846
|
+
g.appendChild(label);
|
|
847
|
+
const sub = svgEl("text", {
|
|
848
|
+
x: textX,
|
|
849
|
+
y: node.y + node.height - NODE_PADDING_V,
|
|
850
|
+
"font-size": SUBLABEL_FONT_SIZE,
|
|
851
|
+
fill: "var(--vscode-descriptionForeground)",
|
|
852
|
+
"font-family": fontFamily,
|
|
853
|
+
"clip-path": `url(#${clipId})`
|
|
854
|
+
});
|
|
855
|
+
sub.textContent = node.sublabel;
|
|
856
|
+
g.appendChild(sub);
|
|
857
|
+
} else {
|
|
858
|
+
const label = svgEl("text", {
|
|
859
|
+
x: textX,
|
|
860
|
+
y: node.y + node.height / 2 + FONT_SIZE / 2 - 1,
|
|
861
|
+
"font-size": FONT_SIZE,
|
|
862
|
+
fill: "var(--vscode-foreground)",
|
|
863
|
+
"font-family": fontFamily,
|
|
864
|
+
"clip-path": `url(#${clipId})`
|
|
865
|
+
});
|
|
866
|
+
label.textContent = node.label;
|
|
867
|
+
g.appendChild(label);
|
|
868
|
+
}
|
|
869
|
+
if (node.mergedCount) {
|
|
870
|
+
g.setAttribute("data-is-toggle", "true");
|
|
871
|
+
renderMergedToggle(g, node, color, fontFamily);
|
|
872
|
+
}
|
|
873
|
+
svg.appendChild(g);
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
function renderMergedToggle(g, node, color, fontFamily) {
|
|
877
|
+
const toggleX = node.x + node.width - MERGED_TOGGLE_WIDTH;
|
|
878
|
+
const toggleGroup = document.createElementNS(SVG_NS, "g");
|
|
879
|
+
toggleGroup.classList.add("chat-debug-flowchart-merged-toggle");
|
|
880
|
+
toggleGroup.setAttribute("data-merged-id", node.id);
|
|
881
|
+
toggleGroup.appendChild(svgEl("line", {
|
|
882
|
+
x1: toggleX,
|
|
883
|
+
y1: node.y + 4,
|
|
884
|
+
x2: toggleX,
|
|
885
|
+
y2: node.y + node.height - 4,
|
|
886
|
+
stroke: "var(--vscode-descriptionForeground)",
|
|
887
|
+
"stroke-width": 0.5,
|
|
888
|
+
opacity: 0.4
|
|
889
|
+
}));
|
|
890
|
+
const chevronX = toggleX + MERGED_TOGGLE_WIDTH / 2;
|
|
891
|
+
const chevronY = node.y + node.height / 2;
|
|
892
|
+
const chevron = svgEl("text", {
|
|
893
|
+
x: chevronX,
|
|
894
|
+
y: chevronY + 4,
|
|
895
|
+
"font-size": 9,
|
|
896
|
+
fill: color,
|
|
897
|
+
"font-family": fontFamily,
|
|
898
|
+
"text-anchor": "middle",
|
|
899
|
+
cursor: "pointer"
|
|
900
|
+
});
|
|
901
|
+
chevron.textContent = node.isMergedExpanded ? "◀" : "▶";
|
|
902
|
+
toggleGroup.appendChild(chevron);
|
|
903
|
+
toggleGroup.appendChild(svgEl("rect", {
|
|
904
|
+
x: toggleX,
|
|
905
|
+
y: node.y,
|
|
906
|
+
width: MERGED_TOGGLE_WIDTH,
|
|
907
|
+
height: node.height,
|
|
908
|
+
fill: "transparent",
|
|
909
|
+
cursor: "pointer"
|
|
910
|
+
}));
|
|
911
|
+
g.appendChild(toggleGroup);
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
export { layoutFlowGraph, renderFlowChartSVG };
|