@codingame/monaco-vscode-chat-service-override 37.2.0 → 37.3.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/common.d.ts +9 -0
- package/common.js +372 -0
- package/index.d.ts +4 -6
- package/index.js +20 -377
- package/package.json +12 -5
- package/session.d.ts +8 -0
- package/session.js +56 -0
- package/vscode/src/vs/platform/agentHost/browser/agentHostConnectionsService.js +5 -2
- package/vscode/src/vs/platform/agentHost/browser/agentHostEnablementService.js +1 -1
- package/vscode/src/vs/platform/agentHost/browser/agentHostIpcChannelTransport.d.ts +1 -1
- package/vscode/src/vs/platform/agentHost/browser/agentHostIpcChannelTransport.js +2 -2
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.js +35 -11
- package/vscode/src/vs/platform/agentHost/browser/webSocketClientTransport.d.ts +1 -1
- package/vscode/src/vs/platform/agentHost/browser/webSocketClientTransport.js +2 -2
- package/vscode/src/vs/platform/agentHost/common/agentHostCustomizationConfig.js +34 -18
- package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemService.d.ts +1 -1
- package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemService.js +1 -1
- package/vscode/src/vs/platform/agentHost/common/agentHostStarter.config.contribution.js +54 -54
- package/vscode/src/vs/platform/agentHost/common/agentModelPricing.js +20 -23
- package/vscode/src/vs/platform/agentHost/common/copilotConfigSlashCommands.js +8 -8
- package/vscode/src/vs/platform/agentHost/common/meta/clientPluginCustomizationMeta.js +3 -1
- package/vscode/src/vs/platform/agentHost/common/otlp/otlpLogEmitter.d.ts +198 -0
- package/vscode/src/vs/platform/agentHost/common/otlp/otlpLogEmitter.js +197 -0
- package/vscode/src/vs/platform/agentHost/common/sandboxConfigSchema.js +14 -14
- package/vscode/src/vs/platform/agentHost/common/state/sessionWorkingDirectories.d.ts +1 -1
- package/vscode/src/vs/platform/agentHost/common/wslRemoteAgentHost.d.ts +63 -0
- package/vscode/src/vs/platform/agentHost/common/wslRemoteAgentHost.js +7 -0
- package/vscode/src/vs/platform/agentHost/common/wslRemoteAgentHost.service.d.ts +51 -0
- package/vscode/src/vs/platform/agentHost/common/wslRemoteAgentHost.service.js +6 -0
- package/vscode/src/vs/platform/networkFilter/common/networkFilterService.js +3 -3
- package/vscode/src/vs/platform/sandbox/common/terminalSandboxEngine.d.ts +1 -1
- package/vscode/src/vs/platform/sandbox/common/terminalSandboxEngine.js +6 -6
- package/vscode/src/vs/sessions/browser/parts/mobile/contributions/media/mobileMultiDiffView.css +215 -0
- package/vscode/src/vs/sessions/browser/parts/mobile/contributions/mobileDiffHelpers.d.ts +28 -0
- package/vscode/src/vs/sessions/browser/parts/mobile/contributions/mobileDiffHelpers.js +429 -0
- package/vscode/src/vs/sessions/browser/parts/mobile/contributions/mobileDiffView.d.ts +100 -0
- package/vscode/src/vs/sessions/browser/parts/mobile/contributions/mobileDiffView.js +675 -0
- package/vscode/src/vs/sessions/browser/parts/mobile/contributions/mobileMultiDiffView.d.ts +86 -0
- package/vscode/src/vs/sessions/browser/parts/mobile/contributions/mobileMultiDiffView.js +860 -0
- package/vscode/src/vs/sessions/browser/parts/mobile/contributions/mobileMultiDiffVirtualizer.d.ts +35 -0
- package/vscode/src/vs/sessions/browser/parts/mobile/contributions/mobileMultiDiffVirtualizer.js +67 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/agentHostDelegation.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/agentHostDelegation.js +41 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/aiCustomizationWorkspaceService.d.ts +85 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/aiCustomizationWorkspaceService.js +247 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/branchChatSessionAction.d.ts +16 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/branchChatSessionAction.js +71 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/btwSlashCommand.contribution.d.ts +15 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/btwSlashCommand.contribution.js +106 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/chat.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/chat.contribution.js +438 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/chatPetAchievements.d.ts +8 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/chatPetAchievements.js +25 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/customizationsDebugLog.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/customizationsDebugLog.contribution.js +173 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/media/runScriptAction.css +186 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/newSession.d.ts +9 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/newSessionFolderQuickPickAction.d.ts +12 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/newSessionFolderQuickPickAction.js +104 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/nullInlineChatSessionService.d.ts +15 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/nullInlineChatSessionService.js +23 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/openSessionLinkOpener.contribution.d.ts +51 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/openSessionLinkOpener.contribution.js +151 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/promptsService.d.ts +32 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/promptsService.js +85 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/registerDefaultSessionTaskRunners.d.ts +14 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/registerDefaultSessionTaskRunners.js +20 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/requestOriginProvider.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/requestOriginProvider.contribution.js +34 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/runScriptAction.d.ts +39 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/runScriptAction.js +828 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/runScriptCustomTaskWidget.d.ts +48 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/runScriptCustomTaskWidget.js +215 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionTurnChanges.d.ts +27 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionTurnChanges.js +237 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionsChatAccessibilityHelp.d.ts +10 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionsChatAccessibilityHelp.js +348 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionsOpenerParticipant.d.ts +6 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionsOpenerParticipant.js +35 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sideChatProvider.contribution.d.ts +45 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sideChatProvider.contribution.js +189 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/unifiedWorkspacePickerConfiguration.d.ts +3 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/unifiedWorkspacePickerConfiguration.js +17 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/voiceBridge.contribution.d.ts +14 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/voiceBridge.contribution.js +381 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/workbenchSessionTaskRunner.d.ts +23 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/workbenchSessionTaskRunner.js +48 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/worktreeCreatedTaskDispatcher.d.ts +40 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/worktreeCreatedTaskDispatcher.js +116 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostAgentPicker.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostAgentPicker.js +300 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostSettings.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostSettings.contribution.js +74 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostSettingsFileSystemProvider.d.ts +55 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostSettingsFileSystemProvider.js +103 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostSettingsShared.d.ts +50 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostSettingsShared.js +72 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentSessionSettings.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentSessionSettings.contribution.js +70 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentSessionSettingsFileSystemProvider.d.ts +69 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentSessionSettingsFileSystemProvider.js +151 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/openAgentHostStateFileAction.d.ts +17 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/openAgentHostStateFileAction.js +39 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/branchPicker.d.ts +31 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/branchPicker.js +150 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessions.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessions.contribution.js +42 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsActions.d.ts +19 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsActions.js +199 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsChangesets.d.ts +104 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsChangesets.js +301 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsProvider.d.ts +518 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/copilotChatSessionsProvider.js +3121 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/mobilePermissionPicker.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/mobilePermissionPicker.contribution.js +37 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/mobilePermissionPicker.d.ts +25 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/mobilePermissionPicker.js +97 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/modePicker.d.ts +74 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/modePicker.js +355 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/permissionPicker.d.ts +135 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/permissionPicker.js +521 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/sandboxPicker.d.ts +26 -0
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/sandboxPicker.js +86 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxAgentHost.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxAgentHost.contribution.js +14 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxAgentHostContribution.d.ts +166 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxAgentHostContribution.js +586 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxConnectionCustomization.d.ts +15 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxConnectionCustomization.js +47 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxReadOnlySessionHandler.d.ts +45 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxReadOnlySessionHandler.js +109 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxSessionsProvider.d.ts +49 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/cloudSandboxSessionsProvider.js +69 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/entryDrivenProviderContribution.d.ts +47 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/entryDrivenProviderContribution.js +109 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/hostFilter.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/hostFilter.contribution.js +72 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/hostFilterActionViewItem.d.ts +79 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/hostFilterActionViewItem.js +353 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/manageRemoteAgentHosts.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/manageRemoteAgentHosts.js +161 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/managedReconnectAgentHostContribution.d.ts +95 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/managedReconnectAgentHostContribution.js +172 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/media/hostFilter.css +259 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/media/hostPickerSheet.css +351 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/mobileHostFilterActionViewItem.d.ts +36 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/mobileHostFilterActionViewItem.js +236 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHost.contribution.d.ts +80 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHost.contribution.js +686 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostActions.d.ts +20 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostActions.js +1210 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostCustomizationHarness.d.ts +31 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostCustomizationHarness.js +136 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostLogForwarder.d.ts +103 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostLogForwarder.js +173 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostTerminal.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostTerminal.contribution.js +51 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/tunnelAgentHost.contribution.d.ts +74 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/tunnelAgentHost.contribution.js +438 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/webSocketAgentHost.contribution.d.ts +14 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/webSocketAgentHost.contribution.js +52 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/wslAgentHost.contribution.d.ts +44 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/wslAgentHost.contribution.js +171 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/mobile/mobileOverlayContribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/sessions/browser/mobile/mobileOverlayContribution.js +98 -0
- package/vscode/src/vs/sessions/services/agentHost/browser/agentHostCustomizationService.d.ts +24 -0
- package/vscode/src/vs/sessions/services/agentHost/browser/agentHostCustomizationService.js +142 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +22 -22
- package/vscode/src/vs/workbench/api/browser/mainThreadChatCodeMapper.js +2 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadChatContext.js +1 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadChatDebug.js +7 -7
- package/vscode/src/vs/workbench/api/browser/mainThreadChatInputNotification.js +3 -3
- package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.js +14 -14
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModelTools.js +2 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +9 -7
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoice.contribution.js +35 -35
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceSessionsPicker.js +4 -4
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.js +20 -20
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidgetBinding.js +7 -7
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWindowService.js +3 -3
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/confirmationComponent.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/confirmationComponent.js +3 -3
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/feedbackDialog.js +6 -6
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/headerComponent.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/headerComponent.js +11 -11
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/onboardingComponent.js +11 -11
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/sessionListComponent.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/sessionListComponent.js +9 -9
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/statusRowsComponent.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/statusRowsComponent.js +5 -5
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/transcriptComponent.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/voiceBarComponent.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/voiceBarComponent.js +2 -2
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscripts.contribution.js +14 -14
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscriptsView.js +7 -7
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/voiceModeOnboarding.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/voiceModeOnboarding.js +40 -40
- package/vscode/src/vs/workbench/contrib/agentsVoice/common/voiceTranscriptStore.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.js +27 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +97 -97
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.js +5 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFindActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatNewActions.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPluginActions.js +19 -19
- 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 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +20 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/createPluginAction.js +50 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/exportAgentHostDebugLogsAction.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/openAgentHostStateFileAction.js +9 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginCommands.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditor.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditorInput.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditorInput.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.js +21 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationContentExpander.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationContentExpander.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationItemProvider.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationItemProvider.js +8 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationSyncProvider.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHost.contribution.js +2 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostAuth.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatContribution.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostCopilotCliSettingsContribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostCustomizationService.js +431 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostExistingSessionHarnessPickerEnablement.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLanguageModelProvider.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLocalCustomizations.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLocalCustomizations.js +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpServerSupport.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpServerSupport.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostModeSynchronizer.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPermissionUiContribution.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPromptCacheNotification.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPromptCacheNotification.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostProtectedResourcesService.js +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostResponseFileChanges.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostResponseFileChanges.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostRootConfigForwarder.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.js +83 -74
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionInputPills.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionInputPills.js +48 -43
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListContribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListController.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListStore.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListStore.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionWorkingDirectorySynchronizer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionWorkingDirectorySynchronizer.js +9 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSettings.contribution.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSettingsFileSystemProvider.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostShellInitSynchronizer.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostShellInitSynchronizer.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSignedOutModelsNotification.js +10 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostTerminalContribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostUntitledProvisionalSessionService.js +12 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentSessionSettings.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentSessionSettingsFileSystemProvider.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentSessionSettingsFileSystemProvider.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/applyAgentHostSessionConfig.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/applyAgentHostSubmitConfig.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/openSessionLinkOpener.contribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/syncedCustomizationBundler.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.js +56 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjection.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.d.ts +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 +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionsExperiments.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.js +26 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccess.js +20 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccessActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentSessionsController.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/sessionSummaryHoverService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/sessionSummaryHoverService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessionsConfiguration.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.contribution.js +48 -48
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationAccessibility.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationServiceImpl.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationServiceImpl.js +26 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpServerCustomizationMigration.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpServerCustomizationMigration.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatReferenceAttachmentWidget.contribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/transcriptContextAttachmentWidget.contribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.shared.contribution.js +400 -426
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostChatDebugProvider.js +42 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostLogSources.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostUsageSidecar.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostUsageSidecar.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.js +36 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheExplorerView.js +136 -136
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheInsights.js +75 -75
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugDetailPanel.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEnablement.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventDetailRenderer.js +20 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventList.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFilters.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowChartView.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowGraph.js +26 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowLayout.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHomeView.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHookContentRenderer.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.js +27 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugMessageContentRenderer.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugModelTurnContentRenderer.js +23 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.js +35 -35
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugToolCallContentRenderer.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugTypes.js +32 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugWireLogView.js +42 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCheckpointTimelineImpl.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingDeletedFileEntry.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +19 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationModelManager.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +18 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.js +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/helpers.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatImageCarouselService.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +36 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievements.contribution.js +18 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievementsEditor.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievementsEditorInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievementsWidget.js +39 -39
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPromoNotification.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuotaNotification.js +27 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/chatRepoInfo.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionDescription.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.js +21 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupGrowthSession.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupGrowthSession.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.js +38 -38
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.js +60 -55
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommands.js +39 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipCatalog.js +19 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWindowNotifier.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/claudePluginRecommendations.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/contextContrib/chatContext.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/contextContrib/chatContextService.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/defaultModelContribution.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/enablementStatusWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/expNotification/chatExpNotificationConfig.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/expNotification/chatExpNotificationConfig.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/expNotification/chatExpNotificationContribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/githubRepoFetcher.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelsConfigurationService.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorOverlay.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackService.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginGitCommandService.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.js +32 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.js +22 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginUrlHandler.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptFileActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolSetsCodeLensProvider.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/skillActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptBucketing.js +5 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimeline.contribution.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineCard.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineGutterRail.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineModel.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineRulerRail.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineStickyHeader.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineWidgetContrib.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptsDebugContribution.js +36 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/telemetry/chatEditorTopologyTelemetry.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/clientToolSetsContribution.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsConfirmationService.js +46 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.js +34 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolResultCompressorService.js +68 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/utilityModelContribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceClientService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceClientService.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceInputMode/voiceInputMode.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownAnchorService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentOpenChat.js +25 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatFind/chatFindAccessibilityHelp.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatPetWidgetService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatPetWidgetService.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNoticeHub.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNoticeHub.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatQueuePickerActionItem.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletions.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCommandArgumentHint.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +99 -95
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorContrib.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorHover.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/editorHoverWrapper.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.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.js +19 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.js +28 -26
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceTelemetry.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatModelStore.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionOperationLog.js +5 -2
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionStore.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/common/model/objectMutationLog.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/participants/chatSlashCommands.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.js +21 -21
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/workspacePluginSettingsService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/workspacePluginSettingsService.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +20 -20
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +18 -12
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +157 -157
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/confirmationTool.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/manageTodoListTool.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/reviewPlanTool.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactRulesTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactsTool.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/tools.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/tools/chatArtifactsService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +26 -26
- package/vscode/src/vs/workbench/contrib/chat/common/tools/toolResultCompressor.js +5 -1
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatResponseResourceFileSystemProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/imageCarousel/browser/imageCarousel.contribution.js +13 -13
- package/vscode/src/vs/workbench/contrib/imageCarousel/browser/imageCarouselEditor.js +10 -10
- package/vscode/src/vs/workbench/contrib/imageCarousel/browser/imageCarouselEditorInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatAccessibilityHelp.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +16 -16
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatDefaultModel.js +3 -3
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditReviewSession.js +3 -3
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +5 -5
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +29 -25
- 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 +13 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +10 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/diff/inlineDiff/notebookModifiedCellDecorator.js +2 -2
- package/vscode/src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.js +7 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.js +22 -22
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +16 -16
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +21 -21
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.js +4 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/agentHostSandboxForwarder.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +15 -15
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.js +7 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +1 -1
- 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 +18 -18
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +9 -9
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/consoleCompactor/consoleCompactor.js +28 -25
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/killTerminalTool.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +5 -5
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +79 -79
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sendToTerminalTool.js +11 -11
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +16 -16
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +9 -9
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +16 -16
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandArtifactCollector.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandParser.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalOutputCache.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalOutputCache.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalOutputCompressor.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/sandboxSettingsReader.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.js +7 -7
- package/vscode/src/vs/workbench/services/agentEditorComments/browser/agentEditorCommentsOverlayWidget.js +4 -4
- package/vscode/src/vs/workbench/services/agentHost/browser/editorRemoteAgentHostServiceClient.d.ts +3 -3
- package/vscode/src/vs/workbench/services/agentHost/browser/editorRemoteAgentHostServiceClient.js +4 -4
- package/vscode/src/vs/workbench/services/agentHost/common/agentHostFileSystemService.d.ts +1 -1
- package/vscode/src/vs/workbench/services/agentHost/common/agentHostFileSystemService.js +1 -1
- package/vscode/src/vs/workbench/services/agentHost/common/agentHostResourceService.js +6 -6
- package/vscode/src/vs/workbench/services/agentHost/common/editorRemoteAgentHostTransport.js +25 -25
- package/vscode/src/vs/platform/agentHost/browser/agentHostProtocolClient.d.ts +0 -603
- package/vscode/src/vs/platform/agentHost/browser/agentHostProtocolClient.js +0 -1911
- package/vscode/src/vs/platform/agentHost/common/agentHostClientInfo.d.ts +0 -9
- package/vscode/src/vs/platform/agentHost/common/agentHostClientInfo.js +0 -20
- package/vscode/src/vs/platform/agentHost/common/agentHostExtensionProtocol.d.ts +0 -144
- package/vscode/src/vs/platform/agentHost/common/agentHostExtensionProtocol.js +0 -20
- package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemProvider.d.ts +0 -204
- package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemProvider.js +0 -440
- package/vscode/src/vs/platform/agentHost/common/agentHostManagedRules.d.ts +0 -47
- package/vscode/src/vs/platform/agentHost/common/agentHostManagedRules.js +0 -75
- package/vscode/src/vs/platform/agentHost/common/agentHostManagedSettings.d.ts +0 -68
- package/vscode/src/vs/platform/agentHost/common/agentHostManagedSettings.js +0 -161
- package/vscode/src/vs/platform/agentHost/common/agentHostWorkingDirectories.d.ts +0 -16
- package/vscode/src/vs/platform/agentHost/common/agentHostWorkingDirectories.js +0 -14
- package/vscode/src/vs/platform/agentHost/common/agentMerge.d.ts +0 -261
- package/vscode/src/vs/platform/agentHost/common/agentMerge.js +0 -67
- package/vscode/src/vs/platform/agentHost/common/ahpJsonlLogger.d.ts +0 -39
- package/vscode/src/vs/platform/agentHost/common/ahpJsonlLogger.js +0 -169
- package/vscode/src/vs/platform/agentHost/common/changesetUri.d.ts +0 -130
- package/vscode/src/vs/platform/agentHost/common/changesetUri.js +0 -41
- package/vscode/src/vs/platform/agentHost/common/customAgents.d.ts +0 -42
- package/vscode/src/vs/platform/agentHost/common/customAgents.js +0 -20
- package/vscode/src/vs/platform/agentHost/common/meta/agentCompletionAttachmentMeta.d.ts +0 -110
- package/vscode/src/vs/platform/agentHost/common/meta/agentCompletionAttachmentMeta.js +0 -79
- package/vscode/src/vs/platform/agentHost/common/meta/agentHostArtifactRemovalMeta.d.ts +0 -4
- package/vscode/src/vs/platform/agentHost/common/resourceReadLogging.d.ts +0 -1
- package/vscode/src/vs/platform/agentHost/common/resourceReadLogging.js +0 -26
- package/vscode/src/vs/platform/agentHost/common/sessionArtifacts.d.ts +0 -75
- package/vscode/src/vs/platform/agentHost/common/sessionArtifacts.js +0 -84
- package/vscode/src/vs/platform/agentHost/common/state/agentSubscription.d.ts +0 -461
- package/vscode/src/vs/platform/agentHost/common/state/agentSubscription.js +0 -803
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-annotations/reducer.d.ts +0 -18
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-annotations/reducer.js +0 -89
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-automation/reducer.d.ts +0 -4
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-automation/reducer.js +0 -37
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-automation-run/reducer.d.ts +0 -4
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-automation-run/reducer.js +0 -45
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-changeset/reducer.d.ts +0 -13
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-changeset/reducer.js +0 -147
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-chat/reducer.d.ts +0 -6
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-chat/reducer.js +0 -544
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-root/reducer.d.ts +0 -6
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-root/reducer.js +0 -30
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-session/reducer.d.ts +0 -6
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-session/reducer.js +0 -430
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-terminal/reducer.d.ts +0 -6
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-terminal/reducer.js +0 -114
- package/vscode/src/vs/platform/agentHost/common/state/protocol/common/reducer-helpers.d.ts +0 -17
- package/vscode/src/vs/platform/agentHost/common/state/protocol/common/reducer-helpers.js +0 -9
- package/vscode/src/vs/platform/agentHost/common/state/protocol/common/timestamps.d.ts +0 -1
- package/vscode/src/vs/platform/agentHost/common/state/protocol/common/timestamps.js +0 -7
- package/vscode/src/vs/platform/agentHost/common/state/protocol/version/registry.d.ts +0 -67
- package/vscode/src/vs/platform/agentHost/common/state/protocol/version/registry.js +0 -117
- package/vscode/src/vs/platform/agentHost/common/state/sessionActions.d.ts +0 -106
- package/vscode/src/vs/platform/agentHost/common/state/sessionActions.js +0 -23
- package/vscode/src/vs/platform/agentHost/common/transportConstants.d.ts +0 -15
- package/vscode/src/vs/platform/agentHost/common/transportConstants.js +0 -6
- package/vscode/src/vs/platform/agentHost/common/worktreePaths.d.ts +0 -24
- package/vscode/src/vs/platform/agentHost/common/worktreePaths.js +0 -15
- package/vscode/src/vs/platform/domWidget/browser/domWidget.d.ts +0 -52
- package/vscode/src/vs/platform/domWidget/browser/domWidget.js +0 -53
- package/vscode/src/vs/platform/networkFilter/common/domainMatcher.d.ts +0 -54
- package/vscode/src/vs/platform/networkFilter/common/domainMatcher.js +0 -210
- package/vscode/src/vs/platform/networkFilter/common/settings.d.ts +0 -8
- package/vscode/src/vs/platform/networkFilter/common/settings.js +0 -10
- package/vscode/src/vs/workbench/browser/chatChangesPill.d.ts +0 -29
- package/vscode/src/vs/workbench/browser/chatChangesPill.js +0 -84
- package/vscode/src/vs/workbench/common/chatPullRequest.d.ts +0 -19
- package/vscode/src/vs/workbench/common/chatPullRequest.js +0 -53
- package/vscode/src/vs/workbench/contrib/chat/browser/agentHostCompletionAction.d.ts +0 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/agentHostCompletionAction.js +0 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginItems.d.ts +0 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginItems.js +0 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostDownloadProgress.d.ts +0 -35
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostDownloadProgress.js +0 -73
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostToolSetEnablementService.d.ts +0 -51
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostToolSetEnablementService.js +0 -167
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/externalSessionsFilterMenu.d.ts +0 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/externalSessionsFilterMenu.js +0 -62
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/sessionSummaryHover.css +0 -104
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/sessionSummaryHover.d.ts +0 -115
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/sessionSummaryHover.js +0 -168
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.d.ts +0 -35
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.js +0 -294
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.d.ts +0 -66
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.js +0 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.d.ts +0 -147
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.js +0 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemsModel.d.ts +0 -83
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemsModel.js +0 -55
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.d.ts +0 -278
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.js +0 -2036
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidgetUtils.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidgetUtils.js +0 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.d.ts +0 -397
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.js +0 -4127
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditorInput.d.ts +0 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditorInput.js +0 -93
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementSectionRegistry.d.ts +0 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementSectionRegistry.js +0 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationPresentation.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationPresentation.js +0 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePage.d.ts +0 -57
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePage.js +0 -48
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePagePromptLaunchers.d.ts +0 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePagePromptLaunchers.js +0 -369
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCardList.d.ts +0 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCardList.js +0 -302
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCreatorService.d.ts +0 -70
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCreatorService.js +0 -74
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationGroupHeaderRenderer.d.ts +0 -43
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationGroupHeaderRenderer.js +0 -63
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigration.d.ts +0 -38
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigration.js +0 -240
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationCategories.d.ts +0 -82
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationCategories.js +0 -762
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationDashboard.d.ts +0 -80
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationDashboard.js +0 -279
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedAgentPluginDetail.d.ts +0 -109
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedAgentPluginDetail.js +0 -743
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedExtensionToolsDetail.d.ts +0 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedExtensionToolsDetail.js +0 -130
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedMcpServerDetail.d.ts +0 -62
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedMcpServerDetail.js +0 -217
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/galleryItemRenderer.d.ts +0 -46
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/galleryItemRenderer.js +0 -91
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.d.ts +0 -357
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.js +0 -2656
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationManagement.css +0 -3742
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationWelcomePromptLaunchers.css +0 -301
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/customizationMigrationDashboard.css +0 -354
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.d.ts +0 -197
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.js +0 -2205
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.d.ts +0 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.js +0 -317
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/toolsListWidget.d.ts +0 -132
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/toolsListWidget.js +0 -1216
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPills.d.ts +0 -86
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPills.js +0 -282
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.d.ts +0 -118
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.js +0 -540
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.d.ts +0 -82
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.js +0 -1448
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatModelsWidget.css +0 -329
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievementPreview.d.ts +0 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievementPreview.js +0 -114
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatus.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatus.js +0 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.d.ts +0 -99
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.js +0 -1268
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/media/chatStatus.css +0 -552
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.d.ts +0 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.js +0 -676
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.d.ts +0 -68
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.js +0 -225
- package/vscode/src/vs/workbench/contrib/chat/browser/sessionChatPillOptions.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/sessionChatPillOptions.js +0 -52
- package/vscode/src/vs/workbench/contrib/chat/browser/sessionPullRequestPill.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/sessionPullRequestPill.js +0 -58
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceInputUtils.d.ts +0 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceInputUtils.js +0 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletionsBase.d.ts +0 -73
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletionsBase.js +0 -65
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletionUtils.d.ts +0 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletionUtils.js +0 -110
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputPlaceholderDecoration.d.ts +0 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputPlaceholderDecoration.js +0 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputReferenceDecorations.d.ts +0 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputReferenceDecorations.js +0 -16
- package/vscode/src/vs/workbench/contrib/chat/common/automations/automationBlueprint.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/chat/common/automations/automationBlueprint.js +0 -163
- package/vscode/src/vs/workbench/contrib/chat/common/chatNotification.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatNotification.js +0 -12
- package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.d.ts +0 -300
- package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.js +0 -272
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.js +0 -178
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.d.ts +0 -78
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.js +0 -51
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/fileBackedInstalledPluginsStore.d.ts +0 -67
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/fileBackedInstalledPluginsStore.js +0 -195
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.d.ts +0 -67
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.js +0 -294
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.d.ts +0 -212
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.js +0 -955
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.d.ts +0 -31
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.js +0 -122
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.d.ts +0 -50
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.js +0 -78
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.d.ts +0 -77
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.js +0 -120
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.js +0 -23
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/customizationMigrationService.d.ts +0 -115
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/customizationMigrationService.js +0 -69
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/extensionPromptFileService.d.ts +0 -92
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/extensionPromptFileService.js +0 -335
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +0 -235
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +0 -1673
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +0 -202
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +0 -872
- package/vscode/src/vs/workbench/contrib/chat/common/sessionChatPills.d.ts +0 -60
- package/vscode/src/vs/workbench/contrib/chat/common/sessionChatPills.js +0 -139
|
@@ -0,0 +1,3121 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
4
|
+
import { raceTimeout, raceCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
5
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
6
|
+
import { CancellationError, isCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
7
|
+
import { markdownStringEqual, MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
8
|
+
import { Disposable, MutableDisposable, DisposableMap, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
9
|
+
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
10
|
+
import { isWeb } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
11
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
12
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
13
|
+
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
14
|
+
import { IDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
15
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
16
|
+
import { AgentSession } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agent';
|
|
17
|
+
import { getAgentSessionPullRequestUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsModel';
|
|
18
|
+
import { getRepositoryName } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer';
|
|
19
|
+
import { IAgentSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.service';
|
|
20
|
+
import { AgentSessionProviders } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessions';
|
|
21
|
+
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
|
|
22
|
+
import { ChatSessionStatus, SessionType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService';
|
|
23
|
+
import { IChatSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService.service';
|
|
24
|
+
import { assertAutomationSessionTemplate } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/automations/automation';
|
|
25
|
+
import { AutomationModelConfiguration } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/automations/browser/automationModelConfiguration';
|
|
26
|
+
import { SessionTypeAuthRequirement, ChatInteractivity, SessionStatus, toSessionId, sessionFileChangesEqual, GITHUB_REMOTE_FILE_SCHEME, sessionWorkspaceEqual, gitHubInfoEqual, SESSION_WORKSPACE_GROUP_GITHUB, SESSION_WORKSPACE_GROUP_LOCAL, ChatModelSource } from '@codingame/monaco-vscode-api/vscode/vs/sessions/services/sessions/common/session';
|
|
27
|
+
import { ChatPermissionLevel, isChatPermissionLevel, ChatConfiguration, ChatModeKind, ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
28
|
+
import { basename, isEqual, dirname } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
29
|
+
import { UNIFIED_WORKSPACE_PICKER_SETTING } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/chat/common/constants';
|
|
30
|
+
import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService.service';
|
|
31
|
+
import { ChatMode, isBuiltinChatMode } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModes';
|
|
32
|
+
import { IChatModeService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModes.service';
|
|
33
|
+
import { CancellationTokenSource, CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
34
|
+
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
35
|
+
import { ILanguageModelsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service';
|
|
36
|
+
import { resolveModelIdentifier, getRegisteredLanguageModels, resolveModelIdentifierFromLanguageModels } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/modelSelection';
|
|
37
|
+
import { IGitService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/git/common/gitService.service';
|
|
38
|
+
import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
39
|
+
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
40
|
+
import { ExtensionIdentifier } from '@codingame/monaco-vscode-api/vscode/vs/platform/extensions/common/extensions';
|
|
41
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
42
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
43
|
+
import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
|
|
44
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
45
|
+
import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
|
|
46
|
+
import { SessionConfigKey } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/sessionConfigKeys';
|
|
47
|
+
import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
48
|
+
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
49
|
+
import { IGitHubService } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/github/browser/githubService.service';
|
|
50
|
+
import { GitHubPullRequestState } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/github/common/types';
|
|
51
|
+
import { computePullRequestRefPresentation } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/github/browser/pullRequestIconStatus';
|
|
52
|
+
import { IPullRequestIconCache } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/github/browser/pullRequestIconCache.service';
|
|
53
|
+
import { structuralEquals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/equals';
|
|
54
|
+
import { CopilotCLISessionType } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider';
|
|
55
|
+
import { createChangesets } from './copilotChatSessionsChangesets.js';
|
|
56
|
+
import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
57
|
+
import { IAgentHostEnablementService } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostEnablementService.service';
|
|
58
|
+
import { isCloudSandboxEnabled } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/cloudSandboxAgentHost';
|
|
59
|
+
import { getWorkbenchContribution } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions';
|
|
60
|
+
import { CloudSandboxAgentHostContribution } from '../../remoteAgentHost/browser/cloudSandboxAgentHostContribution.js';
|
|
61
|
+
import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
|
|
62
|
+
import { resolveGitRepositoryFromGitConfig } from '@codingame/monaco-vscode-api/vscode/vs/sessions/services/sessions/browser/gitHubRepositoryResolver';
|
|
63
|
+
import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service';
|
|
64
|
+
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
|
|
65
|
+
import { constObservable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/constObservable';
|
|
66
|
+
import { observableValueOpts } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValueOpts';
|
|
67
|
+
import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
68
|
+
import { derived, derivedOpts } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/derived';
|
|
69
|
+
import { transaction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/transaction';
|
|
70
|
+
import { computePullRequestIcon } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/chatPullRequest';
|
|
71
|
+
import { observableFromPromise } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils/utils';
|
|
72
|
+
import { runOnChange } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils/runOnChange';
|
|
73
|
+
import { observableSignal } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableSignal';
|
|
74
|
+
|
|
75
|
+
var CopilotCLISession_1, CopilotChatSessionsProvider_1;
|
|
76
|
+
const CopilotCloudSessionType = {
|
|
77
|
+
id: "copilot-cloud-agent",
|
|
78
|
+
label: ( localize(4214, "Cloud")),
|
|
79
|
+
icon: Codicon.cloud,
|
|
80
|
+
authRequirement: SessionTypeAuthRequirement.GitHub
|
|
81
|
+
};
|
|
82
|
+
const STORAGE_KEY_ISOLATION_MODE = "sessions.isolationPicker.selectedMode";
|
|
83
|
+
const STORAGE_KEY_USE_SANDBOX = "sessions.cloudSandboxPicker.useSandbox";
|
|
84
|
+
function getGitHubRepositoryId(repository) {
|
|
85
|
+
const match = /^(?:(?:https?|ssh|git):\/\/(?:git@)?github\.com\/|git@github\.com:)?(?<owner>[^/:\s]+)\/(?<repo>[^/\s]+?)(?:\.git)?\/?$/i.exec(repository);
|
|
86
|
+
return match?.groups ? `${match.groups.owner}/${match.groups.repo}` : undefined;
|
|
87
|
+
}
|
|
88
|
+
const OPEN_REPO_COMMAND = "github.copilot.chat.cloudSessions.openRepository";
|
|
89
|
+
const OPEN_ISSUE_COMMAND = "github.copilot.chat.cloudSessions.openIssue";
|
|
90
|
+
const OPEN_PULL_REQUEST_COMMAND = "github.copilot.chat.cloudSessions.openPullRequest";
|
|
91
|
+
const COPILOT_PROVIDER_ID = "default-copilot";
|
|
92
|
+
const COPILOT_MULTI_CHAT_SETTING = "sessions.github.copilot.multiChatSessions";
|
|
93
|
+
const REPOSITORY_OPTION_ID = "repository";
|
|
94
|
+
const PARENT_SESSION_OPTION_ID = "parentSessionId";
|
|
95
|
+
const BRANCH_OPTION_ID = "branch";
|
|
96
|
+
const ISOLATION_OPTION_ID = "isolation";
|
|
97
|
+
const AGENT_OPTION_ID = "agent";
|
|
98
|
+
function isNewSession(session) {
|
|
99
|
+
return session instanceof CopilotCLISession || session instanceof RemoteNewSession;
|
|
100
|
+
}
|
|
101
|
+
function isChangesSummary(changes) {
|
|
102
|
+
return !!changes && !Array.isArray(changes);
|
|
103
|
+
}
|
|
104
|
+
function buildChatFromSession(chat) {
|
|
105
|
+
return {
|
|
106
|
+
resource: chat.resource,
|
|
107
|
+
createdAt: chat.createdAt,
|
|
108
|
+
title: chat.title,
|
|
109
|
+
updatedAt: chat.updatedAt,
|
|
110
|
+
status: chat.status,
|
|
111
|
+
changes: chat.changes,
|
|
112
|
+
checkpoints: chat.checkpoints,
|
|
113
|
+
modelId: chat.modelId,
|
|
114
|
+
modelSource: chat.modelSource,
|
|
115
|
+
mode: chat.mode,
|
|
116
|
+
isArchived: chat.isArchived,
|
|
117
|
+
isRead: chat.isRead,
|
|
118
|
+
interactivity: constObservable(ChatInteractivity.Full),
|
|
119
|
+
description: chat.description,
|
|
120
|
+
lastTurnEnd: chat.lastTurnEnd
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function setIfChanged(observable, value, tx, equals = Object.is) {
|
|
124
|
+
if (equals(observable.get(), value)) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
observable.set(value, tx, undefined);
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
function dateEquals(a, b) {
|
|
131
|
+
return a?.getTime() === b?.getTime();
|
|
132
|
+
}
|
|
133
|
+
function markdownStringEquals(a, b) {
|
|
134
|
+
return a === b || !!a && !!b && markdownStringEqual(a, b);
|
|
135
|
+
}
|
|
136
|
+
let CopilotCLISession = class CopilotCLISession extends Disposable {
|
|
137
|
+
static {
|
|
138
|
+
CopilotCLISession_1 = this;
|
|
139
|
+
}
|
|
140
|
+
static {
|
|
141
|
+
this.COPILOT_WORKTREE_PATTERN = "copilot-worktree-";
|
|
142
|
+
}
|
|
143
|
+
get selectedModelId() {
|
|
144
|
+
return this._modelId;
|
|
145
|
+
}
|
|
146
|
+
get chatMode() {
|
|
147
|
+
return this._mode;
|
|
148
|
+
}
|
|
149
|
+
get query() {
|
|
150
|
+
return this._query;
|
|
151
|
+
}
|
|
152
|
+
get attachedContext() {
|
|
153
|
+
return this._attachedContext;
|
|
154
|
+
}
|
|
155
|
+
get cancellationToken() {
|
|
156
|
+
return this._lifetimeCts.token;
|
|
157
|
+
}
|
|
158
|
+
get gitRepository() {
|
|
159
|
+
return this._gitRepository;
|
|
160
|
+
}
|
|
161
|
+
get disabled() {
|
|
162
|
+
if (!this._repoUri) {
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
if (this._isolationMode === "worktree" && !this._branch) {
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
constructor(
|
|
171
|
+
resource,
|
|
172
|
+
sessionWorkspace,
|
|
173
|
+
providerId,
|
|
174
|
+
initialAutomationSessionConfiguration,
|
|
175
|
+
chatSessionsService,
|
|
176
|
+
gitService,
|
|
177
|
+
gitHubService,
|
|
178
|
+
pullRequestIconCache,
|
|
179
|
+
storageService,
|
|
180
|
+
configurationService,
|
|
181
|
+
languageModelsService
|
|
182
|
+
) {
|
|
183
|
+
super();
|
|
184
|
+
this.resource = resource;
|
|
185
|
+
this.sessionWorkspace = sessionWorkspace;
|
|
186
|
+
this.initialAutomationSessionConfiguration = initialAutomationSessionConfiguration;
|
|
187
|
+
this.chatSessionsService = chatSessionsService;
|
|
188
|
+
this.gitService = gitService;
|
|
189
|
+
this.gitHubService = gitHubService;
|
|
190
|
+
this.pullRequestIconCache = pullRequestIconCache;
|
|
191
|
+
this.storageService = storageService;
|
|
192
|
+
this.configurationService = configurationService;
|
|
193
|
+
this._title = observableValue(this, "");
|
|
194
|
+
this.title = this._title;
|
|
195
|
+
this._updatedAt = observableValue(this, ( new Date()));
|
|
196
|
+
this.updatedAt = this._updatedAt;
|
|
197
|
+
this._status = observableValue(this, SessionStatus.Untitled);
|
|
198
|
+
this.status = this._status;
|
|
199
|
+
this._permissionLevel = observableValue(this, ChatPermissionLevel.Default);
|
|
200
|
+
this.permissionLevel = this._permissionLevel;
|
|
201
|
+
this._workspaceData = observableValue(this, undefined);
|
|
202
|
+
this.workspace = this._workspaceData;
|
|
203
|
+
this._branchObservable = observableValue(this, undefined);
|
|
204
|
+
this.branch = this._branchObservable;
|
|
205
|
+
this._isolationModeObservable = observableValue(this, "worktree");
|
|
206
|
+
this.isolationMode = this._isolationModeObservable;
|
|
207
|
+
this.useSandbox = constObservable(undefined);
|
|
208
|
+
this._modelIdObservable = observableValue(this, undefined);
|
|
209
|
+
this.modelId = this._modelIdObservable;
|
|
210
|
+
this._modelSourceObservable = observableValue(this, undefined);
|
|
211
|
+
this.modelSource = this._modelSourceObservable;
|
|
212
|
+
this._modeObservable = observableValue(this, undefined);
|
|
213
|
+
this.mode = this._modeObservable;
|
|
214
|
+
this._loading = observableValue(this, true);
|
|
215
|
+
this.loading = this._loading;
|
|
216
|
+
this._hasGitRepository = observableValue(this, false);
|
|
217
|
+
this.hasGitRepository = this._hasGitRepository;
|
|
218
|
+
this._isArchived = observableValue(this, false);
|
|
219
|
+
this.isArchived = this._isArchived;
|
|
220
|
+
this.isRead = observableValue(this, true);
|
|
221
|
+
this.lastTurnEnd = observableValue(this, undefined);
|
|
222
|
+
this.gitHubInfo = observableValue(this, undefined);
|
|
223
|
+
this._loadBranchesCts = this._register(( new MutableDisposable()));
|
|
224
|
+
this._branches = observableValue(this, []);
|
|
225
|
+
this.branches = this._branches;
|
|
226
|
+
this._lifetimeCts = this._register(( new CancellationTokenSource()));
|
|
227
|
+
this.target = AgentSessionProviders.Background;
|
|
228
|
+
this.selectedOptions = ( new Map());
|
|
229
|
+
this.modelConfiguration = this._register(( new AutomationModelConfiguration(
|
|
230
|
+
languageModelsService,
|
|
231
|
+
initialAutomationSessionConfiguration?.sessionTemplate
|
|
232
|
+
)));
|
|
233
|
+
this.sessionId = toSessionId(providerId, resource);
|
|
234
|
+
this.providerId = providerId;
|
|
235
|
+
this.sessionType = AgentSessionProviders.Background;
|
|
236
|
+
this.icon = CopilotCLISessionType.icon;
|
|
237
|
+
this.createdAt = ( new Date());
|
|
238
|
+
const repoUri = sessionWorkspace.folders[0]?.root;
|
|
239
|
+
if (repoUri) {
|
|
240
|
+
this._repoUri = repoUri;
|
|
241
|
+
this.setOption(REPOSITORY_OPTION_ID, repoUri.fsPath);
|
|
242
|
+
}
|
|
243
|
+
this._workspaceData.set(sessionWorkspace, undefined);
|
|
244
|
+
const storedMode = storageService.get(STORAGE_KEY_ISOLATION_MODE, StorageScope.PROFILE);
|
|
245
|
+
const initialMode = storedMode === "workspace" ? "workspace" : "worktree";
|
|
246
|
+
this._isolationMode = initialMode;
|
|
247
|
+
this._isolationModeObservable.set(initialMode, undefined);
|
|
248
|
+
this.setOption(ISOLATION_OPTION_ID, initialMode);
|
|
249
|
+
this._resolveGitRepository();
|
|
250
|
+
this._description = observableValue(this, undefined);
|
|
251
|
+
this.description = this._description;
|
|
252
|
+
this._changes = observableValueOpts({
|
|
253
|
+
owner: this,
|
|
254
|
+
equalsFn: sessionFileChangesEqual
|
|
255
|
+
}, []);
|
|
256
|
+
this.changes = this._changes;
|
|
257
|
+
this._checkpoints = observableValueOpts({
|
|
258
|
+
owner: this,
|
|
259
|
+
equalsFn: structuralEquals
|
|
260
|
+
}, undefined);
|
|
261
|
+
this.checkpoints = this._checkpoints;
|
|
262
|
+
this.mainChat = observableValue(this, buildChatFromSession(this));
|
|
263
|
+
}
|
|
264
|
+
async _resolveGitRepository() {
|
|
265
|
+
const repoUri = this.sessionWorkspace.folders[0]?.root;
|
|
266
|
+
if (repoUri) {
|
|
267
|
+
try {
|
|
268
|
+
this._gitRepository = await this.gitService.openRepository(repoUri);
|
|
269
|
+
if (!this._gitRepository) {
|
|
270
|
+
this.setIsolationMode("workspace");
|
|
271
|
+
} else if (!this._gitRepository.state.get().HEAD?.commit) {
|
|
272
|
+
this.setIsolationMode("workspace");
|
|
273
|
+
}
|
|
274
|
+
} catch {
|
|
275
|
+
this.setIsolationMode("workspace");
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
const gitRepository = this._gitRepository;
|
|
279
|
+
if (gitRepository) {
|
|
280
|
+
this._register(autorun(reader => {
|
|
281
|
+
this._hasGitRepository.set(!!gitRepository.state.read(reader).HEAD?.commit, undefined);
|
|
282
|
+
}));
|
|
283
|
+
this._loadBranches(gitRepository);
|
|
284
|
+
const currentBranchName = derived(reader => {
|
|
285
|
+
const state = gitRepository.state.read(reader);
|
|
286
|
+
return state?.HEAD?.commit ? state.HEAD.name : undefined;
|
|
287
|
+
});
|
|
288
|
+
this._register(autorun(reader => {
|
|
289
|
+
const isolationMode = this.isolationMode.read(reader);
|
|
290
|
+
if (isolationMode === "worktree") {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
const currentBranch = currentBranchName.read(reader);
|
|
294
|
+
this.setBranch(currentBranch ?? this._defaultBranch);
|
|
295
|
+
}));
|
|
296
|
+
}
|
|
297
|
+
this._loading.set(false, undefined);
|
|
298
|
+
}
|
|
299
|
+
_loadBranches(repo) {
|
|
300
|
+
this._loadBranchesCts.value?.cancel();
|
|
301
|
+
const cts = this._loadBranchesCts.value = ( new CancellationTokenSource());
|
|
302
|
+
repo.getRefs({
|
|
303
|
+
pattern: "refs/heads"
|
|
304
|
+
}, cts.token).then(refs => {
|
|
305
|
+
if (cts.token.isCancellationRequested) {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
const hasHeadCommit = !!repo.state.get().HEAD?.commit;
|
|
309
|
+
const branches = refs.map(r => r.name).filter(name => !!name).filter(name => !name.includes(CopilotCLISession_1.COPILOT_WORKTREE_PATTERN));
|
|
310
|
+
const defaultBranch = hasHeadCommit ? (branches.find(b => b === "main") ?? branches.find(b => b === "master") ?? branches.find(b => b === repo.state.get().HEAD?.name) ?? branches[0]) : undefined;
|
|
311
|
+
this._defaultBranch = defaultBranch;
|
|
312
|
+
transaction(tx => {
|
|
313
|
+
this._branches.set(branches, tx);
|
|
314
|
+
});
|
|
315
|
+
if (defaultBranch && !this._branch) {
|
|
316
|
+
this.setBranch(defaultBranch);
|
|
317
|
+
}
|
|
318
|
+
}).catch(() => {
|
|
319
|
+
if (!cts.token.isCancellationRequested) {
|
|
320
|
+
transaction(tx => {
|
|
321
|
+
this._branches.set([], tx);
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
setIsolationMode(mode) {
|
|
327
|
+
if (this._isolationMode !== mode) {
|
|
328
|
+
this._isolationMode = mode;
|
|
329
|
+
this._isolationModeObservable.set(mode, undefined);
|
|
330
|
+
this.setOption(ISOLATION_OPTION_ID, mode);
|
|
331
|
+
this.storageService.store(
|
|
332
|
+
STORAGE_KEY_ISOLATION_MODE,
|
|
333
|
+
mode,
|
|
334
|
+
StorageScope.PROFILE,
|
|
335
|
+
StorageTarget.MACHINE
|
|
336
|
+
);
|
|
337
|
+
if (mode === "workspace") {
|
|
338
|
+
const head = this._gitRepository?.state.get().HEAD;
|
|
339
|
+
const currentBranch = head?.commit ? head.name : undefined;
|
|
340
|
+
this.setBranch(currentBranch ?? this._defaultBranch);
|
|
341
|
+
} else {
|
|
342
|
+
this.setBranch(this._defaultBranch);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
setBranch(branch) {
|
|
347
|
+
if (this._branch !== branch) {
|
|
348
|
+
this._branch = branch;
|
|
349
|
+
this._branchObservable.set(branch, undefined);
|
|
350
|
+
this.setOption(BRANCH_OPTION_ID, branch ?? "");
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
setUseSandbox(_useSandbox) {}
|
|
354
|
+
setModelId(modelId, source) {
|
|
355
|
+
this._modelId = modelId;
|
|
356
|
+
transaction(tx => {
|
|
357
|
+
this._modelSourceObservable.set(modelId ? source : undefined, tx);
|
|
358
|
+
this._modelIdObservable.set(modelId, tx);
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
setModeById(modeId, modeKind) {
|
|
362
|
+
this._mode = undefined;
|
|
363
|
+
this._modeObservable.set({
|
|
364
|
+
id: modeId,
|
|
365
|
+
kind: modeKind
|
|
366
|
+
}, undefined);
|
|
367
|
+
}
|
|
368
|
+
setPermissionLevel(level) {
|
|
369
|
+
this._permissionLevel.set(level, undefined);
|
|
370
|
+
}
|
|
371
|
+
setTitle(title) {
|
|
372
|
+
this._title.set(title, undefined);
|
|
373
|
+
}
|
|
374
|
+
setStatus(status) {
|
|
375
|
+
this._status.set(status, undefined);
|
|
376
|
+
}
|
|
377
|
+
setArchived(archived) {
|
|
378
|
+
this._isArchived.set(archived, undefined);
|
|
379
|
+
}
|
|
380
|
+
setMode(mode) {
|
|
381
|
+
if (this._mode !== mode || this._modeObservable.get()?.id !== mode?.id) {
|
|
382
|
+
this._mode = mode;
|
|
383
|
+
this._modeObservable.set(mode ? {
|
|
384
|
+
id: mode.id,
|
|
385
|
+
kind: mode.kind
|
|
386
|
+
} : undefined, undefined);
|
|
387
|
+
const modeName = mode?.isBuiltin ? undefined : mode?.name.get();
|
|
388
|
+
this.setOption(AGENT_OPTION_ID, modeName ?? "");
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
getAgentHostSessionConfig() {
|
|
392
|
+
const config = {
|
|
393
|
+
[SessionConfigKey.Isolation]: this._isolationMode === "worktree" ? "worktree" : "folder"
|
|
394
|
+
};
|
|
395
|
+
if (this._isolationMode === "worktree" && this._branch) {
|
|
396
|
+
config[SessionConfigKey.Branch] = this._branch;
|
|
397
|
+
const branchPrefix = this.configurationService.getValue("git.branchPrefix", {
|
|
398
|
+
resource: this._repoUri
|
|
399
|
+
});
|
|
400
|
+
if (typeof branchPrefix === "string" && branchPrefix.length > 0) {
|
|
401
|
+
config[SessionConfigKey.WorktreeBranchPrefix] = branchPrefix;
|
|
402
|
+
}
|
|
403
|
+
const worktreeIncludeFiles = this.configurationService.getValue("git.worktreeIncludeFiles", {
|
|
404
|
+
resource: this._repoUri
|
|
405
|
+
});
|
|
406
|
+
if (Array.isArray(worktreeIncludeFiles) && worktreeIncludeFiles.length > 0) {
|
|
407
|
+
config[SessionConfigKey.WorktreeIncludeFiles] = worktreeIncludeFiles;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
return config;
|
|
411
|
+
}
|
|
412
|
+
setOption(optionId, value) {
|
|
413
|
+
if (typeof value === "string") {
|
|
414
|
+
this.selectedOptions.set(optionId, {
|
|
415
|
+
id: value,
|
|
416
|
+
name: value
|
|
417
|
+
});
|
|
418
|
+
} else {
|
|
419
|
+
this.selectedOptions.set(optionId, value);
|
|
420
|
+
}
|
|
421
|
+
this.chatSessionsService.setSessionOption(this.resource, optionId, value);
|
|
422
|
+
}
|
|
423
|
+
update(agentSession) {
|
|
424
|
+
transaction(tx => {
|
|
425
|
+
const session = ( new AgentSessionAdapter(
|
|
426
|
+
agentSession,
|
|
427
|
+
this.providerId,
|
|
428
|
+
this.gitHubService,
|
|
429
|
+
this.pullRequestIconCache
|
|
430
|
+
));
|
|
431
|
+
this._workspaceData.set(session.workspace.get(), tx);
|
|
432
|
+
this._title.set(session.title.get(), tx);
|
|
433
|
+
this._status.set(session.status.get(), tx);
|
|
434
|
+
this._updatedAt.set(session.updatedAt.get(), tx);
|
|
435
|
+
this._changes.set(session.changes.get(), tx);
|
|
436
|
+
this._checkpoints.set(session.checkpoints.get(), tx);
|
|
437
|
+
this._description.set(session.description.get(), tx);
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
dispose() {
|
|
441
|
+
this._lifetimeCts.cancel();
|
|
442
|
+
super.dispose();
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
CopilotCLISession = CopilotCLISession_1 = ( __decorate([( __param(4, IChatSessionsService)), ( __param(5, IGitService)), ( __param(6, IGitHubService)), ( __param(7, IPullRequestIconCache)), ( __param(8, IStorageService)), ( __param(9, IConfigurationService)), ( __param(10, ILanguageModelsService))], CopilotCLISession));
|
|
446
|
+
function isModelOptionGroup(group) {
|
|
447
|
+
if (group.id === "models") {
|
|
448
|
+
return true;
|
|
449
|
+
}
|
|
450
|
+
const nameLower = group.name.toLowerCase();
|
|
451
|
+
return nameLower === "model" || nameLower === "models";
|
|
452
|
+
}
|
|
453
|
+
function isRepositoriesOptionGroup(group) {
|
|
454
|
+
return group.id === "repositories";
|
|
455
|
+
}
|
|
456
|
+
let RemoteNewSession = class RemoteNewSession extends Disposable {
|
|
457
|
+
get project() {
|
|
458
|
+
return this._project;
|
|
459
|
+
}
|
|
460
|
+
get selectedModelId() {
|
|
461
|
+
return this._modelId;
|
|
462
|
+
}
|
|
463
|
+
get repoNwo() {
|
|
464
|
+
return this._repoUri ? githubRemoteRepoLabel(this._repoUri) : undefined;
|
|
465
|
+
}
|
|
466
|
+
get chatMode() {
|
|
467
|
+
return undefined;
|
|
468
|
+
}
|
|
469
|
+
get query() {
|
|
470
|
+
return this._query;
|
|
471
|
+
}
|
|
472
|
+
get attachedContext() {
|
|
473
|
+
return this._attachedContext;
|
|
474
|
+
}
|
|
475
|
+
get disabled() {
|
|
476
|
+
return !this._repoUri && !( this.selectedOptions.has("repositories"));
|
|
477
|
+
}
|
|
478
|
+
constructor(
|
|
479
|
+
resource,
|
|
480
|
+
sessionWorkspace,
|
|
481
|
+
target,
|
|
482
|
+
providerId,
|
|
483
|
+
initialAutomationSessionConfiguration,
|
|
484
|
+
chatSessionsService,
|
|
485
|
+
contextKeyService,
|
|
486
|
+
storageService,
|
|
487
|
+
languageModelsService
|
|
488
|
+
) {
|
|
489
|
+
super();
|
|
490
|
+
this.resource = resource;
|
|
491
|
+
this.sessionWorkspace = sessionWorkspace;
|
|
492
|
+
this.target = target;
|
|
493
|
+
this.initialAutomationSessionConfiguration = initialAutomationSessionConfiguration;
|
|
494
|
+
this.chatSessionsService = chatSessionsService;
|
|
495
|
+
this.contextKeyService = contextKeyService;
|
|
496
|
+
this.storageService = storageService;
|
|
497
|
+
this._title = observableValue(this, "");
|
|
498
|
+
this.title = this._title;
|
|
499
|
+
this._updatedAt = observableValue(this, ( new Date()));
|
|
500
|
+
this.updatedAt = this._updatedAt;
|
|
501
|
+
this._status = observableValue(this, SessionStatus.Untitled);
|
|
502
|
+
this.status = this._status;
|
|
503
|
+
this._permissionLevel = observableValue(this, ChatPermissionLevel.Default);
|
|
504
|
+
this.permissionLevel = this._permissionLevel;
|
|
505
|
+
this._workspaceData = observableValue(this, undefined);
|
|
506
|
+
this.workspace = this._workspaceData;
|
|
507
|
+
this.changes = observableValueOpts({
|
|
508
|
+
owner: this,
|
|
509
|
+
equalsFn: sessionFileChangesEqual
|
|
510
|
+
}, []);
|
|
511
|
+
this.checkpoints = constObservable(undefined);
|
|
512
|
+
this._modelIdObservable = observableValue(this, undefined);
|
|
513
|
+
this.modelId = this._modelIdObservable;
|
|
514
|
+
this._modelSourceObservable = observableValue(this, undefined);
|
|
515
|
+
this.modelSource = this._modelSourceObservable;
|
|
516
|
+
this.mode = observableValue(this, undefined);
|
|
517
|
+
this.loading = observableValue(this, false);
|
|
518
|
+
this._isArchived = observableValue(this, false);
|
|
519
|
+
this.isArchived = this._isArchived;
|
|
520
|
+
this.isRead = observableValue(this, true);
|
|
521
|
+
this.description = constObservable(undefined);
|
|
522
|
+
this.lastTurnEnd = constObservable(undefined);
|
|
523
|
+
this.gitHubInfo = constObservable(undefined);
|
|
524
|
+
this.branch = constObservable(undefined);
|
|
525
|
+
this.isolationMode = constObservable(undefined);
|
|
526
|
+
this._useSandbox = observableValue(this, false);
|
|
527
|
+
this.useSandbox = this._useSandbox;
|
|
528
|
+
this.branches = constObservable([]);
|
|
529
|
+
this._hasGitRepo = observableValue(this, false);
|
|
530
|
+
this.hasGitRepo = this._hasGitRepo;
|
|
531
|
+
this._onDidChangeOptionGroups = this._register(( new Emitter()));
|
|
532
|
+
this.onDidChangeOptionGroups = this._onDidChangeOptionGroups.event;
|
|
533
|
+
this.selectedOptions = ( new Map());
|
|
534
|
+
this._whenClauseKeys = ( new Set());
|
|
535
|
+
this.modelConfiguration = this._register(( new AutomationModelConfiguration(
|
|
536
|
+
languageModelsService,
|
|
537
|
+
initialAutomationSessionConfiguration?.sessionTemplate
|
|
538
|
+
)));
|
|
539
|
+
this.sessionId = toSessionId(providerId, resource);
|
|
540
|
+
this.providerId = providerId;
|
|
541
|
+
this.sessionType = target;
|
|
542
|
+
this.icon = CopilotCloudSessionType.icon;
|
|
543
|
+
this.createdAt = ( new Date());
|
|
544
|
+
this._useSandbox.set(
|
|
545
|
+
storageService.getBoolean(STORAGE_KEY_USE_SANDBOX, StorageScope.PROFILE, false),
|
|
546
|
+
undefined
|
|
547
|
+
);
|
|
548
|
+
this._updateWhenClauseKeys();
|
|
549
|
+
this._register(this.chatSessionsService.onDidChangeOptionGroups(() => {
|
|
550
|
+
this._updateWhenClauseKeys();
|
|
551
|
+
this._onDidChangeOptionGroups.fire();
|
|
552
|
+
}));
|
|
553
|
+
this._register(this.contextKeyService.onDidChangeContext(e => {
|
|
554
|
+
if (this._whenClauseKeys.size > 0 && e.affectsSome(this._whenClauseKeys)) {
|
|
555
|
+
this._onDidChangeOptionGroups.fire();
|
|
556
|
+
}
|
|
557
|
+
}));
|
|
558
|
+
this._workspaceData.set(sessionWorkspace, undefined);
|
|
559
|
+
this._repoUri = sessionWorkspace.folders[0]?.root;
|
|
560
|
+
if (this._repoUri) {
|
|
561
|
+
const id = this._repoUri.path.substring(1);
|
|
562
|
+
this.setOption("repositories", {
|
|
563
|
+
id,
|
|
564
|
+
name: id
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
this.mainChat = observableValue(this, buildChatFromSession(this));
|
|
568
|
+
}
|
|
569
|
+
setPermissionLevel(level) {
|
|
570
|
+
throw ( new Error("Method not implemented."));
|
|
571
|
+
}
|
|
572
|
+
setIsolationMode(_mode) {}
|
|
573
|
+
setUseSandbox(useSandbox) {
|
|
574
|
+
if (this._useSandbox.get() === useSandbox) {
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
this._useSandbox.set(useSandbox, undefined);
|
|
578
|
+
this.storageService.store(
|
|
579
|
+
STORAGE_KEY_USE_SANDBOX,
|
|
580
|
+
useSandbox,
|
|
581
|
+
StorageScope.PROFILE,
|
|
582
|
+
StorageTarget.MACHINE
|
|
583
|
+
);
|
|
584
|
+
}
|
|
585
|
+
setBranch(_branch) {}
|
|
586
|
+
setModelId(modelId, source) {
|
|
587
|
+
this._modelId = modelId;
|
|
588
|
+
transaction(tx => {
|
|
589
|
+
this._modelSourceObservable.set(modelId ? source : undefined, tx);
|
|
590
|
+
this._modelIdObservable.set(modelId, tx);
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
setTitle(title) {
|
|
594
|
+
this._title.set(title, undefined);
|
|
595
|
+
}
|
|
596
|
+
setStatus(status) {
|
|
597
|
+
this._status.set(status, undefined);
|
|
598
|
+
}
|
|
599
|
+
setArchived(archived) {
|
|
600
|
+
this._isArchived.set(archived, undefined);
|
|
601
|
+
}
|
|
602
|
+
setMode(_mode) {}
|
|
603
|
+
setOption(optionId, value) {
|
|
604
|
+
if (typeof value !== "string") {
|
|
605
|
+
this.selectedOptions.set(optionId, value);
|
|
606
|
+
}
|
|
607
|
+
this.chatSessionsService.setSessionOption(this.resource, optionId, value);
|
|
608
|
+
}
|
|
609
|
+
getModelOptionsSnapshot() {
|
|
610
|
+
const groups = this._getOptionGroups();
|
|
611
|
+
if (!groups) {
|
|
612
|
+
return {
|
|
613
|
+
modelOption: undefined,
|
|
614
|
+
isResolved: false
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
const group = groups.find(g => isModelOptionGroup(g));
|
|
618
|
+
if (!group) {
|
|
619
|
+
return {
|
|
620
|
+
modelOption: undefined,
|
|
621
|
+
isResolved: true
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
return {
|
|
625
|
+
modelOption: {
|
|
626
|
+
group,
|
|
627
|
+
value: this._getValueForGroup(group)
|
|
628
|
+
},
|
|
629
|
+
isResolved: true
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
getOtherOptionGroups() {
|
|
633
|
+
const groups = this._getOptionGroups();
|
|
634
|
+
if (!groups) {
|
|
635
|
+
return [];
|
|
636
|
+
}
|
|
637
|
+
return groups.filter(
|
|
638
|
+
g => !isModelOptionGroup(g) && !isRepositoriesOptionGroup(g) && this._isOptionGroupVisible(g)
|
|
639
|
+
).map(g => ({
|
|
640
|
+
group: g,
|
|
641
|
+
value: this._getValueForGroup(g)
|
|
642
|
+
}));
|
|
643
|
+
}
|
|
644
|
+
getOptionValue(groupId) {
|
|
645
|
+
return this.selectedOptions.get(groupId);
|
|
646
|
+
}
|
|
647
|
+
setOptionValue(groupId, value) {
|
|
648
|
+
this.setOption(groupId, value);
|
|
649
|
+
}
|
|
650
|
+
_getOptionGroups() {
|
|
651
|
+
return this.chatSessionsService.getOptionGroupsForSessionType(this.target);
|
|
652
|
+
}
|
|
653
|
+
_isOptionGroupVisible(group) {
|
|
654
|
+
if (!group.when) {
|
|
655
|
+
return true;
|
|
656
|
+
}
|
|
657
|
+
const expr = ContextKeyExpr.deserialize(group.when);
|
|
658
|
+
return !expr || this.contextKeyService.contextMatchesRules(expr);
|
|
659
|
+
}
|
|
660
|
+
_updateWhenClauseKeys() {
|
|
661
|
+
this._whenClauseKeys.clear();
|
|
662
|
+
const groups = this._getOptionGroups();
|
|
663
|
+
if (!groups) {
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
for (const group of groups) {
|
|
667
|
+
if (group.when) {
|
|
668
|
+
const expr = ContextKeyExpr.deserialize(group.when);
|
|
669
|
+
if (expr) {
|
|
670
|
+
for (const key of ( expr.keys())) {
|
|
671
|
+
this._whenClauseKeys.add(key);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
_getValueForGroup(group) {
|
|
678
|
+
const selected = this.selectedOptions.get(group.id);
|
|
679
|
+
if (selected) {
|
|
680
|
+
return selected;
|
|
681
|
+
}
|
|
682
|
+
const sessionOption = this.chatSessionsService.getSessionOption(this.resource, group.id);
|
|
683
|
+
if (sessionOption && typeof sessionOption !== "string") {
|
|
684
|
+
return sessionOption;
|
|
685
|
+
}
|
|
686
|
+
if (typeof sessionOption === "string") {
|
|
687
|
+
const item = group.items.find(i => i.id === sessionOption.trim());
|
|
688
|
+
if (item) {
|
|
689
|
+
return item;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
return group.items.find(i => i.default === true) ?? group.items[0];
|
|
693
|
+
}
|
|
694
|
+
update(_session) {}
|
|
695
|
+
};
|
|
696
|
+
RemoteNewSession = ( __decorate([( __param(5, IChatSessionsService)), ( __param(6, IContextKeyService)), ( __param(7, IStorageService)), ( __param(8, ILanguageModelsService))], RemoteNewSession));
|
|
697
|
+
function toSessionStatus(status) {
|
|
698
|
+
switch (status) {
|
|
699
|
+
case ChatSessionStatus.InProgress:
|
|
700
|
+
return SessionStatus.InProgress;
|
|
701
|
+
case ChatSessionStatus.NeedsInput:
|
|
702
|
+
return SessionStatus.NeedsInput;
|
|
703
|
+
case ChatSessionStatus.Completed:
|
|
704
|
+
return SessionStatus.Completed;
|
|
705
|
+
case ChatSessionStatus.Failed:
|
|
706
|
+
return SessionStatus.Error;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
function githubRemoteRepoLabel(uri) {
|
|
710
|
+
if (uri.scheme !== GITHUB_REMOTE_FILE_SCHEME) {
|
|
711
|
+
return undefined;
|
|
712
|
+
}
|
|
713
|
+
const parts = uri.path.replace(/^\//, "").split("/");
|
|
714
|
+
return parts.length >= 2 ? `${parts[0]}/${parts[1]}` : undefined;
|
|
715
|
+
}
|
|
716
|
+
function resolveGitHubRepositoryId(folder) {
|
|
717
|
+
const gitHubInfo = folder.gitRepository?.gitHubInfo.get();
|
|
718
|
+
if (gitHubInfo) {
|
|
719
|
+
return `${gitHubInfo.owner}/${gitHubInfo.repo}`;
|
|
720
|
+
}
|
|
721
|
+
return githubRemoteRepoLabel(folder.root);
|
|
722
|
+
}
|
|
723
|
+
class AgentSessionAdapter {
|
|
724
|
+
constructor(session, providerId, _gitHubService, _pullRequestIconCache) {
|
|
725
|
+
this._gitHubService = _gitHubService;
|
|
726
|
+
this._pullRequestIconCache = _pullRequestIconCache;
|
|
727
|
+
this._modelSource = observableValue("agentSessionModelSource", undefined);
|
|
728
|
+
this.modelSource = this._modelSource;
|
|
729
|
+
this._pullRequestNumberCache = ( new Map());
|
|
730
|
+
this.permissionLevel = constObservable(ChatPermissionLevel.Default);
|
|
731
|
+
this.branch = constObservable(undefined);
|
|
732
|
+
this.isolationMode = constObservable(undefined);
|
|
733
|
+
this.useSandbox = constObservable(undefined);
|
|
734
|
+
this.branches = constObservable([]);
|
|
735
|
+
this.sessionId = toSessionId(providerId, session.resource);
|
|
736
|
+
this.resource = session.resource;
|
|
737
|
+
this.providerId = providerId;
|
|
738
|
+
this.sessionType = session.providerType;
|
|
739
|
+
this.icon = this._getSessionTypeIcon(session);
|
|
740
|
+
this.createdAt = ( new Date(session.timing.created));
|
|
741
|
+
this._baseGitHubInfo = observableValue(this, this._extractGitHubInfo(session));
|
|
742
|
+
this._pullRequestBranch = observableValue(this, this._extractPullRequestBranch(session));
|
|
743
|
+
this._pullRequestNumberFromBranch = derived(this, reader => {
|
|
744
|
+
const base = this._baseGitHubInfo.read(reader);
|
|
745
|
+
const branch = this._pullRequestBranch.read(reader);
|
|
746
|
+
if (base?.pullRequest || !base || !branch) {
|
|
747
|
+
return undefined;
|
|
748
|
+
}
|
|
749
|
+
return this._pullRequestNumberForBranch(base.owner, base.repo, branch);
|
|
750
|
+
});
|
|
751
|
+
this.gitHubInfo = derived(this, reader => {
|
|
752
|
+
let info = this._baseGitHubInfo.read(reader);
|
|
753
|
+
if (!info) {
|
|
754
|
+
return undefined;
|
|
755
|
+
}
|
|
756
|
+
if (!info.pullRequest) {
|
|
757
|
+
const pullRequestNumber = this._pullRequestNumberFromBranch.read(reader)?.read(reader).value;
|
|
758
|
+
if (pullRequestNumber === undefined) {
|
|
759
|
+
return info;
|
|
760
|
+
}
|
|
761
|
+
info = {
|
|
762
|
+
...info,
|
|
763
|
+
pullRequest: {
|
|
764
|
+
number: pullRequestNumber,
|
|
765
|
+
uri: ( URI.parse(`https://github.com/${info.owner}/${info.repo}/pull/${pullRequestNumber}`))
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
const pullRequest = info.pullRequest;
|
|
770
|
+
if (!pullRequest) {
|
|
771
|
+
return info;
|
|
772
|
+
}
|
|
773
|
+
if (pullRequest.uri.authority.toLowerCase() !== "github.com") {
|
|
774
|
+
return info;
|
|
775
|
+
}
|
|
776
|
+
const presentation = computePullRequestRefPresentation(reader, this._gitHubService, this._pullRequestIconCache, {
|
|
777
|
+
owner: info.owner,
|
|
778
|
+
repo: info.repo,
|
|
779
|
+
number: pullRequest.number,
|
|
780
|
+
uri: pullRequest.uri,
|
|
781
|
+
icon: pullRequest.icon,
|
|
782
|
+
title: pullRequest.title
|
|
783
|
+
}, computePullRequestIcon(GitHubPullRequestState.Open));
|
|
784
|
+
return {
|
|
785
|
+
...info,
|
|
786
|
+
pullRequest: {
|
|
787
|
+
...pullRequest,
|
|
788
|
+
...presentation
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
});
|
|
792
|
+
this._workspace = observableValue(this, this._buildWorkspace(session));
|
|
793
|
+
this.workspace = this._workspace;
|
|
794
|
+
this._title = observableValue(this, session.label);
|
|
795
|
+
this.title = this._title;
|
|
796
|
+
const updatedTime = session.timing.lastRequestEnded ?? session.timing.lastRequestStarted ?? session.timing.created;
|
|
797
|
+
this._updatedAt = observableValue(this, ( new Date(updatedTime)));
|
|
798
|
+
this.updatedAt = this._updatedAt;
|
|
799
|
+
this._status = observableValue(this, toSessionStatus(session.status));
|
|
800
|
+
this.status = this._status;
|
|
801
|
+
this._changes = observableValueOpts({
|
|
802
|
+
owner: this,
|
|
803
|
+
equalsFn: sessionFileChangesEqual
|
|
804
|
+
}, this._extractChanges(session));
|
|
805
|
+
this.changes = this._changes;
|
|
806
|
+
this._changesSummary = observableValueOpts({
|
|
807
|
+
owner: this,
|
|
808
|
+
equalsFn: structuralEquals
|
|
809
|
+
}, this._extractChangesSummary(session));
|
|
810
|
+
this.changesSummary = this._changesSummary;
|
|
811
|
+
this._checkpoints = observableValueOpts({
|
|
812
|
+
owner: this,
|
|
813
|
+
equalsFn: structuralEquals
|
|
814
|
+
}, this._extractCheckpoints(session));
|
|
815
|
+
this.checkpoints = this._checkpoints;
|
|
816
|
+
this._modelId = observableValue(this, undefined);
|
|
817
|
+
this.modelId = this._modelId;
|
|
818
|
+
this.mode = observableValue(this, undefined);
|
|
819
|
+
this.loading = observableValue(this, false);
|
|
820
|
+
this._isArchived = observableValue(this, session.isArchived());
|
|
821
|
+
this.isArchived = this._isArchived;
|
|
822
|
+
this._isRead = observableValue(this, session.isRead());
|
|
823
|
+
this.isRead = this._isRead;
|
|
824
|
+
this._description = observableValue(this, this._extractDescription(session));
|
|
825
|
+
this.description = this._description;
|
|
826
|
+
this._lastTurnEnd = observableValue(this, session.timing.lastRequestEnded ? ( new Date(session.timing.lastRequestEnded)) : undefined);
|
|
827
|
+
this.lastTurnEnd = this._lastTurnEnd;
|
|
828
|
+
this.mainChat = observableValue(this, buildChatFromSession(this));
|
|
829
|
+
}
|
|
830
|
+
setPermissionLevel(level) {
|
|
831
|
+
throw ( new Error("Method not implemented."));
|
|
832
|
+
}
|
|
833
|
+
setBranch(branch) {
|
|
834
|
+
throw ( new Error("Method not implemented."));
|
|
835
|
+
}
|
|
836
|
+
setIsolationMode(mode) {
|
|
837
|
+
throw ( new Error("Method not implemented."));
|
|
838
|
+
}
|
|
839
|
+
setUseSandbox(useSandbox) {}
|
|
840
|
+
setModelId(modelId, source) {
|
|
841
|
+
transaction(tx => {
|
|
842
|
+
this._modelSource.set(modelId ? source : undefined, tx);
|
|
843
|
+
this._modelId.set(modelId, tx);
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
setMode(chatMode) {
|
|
847
|
+
throw ( new Error("Method not implemented."));
|
|
848
|
+
}
|
|
849
|
+
update(session) {
|
|
850
|
+
let changed = false;
|
|
851
|
+
transaction(tx => {
|
|
852
|
+
const gitHubInfo = this._extractGitHubInfo(session);
|
|
853
|
+
const pullRequestBranch = this._extractPullRequestBranch(session);
|
|
854
|
+
changed = setIfChanged(this._title, session.label, tx) || changed;
|
|
855
|
+
changed = setIfChanged(this._workspace, this._buildWorkspace(session), tx, sessionWorkspaceEqual) || changed;
|
|
856
|
+
const updatedTime = session.timing.lastRequestEnded ?? session.timing.lastRequestStarted ?? session.timing.created;
|
|
857
|
+
changed = setIfChanged(this._updatedAt, ( new Date(updatedTime)), tx, dateEquals) || changed;
|
|
858
|
+
changed = setIfChanged(this._status, toSessionStatus(session.status), tx) || changed;
|
|
859
|
+
changed = setIfChanged(this._changes, this._extractChanges(session), tx, sessionFileChangesEqual) || changed;
|
|
860
|
+
changed = setIfChanged(
|
|
861
|
+
this._changesSummary,
|
|
862
|
+
this._extractChangesSummary(session),
|
|
863
|
+
tx,
|
|
864
|
+
structuralEquals
|
|
865
|
+
) || changed;
|
|
866
|
+
changed = setIfChanged(this._checkpoints, this._extractCheckpoints(session), tx, structuralEquals) || changed;
|
|
867
|
+
changed = setIfChanged(this._isArchived, session.isArchived(), tx) || changed;
|
|
868
|
+
changed = setIfChanged(this._isRead, session.isRead(), tx) || changed;
|
|
869
|
+
changed = setIfChanged(
|
|
870
|
+
this._description,
|
|
871
|
+
this._extractDescription(session),
|
|
872
|
+
tx,
|
|
873
|
+
markdownStringEquals
|
|
874
|
+
) || changed;
|
|
875
|
+
changed = setIfChanged(this._lastTurnEnd, session.timing.lastRequestEnded ? ( new Date(session.timing.lastRequestEnded)) : undefined, tx, dateEquals) || changed;
|
|
876
|
+
changed = setIfChanged(this._baseGitHubInfo, gitHubInfo, tx, gitHubInfoEqual) || changed;
|
|
877
|
+
changed = setIfChanged(this._pullRequestBranch, pullRequestBranch, tx) || changed;
|
|
878
|
+
});
|
|
879
|
+
return changed;
|
|
880
|
+
}
|
|
881
|
+
_pullRequestNumberForBranch(owner, repo, branch) {
|
|
882
|
+
const key = `${owner}/${repo}@${branch}`;
|
|
883
|
+
const cached = this._pullRequestNumberCache.get(key);
|
|
884
|
+
if (cached) {
|
|
885
|
+
return cached;
|
|
886
|
+
}
|
|
887
|
+
const lookup = this._gitHubService.findPullRequestNumberByHeadBranch(owner, repo, branch);
|
|
888
|
+
const observable = observableFromPromise(lookup);
|
|
889
|
+
this._pullRequestNumberCache.set(key, observable);
|
|
890
|
+
lookup.then(pullRequestNumber => {
|
|
891
|
+
if (pullRequestNumber === undefined && this._pullRequestNumberCache.get(key) === observable) {
|
|
892
|
+
this._pullRequestNumberCache.delete(key);
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
return observable;
|
|
896
|
+
}
|
|
897
|
+
_getSessionTypeIcon(session) {
|
|
898
|
+
switch (session.providerType) {
|
|
899
|
+
case AgentSessionProviders.Background:
|
|
900
|
+
return CopilotCLISessionType.icon;
|
|
901
|
+
case AgentSessionProviders.Cloud:
|
|
902
|
+
return CopilotCloudSessionType.icon;
|
|
903
|
+
default:
|
|
904
|
+
return session.icon;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
_extractDescription(session) {
|
|
908
|
+
if (!session.description) {
|
|
909
|
+
return undefined;
|
|
910
|
+
}
|
|
911
|
+
return typeof session.description === "string" ? ( new MarkdownString(session.description)) : session.description;
|
|
912
|
+
}
|
|
913
|
+
_extractGitHubInfo(session) {
|
|
914
|
+
const metadata = session.metadata;
|
|
915
|
+
if (!metadata) {
|
|
916
|
+
return undefined;
|
|
917
|
+
}
|
|
918
|
+
const pullRequestUri = this._extractPullRequestUri(session);
|
|
919
|
+
const pullRequestIdentity = pullRequestUri ? this._extractPullRequestIdentity(pullRequestUri) : undefined;
|
|
920
|
+
const {
|
|
921
|
+
owner,
|
|
922
|
+
repo
|
|
923
|
+
} = pullRequestIdentity ?? this._extractOwnerRepo(session);
|
|
924
|
+
if (!owner || !repo) {
|
|
925
|
+
return undefined;
|
|
926
|
+
}
|
|
927
|
+
if (!pullRequestUri || !pullRequestIdentity) {
|
|
928
|
+
return {
|
|
929
|
+
owner,
|
|
930
|
+
repo
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
const icon = this._extractPullRequestStateIcon(session);
|
|
934
|
+
const baseRefOid = typeof metadata.baseRefOid === "string" ? metadata.baseRefOid : undefined;
|
|
935
|
+
const headRefOid = typeof metadata.headRefOid === "string" ? metadata.headRefOid : undefined;
|
|
936
|
+
return {
|
|
937
|
+
owner,
|
|
938
|
+
repo,
|
|
939
|
+
pullRequest: {
|
|
940
|
+
number: pullRequestIdentity.number,
|
|
941
|
+
uri: pullRequestUri,
|
|
942
|
+
icon,
|
|
943
|
+
baseRefOid,
|
|
944
|
+
headRefOid
|
|
945
|
+
}
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
_extractPullRequestBranch(session) {
|
|
949
|
+
if (session.providerType !== AgentSessionProviders.Cloud) {
|
|
950
|
+
return undefined;
|
|
951
|
+
}
|
|
952
|
+
if (typeof session.metadata?.host === "string" && session.metadata.host.toLowerCase() !== "github.com") {
|
|
953
|
+
return undefined;
|
|
954
|
+
}
|
|
955
|
+
return typeof session.metadata?.branch === "string" ? session.metadata.branch : undefined;
|
|
956
|
+
}
|
|
957
|
+
_extractPullRequestIdentity(pullRequestUri) {
|
|
958
|
+
const match = /^\/(?<owner>[^/]+)\/(?<repo>[^/]+)\/pull\/(?<number>\d+)\/?$/.exec(pullRequestUri.path);
|
|
959
|
+
if (!match?.groups) {
|
|
960
|
+
return undefined;
|
|
961
|
+
}
|
|
962
|
+
return {
|
|
963
|
+
owner: decodeURIComponent(match.groups.owner),
|
|
964
|
+
repo: decodeURIComponent(match.groups.repo),
|
|
965
|
+
number: parseInt(match.groups.number, 10)
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
_extractOwnerRepo(session) {
|
|
969
|
+
const metadata = session.metadata;
|
|
970
|
+
if (!metadata) {
|
|
971
|
+
return {
|
|
972
|
+
owner: undefined,
|
|
973
|
+
repo: undefined
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
if (typeof metadata.owner === "string" && typeof metadata.name === "string") {
|
|
977
|
+
return {
|
|
978
|
+
owner: metadata.owner,
|
|
979
|
+
repo: metadata.name
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
if (typeof metadata.repositoryNwo === "string") {
|
|
983
|
+
const parts = metadata.repositoryNwo.split("/");
|
|
984
|
+
if (parts.length === 2) {
|
|
985
|
+
return {
|
|
986
|
+
owner: parts[0],
|
|
987
|
+
repo: parts[1]
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
const repoUri = this._buildWorkspace(session)?.folders[0]?.root;
|
|
992
|
+
if (repoUri && repoUri.scheme === GITHUB_REMOTE_FILE_SCHEME) {
|
|
993
|
+
const parts = repoUri.path.split("/").filter(Boolean);
|
|
994
|
+
if (parts.length >= 2) {
|
|
995
|
+
return {
|
|
996
|
+
owner: decodeURIComponent(parts[0]),
|
|
997
|
+
repo: decodeURIComponent(parts[1])
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
return {
|
|
1002
|
+
owner: undefined,
|
|
1003
|
+
repo: undefined
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
1006
|
+
_extractPullRequestStateIcon(session) {
|
|
1007
|
+
const metadata = session.metadata;
|
|
1008
|
+
const state = metadata?.pullRequestState;
|
|
1009
|
+
if (typeof state === "string") {
|
|
1010
|
+
return computePullRequestIcon(state);
|
|
1011
|
+
}
|
|
1012
|
+
return undefined;
|
|
1013
|
+
}
|
|
1014
|
+
_extractPullRequestUri(session) {
|
|
1015
|
+
return getAgentSessionPullRequestUri(session);
|
|
1016
|
+
}
|
|
1017
|
+
_extractChanges(session) {
|
|
1018
|
+
return session.changes && !isChangesSummary(session.changes) ? session.changes : [];
|
|
1019
|
+
}
|
|
1020
|
+
_extractChangesSummary(session) {
|
|
1021
|
+
if (!isChangesSummary(session.changes)) {
|
|
1022
|
+
return undefined;
|
|
1023
|
+
}
|
|
1024
|
+
return {
|
|
1025
|
+
files: session.changes.files,
|
|
1026
|
+
additions: session.changes.insertions,
|
|
1027
|
+
deletions: session.changes.deletions
|
|
1028
|
+
};
|
|
1029
|
+
}
|
|
1030
|
+
_extractCheckpoints(session) {
|
|
1031
|
+
const metadata = session.metadata;
|
|
1032
|
+
if (typeof metadata?.firstCheckpointRef !== "string" || typeof metadata?.lastCheckpointRef !== "string") {
|
|
1033
|
+
return undefined;
|
|
1034
|
+
}
|
|
1035
|
+
return {
|
|
1036
|
+
firstCheckpointRef: metadata.firstCheckpointRef,
|
|
1037
|
+
lastCheckpointRef: metadata.lastCheckpointRef
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
_buildWorkspace(session) {
|
|
1041
|
+
const {
|
|
1042
|
+
repoUri,
|
|
1043
|
+
worktreeUri,
|
|
1044
|
+
branchName,
|
|
1045
|
+
baseBranchName,
|
|
1046
|
+
baseBranchProtected,
|
|
1047
|
+
hasGitHubRemote,
|
|
1048
|
+
upstreamBranchName,
|
|
1049
|
+
incomingChanges,
|
|
1050
|
+
outgoingChanges,
|
|
1051
|
+
uncommittedChanges,
|
|
1052
|
+
hasGitOperationInProgress
|
|
1053
|
+
} = this._extractRepositoryFromMetadata(session);
|
|
1054
|
+
const repoUriResolved = repoUri ?? ( URI.parse("unknown:///"));
|
|
1055
|
+
const gitRepository = {
|
|
1056
|
+
uri: repoUriResolved,
|
|
1057
|
+
workTreeUri: worktreeUri,
|
|
1058
|
+
isRepository: constObservable(repoUri !== undefined),
|
|
1059
|
+
branchName,
|
|
1060
|
+
baseBranchName,
|
|
1061
|
+
baseBranchProtected,
|
|
1062
|
+
hasGitHubRemote,
|
|
1063
|
+
upstreamBranchName,
|
|
1064
|
+
incomingChanges,
|
|
1065
|
+
outgoingChanges,
|
|
1066
|
+
uncommittedChanges,
|
|
1067
|
+
hasGitOperationInProgress,
|
|
1068
|
+
gitHubInfo: this.gitHubInfo
|
|
1069
|
+
};
|
|
1070
|
+
const folder = {
|
|
1071
|
+
root: repoUriResolved,
|
|
1072
|
+
workingDirectory: worktreeUri ?? repoUriResolved,
|
|
1073
|
+
name: basename(repoUriResolved),
|
|
1074
|
+
description: branchName,
|
|
1075
|
+
gitRepository
|
|
1076
|
+
};
|
|
1077
|
+
return {
|
|
1078
|
+
uri: repoUriResolved,
|
|
1079
|
+
label: githubRemoteRepoLabel(repoUriResolved) ?? getRepositoryName(session) ?? basename(repoUriResolved),
|
|
1080
|
+
icon: repoUri?.scheme === GITHUB_REMOTE_FILE_SCHEME ? Codicon.repo : Codicon.folder,
|
|
1081
|
+
group: repoUri?.scheme === GITHUB_REMOTE_FILE_SCHEME ? SESSION_WORKSPACE_GROUP_GITHUB : SESSION_WORKSPACE_GROUP_LOCAL,
|
|
1082
|
+
folders: [folder],
|
|
1083
|
+
requiresWorkspaceTrust: session.providerType !== AgentSessionProviders.Cloud,
|
|
1084
|
+
isVirtualWorkspace: session.providerType === AgentSessionProviders.Cloud
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
_extractRepositoryFromMetadata(session) {
|
|
1088
|
+
const metadata = session.metadata;
|
|
1089
|
+
if (!metadata) {
|
|
1090
|
+
return {};
|
|
1091
|
+
}
|
|
1092
|
+
if (session.providerType === AgentSessionProviders.Cloud) {
|
|
1093
|
+
if (typeof metadata.owner !== "string" || typeof metadata.name !== "string") {
|
|
1094
|
+
return {};
|
|
1095
|
+
}
|
|
1096
|
+
const branch = typeof metadata.branch === "string" ? metadata.branch : "HEAD";
|
|
1097
|
+
const repositoryUri = ( URI.from({
|
|
1098
|
+
scheme: GITHUB_REMOTE_FILE_SCHEME,
|
|
1099
|
+
authority: "github",
|
|
1100
|
+
path: `/${metadata.owner}/${metadata.name}/${encodeURIComponent(branch)}`
|
|
1101
|
+
}));
|
|
1102
|
+
return {
|
|
1103
|
+
repoUri: repositoryUri
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
const repoUri = typeof metadata?.repositoryPath === "string" ? URI.file(metadata.repositoryPath) : undefined;
|
|
1107
|
+
const worktreeUri = typeof metadata?.worktreePath === "string" ? URI.file(metadata.worktreePath) : undefined;
|
|
1108
|
+
return {
|
|
1109
|
+
repoUri,
|
|
1110
|
+
worktreeUri,
|
|
1111
|
+
branchName: metadata?.branchName,
|
|
1112
|
+
baseBranchName: metadata?.baseBranchName,
|
|
1113
|
+
baseBranchProtected: metadata?.baseBranchProtected,
|
|
1114
|
+
hasGitHubRemote: metadata?.hasGitHubRemote,
|
|
1115
|
+
upstreamBranchName: metadata?.upstreamBranchName,
|
|
1116
|
+
incomingChanges: metadata?.incomingChanges,
|
|
1117
|
+
outgoingChanges: metadata?.outgoingChanges,
|
|
1118
|
+
uncommittedChanges: metadata?.uncommittedChanges,
|
|
1119
|
+
hasGitOperationInProgress: metadata?.hasGitOperationInProgress
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
let CopilotChatSessionsProvider = class CopilotChatSessionsProvider extends Disposable {
|
|
1124
|
+
static {
|
|
1125
|
+
CopilotChatSessionsProvider_1 = this;
|
|
1126
|
+
}
|
|
1127
|
+
static {
|
|
1128
|
+
this.SANDBOX_MODEL_WAIT_MS = 5_000;
|
|
1129
|
+
}
|
|
1130
|
+
static {
|
|
1131
|
+
this.AUTOMATION_AGENT_RESOLUTION_TIMEOUT_MS = 30_000;
|
|
1132
|
+
}
|
|
1133
|
+
get sessionTypes() {
|
|
1134
|
+
const types = [];
|
|
1135
|
+
if (this._isCopilotCliAvailable()) {
|
|
1136
|
+
types.push(CopilotCLISessionType);
|
|
1137
|
+
}
|
|
1138
|
+
types.push(CopilotCloudSessionType);
|
|
1139
|
+
return types;
|
|
1140
|
+
}
|
|
1141
|
+
_registerGroupMembershipFanOut() {
|
|
1142
|
+
this._register(this._onDidGroupMembershipChange.event(e => {
|
|
1143
|
+
this._groupMembershipSignals.get(e.sessionId)?.trigger(undefined, undefined);
|
|
1144
|
+
}));
|
|
1145
|
+
}
|
|
1146
|
+
_isCopilotCliAvailable() {
|
|
1147
|
+
return !this.agentHostEnablementService.enabled.get();
|
|
1148
|
+
}
|
|
1149
|
+
constructor(
|
|
1150
|
+
agentSessionsService,
|
|
1151
|
+
chatService,
|
|
1152
|
+
chatSessionsService,
|
|
1153
|
+
dialogService,
|
|
1154
|
+
commandService,
|
|
1155
|
+
instantiationService,
|
|
1156
|
+
languageModelsService,
|
|
1157
|
+
toolsService,
|
|
1158
|
+
configurationService,
|
|
1159
|
+
agentHostEnablementService,
|
|
1160
|
+
logService,
|
|
1161
|
+
notificationService,
|
|
1162
|
+
gitHubService,
|
|
1163
|
+
pullRequestIconCache,
|
|
1164
|
+
labelService,
|
|
1165
|
+
chatModeService,
|
|
1166
|
+
uriIdentityService,
|
|
1167
|
+
fileService,
|
|
1168
|
+
pathService
|
|
1169
|
+
) {
|
|
1170
|
+
super();
|
|
1171
|
+
this.agentSessionsService = agentSessionsService;
|
|
1172
|
+
this.chatService = chatService;
|
|
1173
|
+
this.chatSessionsService = chatSessionsService;
|
|
1174
|
+
this.dialogService = dialogService;
|
|
1175
|
+
this.commandService = commandService;
|
|
1176
|
+
this.instantiationService = instantiationService;
|
|
1177
|
+
this.languageModelsService = languageModelsService;
|
|
1178
|
+
this.toolsService = toolsService;
|
|
1179
|
+
this.configurationService = configurationService;
|
|
1180
|
+
this.agentHostEnablementService = agentHostEnablementService;
|
|
1181
|
+
this.logService = logService;
|
|
1182
|
+
this.notificationService = notificationService;
|
|
1183
|
+
this.gitHubService = gitHubService;
|
|
1184
|
+
this.pullRequestIconCache = pullRequestIconCache;
|
|
1185
|
+
this.labelService = labelService;
|
|
1186
|
+
this.chatModeService = chatModeService;
|
|
1187
|
+
this.uriIdentityService = uriIdentityService;
|
|
1188
|
+
this.fileService = fileService;
|
|
1189
|
+
this.pathService = pathService;
|
|
1190
|
+
this.id = COPILOT_PROVIDER_ID;
|
|
1191
|
+
this.label = ( localize(4215, "Copilot Chat"));
|
|
1192
|
+
this.icon = Codicon.copilot;
|
|
1193
|
+
this.order = 0;
|
|
1194
|
+
this.supportsAutomationSessionConfiguration = true;
|
|
1195
|
+
this._onDidChangeSessionTypes = this._register(( new Emitter()));
|
|
1196
|
+
this.onDidChangeSessionTypes = this._onDidChangeSessionTypes.event;
|
|
1197
|
+
this._onDidChangeSessions = this._register(( new Emitter()));
|
|
1198
|
+
this.onDidChangeSessions = this._onDidChangeSessions.event;
|
|
1199
|
+
this._onDidReplaceSession = this._register(( new Emitter()));
|
|
1200
|
+
this.onDidReplaceSession = this._onDidReplaceSession.event;
|
|
1201
|
+
this._sessionCache = ( new Map());
|
|
1202
|
+
this._inFlightCommits = ( new Set());
|
|
1203
|
+
this._sessionGroupCache = ( new Map());
|
|
1204
|
+
this._onDidGroupMembershipChange = this._register(( new Emitter()));
|
|
1205
|
+
this._groupMembershipSignals = ( new Map());
|
|
1206
|
+
this._localGitRepositoryState = ( new Map());
|
|
1207
|
+
this._localGitRepositoryResolutionStarted = ( new Set());
|
|
1208
|
+
this.supportsLocalWorkspaces = true;
|
|
1209
|
+
this._newSessions = this._register(( new DisposableMap()));
|
|
1210
|
+
this._multiChatEnabled = this.configurationService.getValue(COPILOT_MULTI_CHAT_SETTING) ?? true;
|
|
1211
|
+
this._register(runOnChange(this.agentHostEnablementService.enabled, () => {
|
|
1212
|
+
this._onDidChangeSessionTypes.fire();
|
|
1213
|
+
this._refreshSessionCache();
|
|
1214
|
+
}));
|
|
1215
|
+
this._register(Event.filter(
|
|
1216
|
+
this.configurationService.onDidChangeConfiguration,
|
|
1217
|
+
event => event.affectsConfiguration(UNIFIED_WORKSPACE_PICKER_SETTING)
|
|
1218
|
+
)(() => this._onDidChangeSessionTypes.fire()));
|
|
1219
|
+
this._register(this.agentSessionsService.model.onDidChangeSessions(() => {
|
|
1220
|
+
this._refreshSessionCache();
|
|
1221
|
+
}));
|
|
1222
|
+
this._registerGroupMembershipFanOut();
|
|
1223
|
+
this._ensureSessionCache();
|
|
1224
|
+
}
|
|
1225
|
+
get browseActions() {
|
|
1226
|
+
const useConsolidatedRemoteWorkspaces = this.configurationService.getValue(UNIFIED_WORKSPACE_PICKER_SETTING);
|
|
1227
|
+
const repositoryActions = useConsolidatedRemoteWorkspaces ? [{
|
|
1228
|
+
label: ( localize(4216, "Work in Repository...")),
|
|
1229
|
+
group: SESSION_WORKSPACE_GROUP_GITHUB,
|
|
1230
|
+
icon: Codicon.github,
|
|
1231
|
+
providerId: this.id,
|
|
1232
|
+
attachesContext: false,
|
|
1233
|
+
supportsContextAttachment: true,
|
|
1234
|
+
run: () => this._browseForRepository()
|
|
1235
|
+
}] : [{
|
|
1236
|
+
label: ( localize(4217, "Repository...")),
|
|
1237
|
+
group: SESSION_WORKSPACE_GROUP_GITHUB,
|
|
1238
|
+
icon: Codicon.library,
|
|
1239
|
+
providerId: this.id,
|
|
1240
|
+
attachesContext: false,
|
|
1241
|
+
supportsContextAttachment: true,
|
|
1242
|
+
run: () => this._browseForRepository()
|
|
1243
|
+
}];
|
|
1244
|
+
return [...repositoryActions, {
|
|
1245
|
+
label: ( localize(4218, "Issue...")),
|
|
1246
|
+
group: SESSION_WORKSPACE_GROUP_GITHUB,
|
|
1247
|
+
icon: Codicon.issues,
|
|
1248
|
+
providerId: this.id,
|
|
1249
|
+
attachesContext: true,
|
|
1250
|
+
run: workspace => this._browseForGitHubContext(OPEN_ISSUE_COMMAND, Codicon.issues, workspace)
|
|
1251
|
+
}, {
|
|
1252
|
+
label: ( localize(4219, "Pull Request...")),
|
|
1253
|
+
group: SESSION_WORKSPACE_GROUP_GITHUB,
|
|
1254
|
+
icon: useConsolidatedRemoteWorkspaces ? Codicon.github : Codicon.gitPullRequest,
|
|
1255
|
+
providerId: this.id,
|
|
1256
|
+
attachesContext: true,
|
|
1257
|
+
run: workspace => this._browseForGitHubContext(
|
|
1258
|
+
OPEN_PULL_REQUEST_COMMAND,
|
|
1259
|
+
useConsolidatedRemoteWorkspaces ? Codicon.github : Codicon.gitPullRequest,
|
|
1260
|
+
workspace
|
|
1261
|
+
)
|
|
1262
|
+
}];
|
|
1263
|
+
}
|
|
1264
|
+
getSessionTypes(workspaceUri) {
|
|
1265
|
+
if (workspaceUri.scheme === GITHUB_REMOTE_FILE_SCHEME || workspaceUri.scheme === SessionType.CopilotCloud) {
|
|
1266
|
+
return [CopilotCloudSessionType];
|
|
1267
|
+
}
|
|
1268
|
+
const types = [];
|
|
1269
|
+
if (this._isCopilotCliAvailable()) {
|
|
1270
|
+
types.push(CopilotCLISessionType);
|
|
1271
|
+
}
|
|
1272
|
+
if (this.configurationService.getValue(UNIFIED_WORKSPACE_PICKER_SETTING) && workspaceUri.scheme === Schemas.file) {
|
|
1273
|
+
const gitRepository = this._getLocalGitRepository(workspaceUri);
|
|
1274
|
+
gitRepository.resolveGitHubInfo?.();
|
|
1275
|
+
if (gitRepository.gitHubInfo.get()) {
|
|
1276
|
+
types.push(CopilotCloudSessionType);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
return types;
|
|
1280
|
+
}
|
|
1281
|
+
getSessions() {
|
|
1282
|
+
this._ensureSessionCache();
|
|
1283
|
+
if (!this._isMultiChatEnabled()) {
|
|
1284
|
+
return Array.from(( this._sessionCache.values())).map(chat => this._chatToSession(chat));
|
|
1285
|
+
}
|
|
1286
|
+
const allChats = Array.from(( this._sessionCache.values())).sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
|
|
1287
|
+
const seen = ( new Set());
|
|
1288
|
+
const sessions = [];
|
|
1289
|
+
for (const chat of allChats) {
|
|
1290
|
+
const groupId = this._getGroupIdForChat(chat);
|
|
1291
|
+
if (!( seen.has(groupId))) {
|
|
1292
|
+
seen.add(groupId);
|
|
1293
|
+
sessions.push(this._chatToSession(chat));
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
return sessions;
|
|
1297
|
+
}
|
|
1298
|
+
_clearCurrentNewSessionIfMatch(session, leak) {
|
|
1299
|
+
if (this._newSessions.get(session.sessionId) === session) {
|
|
1300
|
+
if (leak) {
|
|
1301
|
+
this._newSessions.deleteAndLeak(session.sessionId);
|
|
1302
|
+
} else {
|
|
1303
|
+
this._newSessions.deleteAndDispose(session.sessionId);
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
deleteNewSession(sessionId) {
|
|
1308
|
+
if (( this._newSessions.has(sessionId))) {
|
|
1309
|
+
this._newSessions.deleteAndDispose(sessionId);
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
getSession(sessionId) {
|
|
1313
|
+
const newSession = this._newSessions.get(sessionId);
|
|
1314
|
+
if (newSession) {
|
|
1315
|
+
return newSession;
|
|
1316
|
+
}
|
|
1317
|
+
return this._findChatSession(sessionId);
|
|
1318
|
+
}
|
|
1319
|
+
createNewSession(workspaceUri, sessionTypeId, options) {
|
|
1320
|
+
const workspace = this.resolveWorkspace(workspaceUri);
|
|
1321
|
+
if (!workspace) {
|
|
1322
|
+
throw ( new Error(`Cannot resolve workspace for URI: ${( workspaceUri.toString())}`));
|
|
1323
|
+
}
|
|
1324
|
+
const automationConfiguration = options?.automationConfiguration;
|
|
1325
|
+
assertAutomationSessionTemplate(automationConfiguration?.sessionTemplate);
|
|
1326
|
+
let session;
|
|
1327
|
+
if (workspaceUri.scheme === GITHUB_REMOTE_FILE_SCHEME && sessionTypeId !== CopilotCloudSessionType.id) {
|
|
1328
|
+
throw ( new Error("Only Copilot Cloud sessions can be created for GitHub repositories"));
|
|
1329
|
+
}
|
|
1330
|
+
if (sessionTypeId === CopilotCloudSessionType.id) {
|
|
1331
|
+
const cloudWorkspace = workspaceUri.scheme === GITHUB_REMOTE_FILE_SCHEME ? workspace : this._getCloudWorkspaceForLocalRepository(workspace);
|
|
1332
|
+
if (!cloudWorkspace) {
|
|
1333
|
+
throw ( new Error("Copilot Cloud sessions require a local workspace with a GitHub remote"));
|
|
1334
|
+
}
|
|
1335
|
+
const resource = ( URI.from({
|
|
1336
|
+
scheme: AgentSessionProviders.Cloud,
|
|
1337
|
+
path: `/untitled-${generateUuid()}`
|
|
1338
|
+
}));
|
|
1339
|
+
session = this.instantiationService.createInstance(
|
|
1340
|
+
RemoteNewSession,
|
|
1341
|
+
resource,
|
|
1342
|
+
cloudWorkspace,
|
|
1343
|
+
AgentSessionProviders.Cloud,
|
|
1344
|
+
this.id,
|
|
1345
|
+
automationConfiguration
|
|
1346
|
+
);
|
|
1347
|
+
} else {
|
|
1348
|
+
if (sessionTypeId !== CopilotCLISessionType.id) {
|
|
1349
|
+
throw ( new Error(`Unsupported session type '${sessionTypeId}' for local workspaces`));
|
|
1350
|
+
}
|
|
1351
|
+
const resource = ( URI.from({
|
|
1352
|
+
scheme: AgentSessionProviders.Background,
|
|
1353
|
+
path: `/untitled-${generateUuid()}`
|
|
1354
|
+
}));
|
|
1355
|
+
session = this.instantiationService.createInstance(CopilotCLISession, resource, workspace, this.id, automationConfiguration);
|
|
1356
|
+
session.setPermissionLevel(this._defaultPermissionLevel());
|
|
1357
|
+
}
|
|
1358
|
+
this._newSessions.set(session.sessionId, session);
|
|
1359
|
+
try {
|
|
1360
|
+
this._applyAutomationSessionConfiguration(session, automationConfiguration);
|
|
1361
|
+
return this._chatToSession(session);
|
|
1362
|
+
} catch (error) {
|
|
1363
|
+
this._newSessions.deleteAndDispose(session.sessionId);
|
|
1364
|
+
throw error;
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
_getCloudWorkspaceForLocalRepository(workspace) {
|
|
1368
|
+
const gitHubInfo = workspace.folders.map(folder => folder.gitRepository?.gitHubInfo.get()).find(info => info !== undefined);
|
|
1369
|
+
if (!gitHubInfo) {
|
|
1370
|
+
return undefined;
|
|
1371
|
+
}
|
|
1372
|
+
const root = ( URI.from({
|
|
1373
|
+
scheme: GITHUB_REMOTE_FILE_SCHEME,
|
|
1374
|
+
authority: "github",
|
|
1375
|
+
path: `/${gitHubInfo.owner}/${gitHubInfo.repo}/HEAD`
|
|
1376
|
+
}));
|
|
1377
|
+
return this.resolveWorkspace(root);
|
|
1378
|
+
}
|
|
1379
|
+
getAutomationModelConfiguration(sessionId) {
|
|
1380
|
+
return this._newSessions.get(sessionId)?.modelConfiguration;
|
|
1381
|
+
}
|
|
1382
|
+
async getAutomationSessionConfiguration(sessionId) {
|
|
1383
|
+
const session = this._newSessions.get(sessionId);
|
|
1384
|
+
if (!session) {
|
|
1385
|
+
return undefined;
|
|
1386
|
+
}
|
|
1387
|
+
const modelId = session.modelId.get();
|
|
1388
|
+
const modelConfiguration = session.modelConfiguration.captureModelConfiguration(modelId);
|
|
1389
|
+
const initialConfiguration = session.initialAutomationSessionConfiguration;
|
|
1390
|
+
const initialTemplate = initialConfiguration?.sessionTemplate;
|
|
1391
|
+
const initialMode = initialConfiguration?.mode ?? initialTemplate?.config?.[SessionConfigKey.Mode];
|
|
1392
|
+
const mode = session instanceof CopilotCLISession ? session.mode.get()?.id : typeof initialMode === "string" ? initialMode : undefined;
|
|
1393
|
+
const initialPermissionLevel = initialConfiguration?.permissionLevel ?? initialTemplate?.config?.[SessionConfigKey.AutoApprove];
|
|
1394
|
+
const permissionLevel = session instanceof RemoteNewSession && isChatPermissionLevel(initialPermissionLevel) ? initialPermissionLevel : session.permissionLevel.get();
|
|
1395
|
+
const config = {
|
|
1396
|
+
...initialTemplate?.config
|
|
1397
|
+
};
|
|
1398
|
+
if (mode) {
|
|
1399
|
+
config[SessionConfigKey.Mode] = mode;
|
|
1400
|
+
} else {
|
|
1401
|
+
delete config[SessionConfigKey.Mode];
|
|
1402
|
+
}
|
|
1403
|
+
config[SessionConfigKey.AutoApprove] = permissionLevel;
|
|
1404
|
+
const agentUri = session.chatMode?.uri?.get();
|
|
1405
|
+
const agent = agentUri ? {
|
|
1406
|
+
uri: ( agentUri.toString())
|
|
1407
|
+
} : initialTemplate?.agent && mode === initialTemplate.agent.uri ? initialTemplate.agent : undefined;
|
|
1408
|
+
const sessionTemplate = {
|
|
1409
|
+
...(modelId ? {
|
|
1410
|
+
modelId
|
|
1411
|
+
} : {}),
|
|
1412
|
+
...(modelConfiguration !== undefined ? {
|
|
1413
|
+
modelConfiguration
|
|
1414
|
+
} : {}),
|
|
1415
|
+
...(agent ? {
|
|
1416
|
+
agent
|
|
1417
|
+
} : {}),
|
|
1418
|
+
...(( Object.keys(config)).length > 0 ? {
|
|
1419
|
+
config
|
|
1420
|
+
} : {})
|
|
1421
|
+
};
|
|
1422
|
+
return {
|
|
1423
|
+
sessionTemplate,
|
|
1424
|
+
modelId,
|
|
1425
|
+
mode,
|
|
1426
|
+
permissionLevel
|
|
1427
|
+
};
|
|
1428
|
+
}
|
|
1429
|
+
createQuickChat(_sessionTypeId, _options) {
|
|
1430
|
+
throw ( new Error("CopilotChatSessionsProvider does not support quick chats"));
|
|
1431
|
+
}
|
|
1432
|
+
_defaultPermissionLevel() {
|
|
1433
|
+
const policyRestricted = this.configurationService.inspect(ChatConfiguration.GlobalAutoApprove).policyValue === false;
|
|
1434
|
+
if (policyRestricted) {
|
|
1435
|
+
return ChatPermissionLevel.Default;
|
|
1436
|
+
}
|
|
1437
|
+
const level = this.configurationService.getValue(ChatConfiguration.DefaultPermissionLevel);
|
|
1438
|
+
return isChatPermissionLevel(level) ? level : ChatPermissionLevel.Default;
|
|
1439
|
+
}
|
|
1440
|
+
_applyAutomationSessionConfiguration(session, configuration) {
|
|
1441
|
+
if (!configuration) {
|
|
1442
|
+
return;
|
|
1443
|
+
}
|
|
1444
|
+
const template = configuration.sessionTemplate;
|
|
1445
|
+
if (template?.agent && session instanceof RemoteNewSession) {
|
|
1446
|
+
throw ( new Error(( localize(
|
|
1447
|
+
4220,
|
|
1448
|
+
"This provider does not support custom agents in Automation session templates."
|
|
1449
|
+
))));
|
|
1450
|
+
}
|
|
1451
|
+
if (template?.agent) {
|
|
1452
|
+
try {
|
|
1453
|
+
( URI.parse(template.agent.uri, true));
|
|
1454
|
+
} catch (error) {
|
|
1455
|
+
throw ( new Error(( localize(4221, "The Automation's selected agent must have an absolute URI.")), {
|
|
1456
|
+
cause: error
|
|
1457
|
+
}));
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
const modelId = template?.modelId ?? configuration.modelId;
|
|
1461
|
+
if (modelId) {
|
|
1462
|
+
session.setModelId(modelId, ChatModelSource.Chosen);
|
|
1463
|
+
}
|
|
1464
|
+
const mode = template?.agent?.uri ?? template?.config?.[SessionConfigKey.Mode] ?? configuration.mode;
|
|
1465
|
+
if (typeof mode === "string") {
|
|
1466
|
+
const restored = this._setSessionMode(session, mode);
|
|
1467
|
+
if (!restored && session instanceof CopilotCLISession) {
|
|
1468
|
+
session.setModeById(mode, ChatModeKind.Agent);
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
const permissionLevel = template?.config?.[SessionConfigKey.AutoApprove] ?? configuration.permissionLevel;
|
|
1472
|
+
if (!(session instanceof RemoteNewSession) && isChatPermissionLevel(permissionLevel)) {
|
|
1473
|
+
session.setPermissionLevel(permissionLevel);
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
get onDidChangeModels() {
|
|
1477
|
+
return Event.signal(Event.any(
|
|
1478
|
+
this.languageModelsService.onDidChangeLanguageModels,
|
|
1479
|
+
this.chatSessionsService.onDidChangeOptionGroups
|
|
1480
|
+
));
|
|
1481
|
+
}
|
|
1482
|
+
getModelsSnapshot(sessionId, desiredModelId) {
|
|
1483
|
+
const session = this.getSession(sessionId);
|
|
1484
|
+
if (session instanceof RemoteNewSession) {
|
|
1485
|
+
const {
|
|
1486
|
+
modelOption,
|
|
1487
|
+
isResolved
|
|
1488
|
+
} = session.getModelOptionsSnapshot();
|
|
1489
|
+
const models = modelOption?.group.items.map(item => this._toSyntheticModel(item)) ?? [];
|
|
1490
|
+
return {
|
|
1491
|
+
models,
|
|
1492
|
+
desiredModelResolution: resolveModelIdentifier(models, desiredModelId, isResolved),
|
|
1493
|
+
modelTarget: session.sessionType
|
|
1494
|
+
};
|
|
1495
|
+
}
|
|
1496
|
+
const sessionType = session?.sessionType;
|
|
1497
|
+
if (!sessionType) {
|
|
1498
|
+
return {
|
|
1499
|
+
models: [],
|
|
1500
|
+
desiredModelResolution: resolveModelIdentifier([], desiredModelId, false),
|
|
1501
|
+
modelTarget: undefined
|
|
1502
|
+
};
|
|
1503
|
+
}
|
|
1504
|
+
const allModels = getRegisteredLanguageModels(this.languageModelsService);
|
|
1505
|
+
const models = allModels.filter(model => model.metadata.targetChatSessionType === sessionType);
|
|
1506
|
+
return {
|
|
1507
|
+
models,
|
|
1508
|
+
desiredModelResolution: resolveModelIdentifierFromLanguageModels(models, desiredModelId, this.languageModelsService, allModels),
|
|
1509
|
+
modelTarget: sessionType
|
|
1510
|
+
};
|
|
1511
|
+
}
|
|
1512
|
+
getModelPickerOptions(sessionId) {
|
|
1513
|
+
const sessionType = this.getSession(sessionId)?.sessionType;
|
|
1514
|
+
const showAutoModel = !sessionType || this.chatSessionsService.supportsAutoModelForSessionType(sessionType);
|
|
1515
|
+
return {
|
|
1516
|
+
useGroupedModelPicker: true,
|
|
1517
|
+
showFeatured: true,
|
|
1518
|
+
showUnavailableFeatured: false,
|
|
1519
|
+
showManageModelsAction: false,
|
|
1520
|
+
showAutoModel
|
|
1521
|
+
};
|
|
1522
|
+
}
|
|
1523
|
+
_toSyntheticModel(item) {
|
|
1524
|
+
const modelMetadata = item.modelMetadata;
|
|
1525
|
+
return {
|
|
1526
|
+
identifier: item.id,
|
|
1527
|
+
metadata: {
|
|
1528
|
+
extension: ( new ExtensionIdentifier("")),
|
|
1529
|
+
name: modelMetadata?.name ?? item.name,
|
|
1530
|
+
id: modelMetadata?.id ?? item.id,
|
|
1531
|
+
vendor: modelMetadata?.vendor ?? "",
|
|
1532
|
+
version: modelMetadata?.version ?? "",
|
|
1533
|
+
family: modelMetadata?.family ?? "",
|
|
1534
|
+
tooltip: modelMetadata?.tooltip ?? item.tooltip,
|
|
1535
|
+
pricing: modelMetadata?.pricing,
|
|
1536
|
+
multiplierNumeric: modelMetadata?.multiplierNumeric,
|
|
1537
|
+
inputCost: modelMetadata?.inputCost,
|
|
1538
|
+
outputCost: modelMetadata?.outputCost,
|
|
1539
|
+
cacheCost: modelMetadata?.cacheCost,
|
|
1540
|
+
cacheWriteCost: modelMetadata?.cacheWriteCost,
|
|
1541
|
+
longContextInputCost: modelMetadata?.longContextInputCost,
|
|
1542
|
+
longContextOutputCost: modelMetadata?.longContextOutputCost,
|
|
1543
|
+
longContextCacheCost: modelMetadata?.longContextCacheCost,
|
|
1544
|
+
longContextCacheWriteCost: modelMetadata?.longContextCacheWriteCost,
|
|
1545
|
+
priceCategory: modelMetadata?.priceCategory,
|
|
1546
|
+
promo: modelMetadata?.promo,
|
|
1547
|
+
maxInputTokens: modelMetadata?.maxInputTokens ?? 0,
|
|
1548
|
+
maxOutputTokens: modelMetadata?.maxOutputTokens ?? 0,
|
|
1549
|
+
capabilities: modelMetadata?.capabilities ? {
|
|
1550
|
+
vision: modelMetadata.capabilities.vision,
|
|
1551
|
+
toolCalling: modelMetadata.capabilities.toolCalling
|
|
1552
|
+
} : undefined,
|
|
1553
|
+
isUserSelectable: true,
|
|
1554
|
+
isDefaultForLocation: {}
|
|
1555
|
+
}
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
setModel(sessionId, chatResource, modelId, source) {
|
|
1559
|
+
const newSession = this._newSessions.get(sessionId);
|
|
1560
|
+
if (newSession) {
|
|
1561
|
+
const previousModelId = newSession.modelId.get();
|
|
1562
|
+
if (previousModelId && previousModelId !== modelId) {
|
|
1563
|
+
const resolution = this.getModelsSnapshot(sessionId, previousModelId).desiredModelResolution;
|
|
1564
|
+
if (resolution.kind === "available" && resolution.model.identifier === modelId) {
|
|
1565
|
+
newSession.modelConfiguration.rebindModelConfiguration(previousModelId, modelId);
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
newSession.setModelId(modelId, source);
|
|
1569
|
+
if (newSession instanceof RemoteNewSession) {
|
|
1570
|
+
const {
|
|
1571
|
+
modelOption
|
|
1572
|
+
} = newSession.getModelOptionsSnapshot();
|
|
1573
|
+
const item = modelOption?.group.items.find(i => i.id === modelId);
|
|
1574
|
+
if (item) {
|
|
1575
|
+
newSession.setOptionValue(modelOption.group.id, item);
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
return;
|
|
1579
|
+
}
|
|
1580
|
+
this._ensureSessionCache();
|
|
1581
|
+
const chatSession = this._sessionCache.get(( chatResource.toString())) ?? this._findChatSession(sessionId);
|
|
1582
|
+
chatSession?.setModelId(modelId, source);
|
|
1583
|
+
}
|
|
1584
|
+
setMode(sessionId, modeId) {
|
|
1585
|
+
const newSession = this._newSessions.get(sessionId);
|
|
1586
|
+
if (newSession) {
|
|
1587
|
+
this._setSessionMode(newSession, modeId);
|
|
1588
|
+
return;
|
|
1589
|
+
}
|
|
1590
|
+
this._ensureSessionCache();
|
|
1591
|
+
const session = this._findChatSession(sessionId);
|
|
1592
|
+
if (session) {
|
|
1593
|
+
this._setSessionMode(session, modeId);
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
_setSessionMode(session, modeId) {
|
|
1597
|
+
let mode;
|
|
1598
|
+
switch (modeId) {
|
|
1599
|
+
case ChatModeKind.Agent:
|
|
1600
|
+
mode = ChatMode.Agent;
|
|
1601
|
+
break;
|
|
1602
|
+
case ChatModeKind.Edit:
|
|
1603
|
+
mode = ChatMode.Edit;
|
|
1604
|
+
break;
|
|
1605
|
+
case ChatModeKind.Ask:
|
|
1606
|
+
mode = ChatMode.Ask;
|
|
1607
|
+
break;
|
|
1608
|
+
default:
|
|
1609
|
+
{
|
|
1610
|
+
const modes = this.chatModeService.createModes(session.resource);
|
|
1611
|
+
try {
|
|
1612
|
+
mode = this._findSessionMode(session, modes, modeId);
|
|
1613
|
+
} finally {
|
|
1614
|
+
modes.dispose();
|
|
1615
|
+
}
|
|
1616
|
+
break;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
if (mode) {
|
|
1620
|
+
session.setMode(mode);
|
|
1621
|
+
return true;
|
|
1622
|
+
}
|
|
1623
|
+
return false;
|
|
1624
|
+
}
|
|
1625
|
+
_findSessionMode(session, modes, modeId) {
|
|
1626
|
+
const initialAgent = session.initialAutomationSessionConfiguration?.sessionTemplate?.agent;
|
|
1627
|
+
return initialAgent?.uri === modeId ? modes.custom.find(mode => isEqual(mode.uri?.get(), ( URI.parse(initialAgent.uri)))) : modes.findModeById(modeId) ?? modes.findModeByName(modeId);
|
|
1628
|
+
}
|
|
1629
|
+
async _resolveAutomationSessionMode(session) {
|
|
1630
|
+
const deadline = Date.now() + CopilotChatSessionsProvider_1.AUTOMATION_AGENT_RESOLUTION_TIMEOUT_MS;
|
|
1631
|
+
while (true) {
|
|
1632
|
+
const modeId = session.mode.get()?.id;
|
|
1633
|
+
if (!modeId || modeId === ChatModeKind.Agent || modeId === ChatModeKind.Ask || modeId === ChatModeKind.Edit) {
|
|
1634
|
+
return;
|
|
1635
|
+
}
|
|
1636
|
+
const selectedMode = session.chatMode;
|
|
1637
|
+
const store = ( new DisposableStore());
|
|
1638
|
+
const cancellation = store.add(( new CancellationTokenSource(session.cancellationToken)));
|
|
1639
|
+
try {
|
|
1640
|
+
const modes = store.add(this.chatModeService.createModes(session.resource));
|
|
1641
|
+
const remaining = deadline - Date.now();
|
|
1642
|
+
const resolved = remaining > 0 && (await raceTimeout(
|
|
1643
|
+
raceCancellationError(modes.waitForPendingUpdates().then(() => true), cancellation.token),
|
|
1644
|
+
remaining
|
|
1645
|
+
));
|
|
1646
|
+
if (!resolved) {
|
|
1647
|
+
throw ( new Error(( localize(
|
|
1648
|
+
4222,
|
|
1649
|
+
"Timed out resolving the Automation's custom agent. Check the provider connection and try again."
|
|
1650
|
+
))));
|
|
1651
|
+
}
|
|
1652
|
+
if (this._newSessions.get(session.sessionId) !== session) {
|
|
1653
|
+
throw ( new CancellationError());
|
|
1654
|
+
}
|
|
1655
|
+
if (session.mode.get()?.id !== modeId || session.chatMode !== selectedMode) {
|
|
1656
|
+
continue;
|
|
1657
|
+
}
|
|
1658
|
+
const mode = this._findSessionMode(session, modes, modeId);
|
|
1659
|
+
if (!mode) {
|
|
1660
|
+
throw ( new Error(( localize(
|
|
1661
|
+
4223,
|
|
1662
|
+
"The Automation's selected agent '{0}' is unavailable. Choose another agent or restore it before running the Automation.",
|
|
1663
|
+
modeId
|
|
1664
|
+
))));
|
|
1665
|
+
}
|
|
1666
|
+
session.setMode(mode);
|
|
1667
|
+
return;
|
|
1668
|
+
} finally {
|
|
1669
|
+
cancellation.cancel();
|
|
1670
|
+
store.dispose();
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
setPermissionLevel(sessionId, level) {
|
|
1675
|
+
const newSession = this._newSessions.get(sessionId);
|
|
1676
|
+
if (newSession) {
|
|
1677
|
+
if (isChatPermissionLevel(level)) {
|
|
1678
|
+
newSession.setPermissionLevel(level);
|
|
1679
|
+
}
|
|
1680
|
+
return;
|
|
1681
|
+
}
|
|
1682
|
+
this._ensureSessionCache();
|
|
1683
|
+
const session = this._findChatSession(sessionId);
|
|
1684
|
+
if (session && isChatPermissionLevel(level)) {
|
|
1685
|
+
session.setPermissionLevel(level);
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
async setIsolationMode(sessionId, mode) {
|
|
1689
|
+
if (mode !== "worktree" && mode !== "workspace") {
|
|
1690
|
+
return;
|
|
1691
|
+
}
|
|
1692
|
+
const newSession = this._newSessions.get(sessionId);
|
|
1693
|
+
if (newSession) {
|
|
1694
|
+
newSession.setIsolationMode(mode);
|
|
1695
|
+
return;
|
|
1696
|
+
}
|
|
1697
|
+
this._ensureSessionCache();
|
|
1698
|
+
this._findChatSession(sessionId)?.setIsolationMode(mode);
|
|
1699
|
+
}
|
|
1700
|
+
async setBranch(sessionId, branch) {
|
|
1701
|
+
const newSession = this._newSessions.get(sessionId);
|
|
1702
|
+
if (newSession) {
|
|
1703
|
+
newSession.setBranch(branch);
|
|
1704
|
+
return;
|
|
1705
|
+
}
|
|
1706
|
+
this._ensureSessionCache();
|
|
1707
|
+
this._findChatSession(sessionId)?.setBranch(branch);
|
|
1708
|
+
}
|
|
1709
|
+
async archiveSession(sessionId) {
|
|
1710
|
+
const chatSession = this._findChatSession(sessionId);
|
|
1711
|
+
if (chatSession && isNewSession(chatSession)) {
|
|
1712
|
+
chatSession.setArchived(true);
|
|
1713
|
+
this._onDidChangeSessions.fire({
|
|
1714
|
+
added: [],
|
|
1715
|
+
removed: [],
|
|
1716
|
+
changed: [this._chatToSession(chatSession)]
|
|
1717
|
+
});
|
|
1718
|
+
return;
|
|
1719
|
+
}
|
|
1720
|
+
const agentSession = this._findAgentSession(sessionId);
|
|
1721
|
+
if (agentSession) {
|
|
1722
|
+
agentSession.setArchived(true);
|
|
1723
|
+
}
|
|
1724
|
+
}
|
|
1725
|
+
async unarchiveSession(sessionId) {
|
|
1726
|
+
const chatSession = this._findChatSession(sessionId);
|
|
1727
|
+
if (chatSession && isNewSession(chatSession)) {
|
|
1728
|
+
chatSession.setArchived(false);
|
|
1729
|
+
this._onDidChangeSessions.fire({
|
|
1730
|
+
added: [],
|
|
1731
|
+
removed: [],
|
|
1732
|
+
changed: [this._chatToSession(chatSession)]
|
|
1733
|
+
});
|
|
1734
|
+
return;
|
|
1735
|
+
}
|
|
1736
|
+
const agentSession = this._findAgentSession(sessionId);
|
|
1737
|
+
if (agentSession) {
|
|
1738
|
+
agentSession.setArchived(false);
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
async setSessionReadState(sessionId, isRead) {
|
|
1742
|
+
const chatIds = this._getChatIdsInGroup(sessionId);
|
|
1743
|
+
const targetIds = chatIds.length > 0 ? chatIds : [sessionId];
|
|
1744
|
+
for (const chatId of targetIds) {
|
|
1745
|
+
const agentSession = this._findAgentSession(chatId);
|
|
1746
|
+
if (agentSession && agentSession.isRead() !== isRead) {
|
|
1747
|
+
agentSession.setRead(isRead);
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
async deleteSession(sessionId) {
|
|
1752
|
+
const chatIds = this._getChatIdsInGroup(sessionId);
|
|
1753
|
+
const allChatIds = ( new Set([sessionId, ...chatIds]));
|
|
1754
|
+
const agentSessions = [];
|
|
1755
|
+
for (const chatId of allChatIds) {
|
|
1756
|
+
const agentSession = this._findAgentSession(chatId);
|
|
1757
|
+
if (agentSession) {
|
|
1758
|
+
agentSessions.push(agentSession);
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
if (agentSessions.length === 0) {
|
|
1762
|
+
this._cleanupTempSession(sessionId);
|
|
1763
|
+
return;
|
|
1764
|
+
}
|
|
1765
|
+
await this._deleteAgentSessions(agentSessions);
|
|
1766
|
+
this._sessionGroupCache.delete(sessionId);
|
|
1767
|
+
this._refreshSessionCache();
|
|
1768
|
+
}
|
|
1769
|
+
async deleteSessions(sessionIds) {
|
|
1770
|
+
for (const sessionId of sessionIds) {
|
|
1771
|
+
await this.deleteSession(sessionId);
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
async renameChat(sessionId, chatUri, title) {
|
|
1775
|
+
const agentSession = this.agentSessionsService.getSession(chatUri);
|
|
1776
|
+
if (agentSession?.providerType === CopilotCLISessionType.id) {
|
|
1777
|
+
await this.commandService.executeCommand("github.copilot.cli.sessions.setTitle", {
|
|
1778
|
+
resource: chatUri
|
|
1779
|
+
}, title);
|
|
1780
|
+
return;
|
|
1781
|
+
}
|
|
1782
|
+
throw ( new Error("Renaming is not supported for this session type"));
|
|
1783
|
+
}
|
|
1784
|
+
async renameSession(sessionId, title) {
|
|
1785
|
+
const session = this._findSession(sessionId);
|
|
1786
|
+
if (session) {
|
|
1787
|
+
await this.renameChat(sessionId, session.mainChat.get().resource, title);
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
async deleteChat(sessionId, chatUri, options) {
|
|
1791
|
+
const session = this._findSession(sessionId);
|
|
1792
|
+
if (!session?.capabilities.get().supportsMultipleChats) {
|
|
1793
|
+
throw ( new Error("Deleting individual chats is not supported when multi-chat is disabled"));
|
|
1794
|
+
}
|
|
1795
|
+
const chatIds = this._getChatIdsInGroup(sessionId);
|
|
1796
|
+
const chatId = chatIds.find(id => {
|
|
1797
|
+
const chat = this._sessionCache.get(this._localIdFromchatId(id));
|
|
1798
|
+
return chat && ( chat.resource.toString()) === ( chatUri.toString());
|
|
1799
|
+
});
|
|
1800
|
+
if (!chatId) {
|
|
1801
|
+
return false;
|
|
1802
|
+
}
|
|
1803
|
+
if (chatIds.length <= 1) {
|
|
1804
|
+
await this.deleteSession(sessionId);
|
|
1805
|
+
return true;
|
|
1806
|
+
}
|
|
1807
|
+
const agentSession = this._findAgentSession(chatId);
|
|
1808
|
+
if (agentSession) {
|
|
1809
|
+
if (!options?.skipConfirmation) {
|
|
1810
|
+
const confirmed = await this.dialogService.confirm({
|
|
1811
|
+
message: ( localize(4224, "Are you sure you want to delete this chat?")),
|
|
1812
|
+
detail: ( localize(4225, "This action cannot be undone.")),
|
|
1813
|
+
primaryButton: ( localize(4226, "Delete"))
|
|
1814
|
+
});
|
|
1815
|
+
if (!confirmed.confirmed) {
|
|
1816
|
+
return false;
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
await this._deleteAgentSessions([agentSession]);
|
|
1820
|
+
} else {
|
|
1821
|
+
const chat = this._findChatSession(chatId);
|
|
1822
|
+
if (chat) {
|
|
1823
|
+
const key = ( chat.resource.toString());
|
|
1824
|
+
this._sessionCache.delete(key);
|
|
1825
|
+
this._invalidateGroupingCaches();
|
|
1826
|
+
if (( this._newSessions.has(chatId))) {
|
|
1827
|
+
this._newSessions.deleteAndDispose(chatId);
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1830
|
+
this._sessionGroupCache.delete(sessionId);
|
|
1831
|
+
this._onDidGroupMembershipChange.fire({
|
|
1832
|
+
sessionId
|
|
1833
|
+
});
|
|
1834
|
+
const remainingChatIds = this._getChatIdsInGroup(sessionId);
|
|
1835
|
+
const primaryChatId = remainingChatIds[0];
|
|
1836
|
+
const primaryChat = primaryChatId ? this._sessionCache.get(this._localIdFromchatId(primaryChatId)) : undefined;
|
|
1837
|
+
if (primaryChat) {
|
|
1838
|
+
this._onDidChangeSessions.fire({
|
|
1839
|
+
added: [],
|
|
1840
|
+
removed: [],
|
|
1841
|
+
changed: [this._chatToSession(primaryChat)]
|
|
1842
|
+
});
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
return true;
|
|
1846
|
+
}
|
|
1847
|
+
async _deleteAgentSessions(agentSessions) {
|
|
1848
|
+
const cliSessionItems = [];
|
|
1849
|
+
for (const agentSession of agentSessions) {
|
|
1850
|
+
if (agentSession.providerType === CopilotCLISessionType.id) {
|
|
1851
|
+
cliSessionItems.push({
|
|
1852
|
+
resource: agentSession.resource,
|
|
1853
|
+
label: agentSession.label
|
|
1854
|
+
});
|
|
1855
|
+
} else {
|
|
1856
|
+
await this.chatService.removeHistoryEntry(agentSession.resource);
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1859
|
+
if (cliSessionItems.length > 0) {
|
|
1860
|
+
await this.commandService.executeCommand("agents.github.copilot.cli.deleteSessions", cliSessionItems, {
|
|
1861
|
+
skipConfirmation: true
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
async forkChat(sessionId, _sourceChat, _turnId) {
|
|
1866
|
+
throw ( new Error(`Session '${sessionId}' does not support forking into a chat`));
|
|
1867
|
+
}
|
|
1868
|
+
async createSideChat(sessionId, _sourceChat, _turnId, _selection) {
|
|
1869
|
+
throw ( new Error(`Session '${sessionId}' does not support side chats`));
|
|
1870
|
+
}
|
|
1871
|
+
async createNewChat(sessionId, _prompt) {
|
|
1872
|
+
const currentNewSession = this._newSessions.get(sessionId);
|
|
1873
|
+
if (currentNewSession) {
|
|
1874
|
+
const session = currentNewSession;
|
|
1875
|
+
(await this._createChatSession(session.resource, session)).dispose();
|
|
1876
|
+
const newChat = this._toChat(session);
|
|
1877
|
+
session.mainChat.set(newChat, undefined);
|
|
1878
|
+
return newChat;
|
|
1879
|
+
}
|
|
1880
|
+
if (!this._isMultiChatEnabled()) {
|
|
1881
|
+
throw ( new Error(
|
|
1882
|
+
`[CopilotChatSessionsProvider] Session '${sessionId}' does not support multiple chats`
|
|
1883
|
+
));
|
|
1884
|
+
}
|
|
1885
|
+
return this._createNewSubsequentChat(sessionId);
|
|
1886
|
+
}
|
|
1887
|
+
async _createNewSubsequentChat(sessionId) {
|
|
1888
|
+
const chatIds = this._getChatIdsInGroup(sessionId);
|
|
1889
|
+
const firstChatId = chatIds[0] ?? sessionId;
|
|
1890
|
+
const chat = this._sessionCache.get(this._localIdFromchatId(firstChatId));
|
|
1891
|
+
if (!chat) {
|
|
1892
|
+
throw ( new Error(`Session '${sessionId}' not found`));
|
|
1893
|
+
}
|
|
1894
|
+
if (chat.sessionType !== CopilotCLISessionType.id) {
|
|
1895
|
+
throw ( new Error("Multiple chats per session is only supported for Copilot CLI sessions"));
|
|
1896
|
+
}
|
|
1897
|
+
const workspace = chat.workspace.get();
|
|
1898
|
+
if (!workspace) {
|
|
1899
|
+
throw ( new Error("Chat session has no associated workspace"));
|
|
1900
|
+
}
|
|
1901
|
+
const folder = workspace.folders[0];
|
|
1902
|
+
if (!folder) {
|
|
1903
|
+
throw ( new Error("Workspace has no folder"));
|
|
1904
|
+
}
|
|
1905
|
+
const newWorkspace = this.resolveWorkspace(folder.workingDirectory);
|
|
1906
|
+
if (!newWorkspace) {
|
|
1907
|
+
throw ( new Error(`Cannot resolve workspace for working directory URI: ${( folder.workingDirectory.toString())}`));
|
|
1908
|
+
}
|
|
1909
|
+
const resource = ( URI.from({
|
|
1910
|
+
scheme: AgentSessionProviders.Background,
|
|
1911
|
+
path: `/untitled-${generateUuid()}`
|
|
1912
|
+
}));
|
|
1913
|
+
const session = this.instantiationService.createInstance(CopilotCLISession, resource, newWorkspace, this.id, undefined);
|
|
1914
|
+
session.setModelId(chat.modelId.get(), ChatModelSource.CarriedOver);
|
|
1915
|
+
session.setIsolationMode("workspace");
|
|
1916
|
+
session.setOption(PARENT_SESSION_OPTION_ID, chat.resource.path.slice(1));
|
|
1917
|
+
session.setPermissionLevel(this._defaultPermissionLevel());
|
|
1918
|
+
session.setTitle(( localize(4227, "New Chat")));
|
|
1919
|
+
this._newSessions.set(session.sessionId, session);
|
|
1920
|
+
(await this._createChatSession(session.resource, session)).dispose();
|
|
1921
|
+
this._sessionCache.set(( session.resource.toString()), session);
|
|
1922
|
+
this._invalidateGroupingCaches();
|
|
1923
|
+
this._sessionGroupCache.delete(sessionId);
|
|
1924
|
+
this._onDidGroupMembershipChange.fire({
|
|
1925
|
+
sessionId
|
|
1926
|
+
});
|
|
1927
|
+
this._onDidChangeSessions.fire({
|
|
1928
|
+
added: [],
|
|
1929
|
+
removed: [],
|
|
1930
|
+
changed: [this._chatToSession(session)]
|
|
1931
|
+
});
|
|
1932
|
+
return this._toChat(session);
|
|
1933
|
+
}
|
|
1934
|
+
_getCloudSandboxContribution() {
|
|
1935
|
+
return getWorkbenchContribution(CloudSandboxAgentHostContribution.ID);
|
|
1936
|
+
}
|
|
1937
|
+
get _sandboxModelWaitMs() {
|
|
1938
|
+
return CopilotChatSessionsProvider_1.SANDBOX_MODEL_WAIT_MS;
|
|
1939
|
+
}
|
|
1940
|
+
async _sendFirstChatToSandbox(session, repoNwo, options) {
|
|
1941
|
+
session.setTitle(
|
|
1942
|
+
(options.title || options.query.split("\n")[0]).substring(0, 100) || ( localize(4228, "New Session"))
|
|
1943
|
+
);
|
|
1944
|
+
session.setStatus(SessionStatus.InProgress);
|
|
1945
|
+
this._sessionCache.set(( session.resource.toString()), session);
|
|
1946
|
+
this._invalidateGroupingCaches();
|
|
1947
|
+
const placeholder = this._chatToSession(session);
|
|
1948
|
+
this._onDidChangeSessions.fire({
|
|
1949
|
+
added: [placeholder],
|
|
1950
|
+
removed: [],
|
|
1951
|
+
changed: []
|
|
1952
|
+
});
|
|
1953
|
+
let provisioned;
|
|
1954
|
+
const selectedModel = this._selectedCloudModel(session);
|
|
1955
|
+
try {
|
|
1956
|
+
provisioned = await this._getCloudSandboxContribution().provisionSession({
|
|
1957
|
+
repoNwo,
|
|
1958
|
+
prompt: options.query
|
|
1959
|
+
}, CancellationToken.None);
|
|
1960
|
+
const chat = provisioned.session.mainChat.get();
|
|
1961
|
+
await this._carryModelToSandbox(provisioned, chat.resource, selectedModel);
|
|
1962
|
+
const committed = await provisioned.provider.sendRequest(provisioned.session.sessionId, chat.resource, options);
|
|
1963
|
+
this._publishSandboxSession(provisioned, {
|
|
1964
|
+
announce: false
|
|
1965
|
+
});
|
|
1966
|
+
this._retirePlaceholder(session, placeholder, committed);
|
|
1967
|
+
return committed;
|
|
1968
|
+
} catch (error) {
|
|
1969
|
+
this.logService.error(
|
|
1970
|
+
`[CopilotChatSessionsProvider] Failed to start cloud sandbox session for ${repoNwo}:`,
|
|
1971
|
+
error
|
|
1972
|
+
);
|
|
1973
|
+
if (provisioned) {
|
|
1974
|
+
this._publishSandboxSession(provisioned);
|
|
1975
|
+
}
|
|
1976
|
+
this._sessionCache.delete(( session.resource.toString()));
|
|
1977
|
+
this._invalidateGroupingCaches();
|
|
1978
|
+
this._sessionGroupCache.delete(session.sessionId);
|
|
1979
|
+
this._clearCurrentNewSessionIfMatch(session, true);
|
|
1980
|
+
this._onDidChangeSessions.fire({
|
|
1981
|
+
added: [],
|
|
1982
|
+
removed: [placeholder],
|
|
1983
|
+
changed: []
|
|
1984
|
+
});
|
|
1985
|
+
session.dispose();
|
|
1986
|
+
throw error;
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
_publishSandboxSession(provisioned, options) {
|
|
1990
|
+
provisioned.provider.publishWithheldSession(AgentSession.id(provisioned.session.resource), options);
|
|
1991
|
+
}
|
|
1992
|
+
_selectedCloudModel(session) {
|
|
1993
|
+
const selectedModelId = session.selectedModelId;
|
|
1994
|
+
if (!selectedModelId) {
|
|
1995
|
+
return undefined;
|
|
1996
|
+
}
|
|
1997
|
+
const {
|
|
1998
|
+
modelOption
|
|
1999
|
+
} = session.getModelOptionsSnapshot();
|
|
2000
|
+
const item = modelOption?.group.items.find(i => i.id === selectedModelId);
|
|
2001
|
+
const rawModelId = item?.modelMetadata?.id ?? item?.id ?? selectedModelId;
|
|
2002
|
+
return {
|
|
2003
|
+
rawModelId,
|
|
2004
|
+
label: item?.modelMetadata?.name ?? item?.name ?? rawModelId
|
|
2005
|
+
};
|
|
2006
|
+
}
|
|
2007
|
+
async _carryModelToSandbox(provisioned, chatResource, selected) {
|
|
2008
|
+
if (!selected) {
|
|
2009
|
+
return;
|
|
2010
|
+
}
|
|
2011
|
+
const {
|
|
2012
|
+
rawModelId,
|
|
2013
|
+
label
|
|
2014
|
+
} = selected;
|
|
2015
|
+
const sessionId = provisioned.session.sessionId;
|
|
2016
|
+
const provider = provisioned.provider;
|
|
2017
|
+
const modelTarget = provider.getModelsSnapshot(sessionId).modelTarget;
|
|
2018
|
+
if (!modelTarget) {
|
|
2019
|
+
this.logService.info(
|
|
2020
|
+
`[CopilotChatSessionsProvider] Sandbox session ${sessionId} reported no model target; letting the agent host choose.`
|
|
2021
|
+
);
|
|
2022
|
+
this._notifySandboxModelNotApplied(label);
|
|
2023
|
+
return;
|
|
2024
|
+
}
|
|
2025
|
+
const desiredModelId = `${modelTarget}:${rawModelId}`;
|
|
2026
|
+
const store = ( new DisposableStore());
|
|
2027
|
+
try {
|
|
2028
|
+
const deadline = Date.now() + this._sandboxModelWaitMs;
|
|
2029
|
+
for (; ; ) {
|
|
2030
|
+
const resolution = provider.getModelsSnapshot(sessionId, desiredModelId).desiredModelResolution;
|
|
2031
|
+
if (resolution.kind === "available") {
|
|
2032
|
+
provider.setModel(
|
|
2033
|
+
sessionId,
|
|
2034
|
+
chatResource,
|
|
2035
|
+
resolution.model.identifier,
|
|
2036
|
+
ChatModelSource.CarriedOver
|
|
2037
|
+
);
|
|
2038
|
+
return;
|
|
2039
|
+
}
|
|
2040
|
+
if (resolution.kind !== "pending") {
|
|
2041
|
+
this.logService.info(
|
|
2042
|
+
`[CopilotChatSessionsProvider] Sandbox session ${sessionId} does not advertise model '${rawModelId}'; letting the agent host choose.`
|
|
2043
|
+
);
|
|
2044
|
+
this._notifySandboxModelNotApplied(label);
|
|
2045
|
+
return;
|
|
2046
|
+
}
|
|
2047
|
+
const remaining = deadline - Date.now();
|
|
2048
|
+
const published = remaining > 0 ? await raceTimeout(
|
|
2049
|
+
Event.toPromise(provider.onDidChangeModels, store).then(() => true),
|
|
2050
|
+
remaining
|
|
2051
|
+
) : undefined;
|
|
2052
|
+
if (!published) {
|
|
2053
|
+
this.logService.warn(
|
|
2054
|
+
`[CopilotChatSessionsProvider] Sandbox session ${sessionId} had not published model '${rawModelId}' in time; letting the agent host choose.`
|
|
2055
|
+
);
|
|
2056
|
+
this._notifySandboxModelNotApplied(label);
|
|
2057
|
+
return;
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
} finally {
|
|
2061
|
+
store.dispose();
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
_notifySandboxModelNotApplied(label) {
|
|
2065
|
+
this.notificationService.warn(( localize(
|
|
2066
|
+
4229,
|
|
2067
|
+
"Couldn't use {0} for this session. The agent's default model will be used instead.",
|
|
2068
|
+
label
|
|
2069
|
+
)));
|
|
2070
|
+
}
|
|
2071
|
+
_retirePlaceholder(session, placeholder, committed) {
|
|
2072
|
+
this._sessionCache.delete(( session.resource.toString()));
|
|
2073
|
+
this._invalidateGroupingCaches();
|
|
2074
|
+
this._sessionGroupCache.delete(session.sessionId);
|
|
2075
|
+
this._clearCurrentNewSessionIfMatch(session);
|
|
2076
|
+
this._onDidReplaceSession.fire({
|
|
2077
|
+
from: placeholder,
|
|
2078
|
+
to: committed
|
|
2079
|
+
});
|
|
2080
|
+
}
|
|
2081
|
+
async sendRequest(sessionId, chatResource, options) {
|
|
2082
|
+
const newSession = this._newSessions.get(sessionId);
|
|
2083
|
+
if (newSession) {
|
|
2084
|
+
if (!this.uriIdentityService.extUri.isEqual(newSession.mainChat.get().resource, chatResource)) {
|
|
2085
|
+
throw ( new Error("Chat resource does not match the main chat of the current new session"));
|
|
2086
|
+
}
|
|
2087
|
+
if (newSession instanceof RemoteNewSession && newSession.useSandbox.get() && newSession.repoNwo && isCloudSandboxEnabled(this.configurationService)) {
|
|
2088
|
+
return this._sendFirstChatToSandbox(newSession, newSession.repoNwo, options);
|
|
2089
|
+
}
|
|
2090
|
+
return this._sendFirstChat(newSession, chatResource, options);
|
|
2091
|
+
}
|
|
2092
|
+
const session = this._findSession(sessionId);
|
|
2093
|
+
if (!session) {
|
|
2094
|
+
throw ( new Error(`Session '${sessionId}' not found`));
|
|
2095
|
+
}
|
|
2096
|
+
if (!session.capabilities.get().supportsMultipleChats) {
|
|
2097
|
+
throw ( new Error("Multiple chats per session is not supported"));
|
|
2098
|
+
}
|
|
2099
|
+
if (!( session.chats.get().some(
|
|
2100
|
+
chat => this.uriIdentityService.extUri.isEqual(chat.resource, chatResource)
|
|
2101
|
+
))) {
|
|
2102
|
+
throw ( new Error(`Chat '${( chatResource.toString())}' does not belong to session '${sessionId}'`));
|
|
2103
|
+
}
|
|
2104
|
+
const key = ( chatResource.toString());
|
|
2105
|
+
const chatSession = this._sessionCache.get(key);
|
|
2106
|
+
if (!chatSession || !(chatSession instanceof CopilotCLISession)) {
|
|
2107
|
+
throw ( new Error(`Chat '${( chatResource.toString())}' not found in session '${sessionId}'`));
|
|
2108
|
+
}
|
|
2109
|
+
return this._sendExistingChat(sessionId, chatSession, options);
|
|
2110
|
+
}
|
|
2111
|
+
async _sendFirstChat(session, chatResource, options) {
|
|
2112
|
+
if (session instanceof CopilotCLISession && session.initialAutomationSessionConfiguration) {
|
|
2113
|
+
await this._resolveAutomationSessionMode(session);
|
|
2114
|
+
}
|
|
2115
|
+
const {
|
|
2116
|
+
query,
|
|
2117
|
+
attachedContext
|
|
2118
|
+
} = options;
|
|
2119
|
+
session.setTitle(
|
|
2120
|
+
(options.title || query.split("\n")[0]).substring(0, 100) || ( localize(4228, "New Session"))
|
|
2121
|
+
);
|
|
2122
|
+
session.setStatus(SessionStatus.InProgress);
|
|
2123
|
+
this._sessionCache.set(( session.resource.toString()), session);
|
|
2124
|
+
this._invalidateGroupingCaches();
|
|
2125
|
+
const newSession = this._chatToSession(session);
|
|
2126
|
+
this._onDidChangeSessions.fire({
|
|
2127
|
+
added: [newSession],
|
|
2128
|
+
removed: [],
|
|
2129
|
+
changed: []
|
|
2130
|
+
});
|
|
2131
|
+
const contribution = this.chatSessionsService.getChatSessionContribution(session.target);
|
|
2132
|
+
const modeKind = session.chatMode?.kind ?? ChatModeKind.Agent;
|
|
2133
|
+
const modeIsBuiltin = session.chatMode ? isBuiltinChatMode(session.chatMode) : true;
|
|
2134
|
+
const modeId = modeIsBuiltin ? modeKind : "custom";
|
|
2135
|
+
const rawModeInstructions = session.chatMode?.modeInstructions?.get();
|
|
2136
|
+
const modeInstructions = rawModeInstructions ? {
|
|
2137
|
+
name: session.chatMode.name.get(),
|
|
2138
|
+
content: rawModeInstructions.content,
|
|
2139
|
+
toolReferences: this.toolsService.toToolReferences(rawModeInstructions.toolReferences),
|
|
2140
|
+
metadata: rawModeInstructions.metadata
|
|
2141
|
+
} : undefined;
|
|
2142
|
+
const permissionLevel = session.permissionLevel.get();
|
|
2143
|
+
const sendOptions = {
|
|
2144
|
+
location: ChatAgentLocation.Chat,
|
|
2145
|
+
userSelectedModelId: session.selectedModelId,
|
|
2146
|
+
userSelectedModelConfiguration: session.modelConfiguration.getModelConfigurationForRequest(session.selectedModelId),
|
|
2147
|
+
modeInfo: {
|
|
2148
|
+
kind: modeKind,
|
|
2149
|
+
isBuiltin: modeIsBuiltin,
|
|
2150
|
+
modeInstructions,
|
|
2151
|
+
telemetryModeId: modeId,
|
|
2152
|
+
applyCodeBlockSuggestionId: undefined,
|
|
2153
|
+
permissionLevel
|
|
2154
|
+
},
|
|
2155
|
+
agentIdSilent: contribution?.type,
|
|
2156
|
+
attachedContext,
|
|
2157
|
+
hideFromTranscript: options.hideFromTranscript,
|
|
2158
|
+
agentHostSessionConfig: session instanceof CopilotCLISession ? session.getAgentHostSessionConfig() : undefined
|
|
2159
|
+
};
|
|
2160
|
+
const ref = await this._updateChatSessionState(chatResource, session, sendOptions.modeInfo?.permissionLevel);
|
|
2161
|
+
this.logService.debug(
|
|
2162
|
+
`[CopilotChatSessionsProvider] Sending first chat for session ${session.sessionId} with options:`,
|
|
2163
|
+
{
|
|
2164
|
+
userSelectedModelId: sendOptions.userSelectedModelId
|
|
2165
|
+
}
|
|
2166
|
+
);
|
|
2167
|
+
try {
|
|
2168
|
+
const result = await this.chatService.sendRequest(chatResource, query, sendOptions);
|
|
2169
|
+
if (result.kind === "rejected") {
|
|
2170
|
+
this._sessionCache.delete(( session.resource.toString()));
|
|
2171
|
+
this._invalidateGroupingCaches();
|
|
2172
|
+
this._sessionGroupCache.delete(session.sessionId);
|
|
2173
|
+
this._clearCurrentNewSessionIfMatch(session, true);
|
|
2174
|
+
this._onDidChangeSessions.fire({
|
|
2175
|
+
added: [],
|
|
2176
|
+
removed: [newSession],
|
|
2177
|
+
changed: []
|
|
2178
|
+
});
|
|
2179
|
+
session.dispose();
|
|
2180
|
+
throw ( new Error(`[DefaultCopilotProvider] sendRequest rejected: ${result.reason}`));
|
|
2181
|
+
}
|
|
2182
|
+
const cts = ( new CancellationTokenSource());
|
|
2183
|
+
const responseCompletePromise = result.kind === "sent" ? result.data.responseCompletePromise : undefined;
|
|
2184
|
+
const responseCreatedPromise = result.kind === "sent" ? result.data.responseCreatedPromise : undefined;
|
|
2185
|
+
responseCreatedPromise?.then(r => {
|
|
2186
|
+
if (r?.isCanceled) {
|
|
2187
|
+
cts.cancel();
|
|
2188
|
+
}
|
|
2189
|
+
});
|
|
2190
|
+
try {
|
|
2191
|
+
const committedResource = await this._waitForCommittedSession(session.resource, responseCompletePromise, responseCreatedPromise, {
|
|
2192
|
+
deferred: session instanceof RemoteNewSession
|
|
2193
|
+
});
|
|
2194
|
+
this._inFlightCommits.add(( committedResource.toString()));
|
|
2195
|
+
try {
|
|
2196
|
+
const committedChat = await this._waitForSessionInCache(committedResource, cts.token);
|
|
2197
|
+
this._sessionCache.delete(( session.resource.toString()));
|
|
2198
|
+
this._clearCurrentNewSessionIfMatch(session);
|
|
2199
|
+
const committedSession = this._chatToSession(committedChat);
|
|
2200
|
+
this._sessionGroupCache.delete(session.sessionId);
|
|
2201
|
+
this._onDidReplaceSession.fire({
|
|
2202
|
+
from: newSession,
|
|
2203
|
+
to: committedSession
|
|
2204
|
+
});
|
|
2205
|
+
return committedSession;
|
|
2206
|
+
} finally {
|
|
2207
|
+
this._inFlightCommits.delete(( committedResource.toString()));
|
|
2208
|
+
}
|
|
2209
|
+
} catch (error) {
|
|
2210
|
+
this._clearCurrentNewSessionIfMatch(session, true);
|
|
2211
|
+
if (error instanceof CancellationError) {
|
|
2212
|
+
session.setStatus(SessionStatus.Completed);
|
|
2213
|
+
this._onDidChangeSessions.fire({
|
|
2214
|
+
added: [],
|
|
2215
|
+
removed: [],
|
|
2216
|
+
changed: [newSession]
|
|
2217
|
+
});
|
|
2218
|
+
return newSession;
|
|
2219
|
+
}
|
|
2220
|
+
this._sessionCache.delete(( session.resource.toString()));
|
|
2221
|
+
this._invalidateGroupingCaches();
|
|
2222
|
+
this._sessionGroupCache.delete(session.sessionId);
|
|
2223
|
+
this._onDidChangeSessions.fire({
|
|
2224
|
+
added: [],
|
|
2225
|
+
removed: [this._chatToSession(session)],
|
|
2226
|
+
changed: []
|
|
2227
|
+
});
|
|
2228
|
+
session.dispose();
|
|
2229
|
+
throw error;
|
|
2230
|
+
} finally {
|
|
2231
|
+
cts.dispose();
|
|
2232
|
+
}
|
|
2233
|
+
} catch (error) {
|
|
2234
|
+
this.logService.error(
|
|
2235
|
+
`[CopilotChatSessionsProvider] Failed to send first chat for session ${session.sessionId}:`,
|
|
2236
|
+
error
|
|
2237
|
+
);
|
|
2238
|
+
throw error;
|
|
2239
|
+
} finally {
|
|
2240
|
+
ref?.dispose();
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
async _createChatSession(resource, session, permissionLevel) {
|
|
2244
|
+
await this.chatSessionsService.getOrCreateChatSession(resource, CancellationToken.None);
|
|
2245
|
+
return this._updateChatSessionState(resource, session, permissionLevel);
|
|
2246
|
+
}
|
|
2247
|
+
async _updateChatSessionState(resource, session, permissionLevel) {
|
|
2248
|
+
const modelRef = await this.chatService.acquireOrLoadSession(resource, ChatAgentLocation.Chat, CancellationToken.None);
|
|
2249
|
+
if (!modelRef) {
|
|
2250
|
+
return Disposable.None;
|
|
2251
|
+
}
|
|
2252
|
+
const model = modelRef.object;
|
|
2253
|
+
if (session.selectedModelId) {
|
|
2254
|
+
const languageModel = this.languageModelsService.lookupLanguageModel(session.selectedModelId);
|
|
2255
|
+
if (languageModel) {
|
|
2256
|
+
model.inputModel.setState({
|
|
2257
|
+
selectedModel: {
|
|
2258
|
+
identifier: session.selectedModelId,
|
|
2259
|
+
metadata: languageModel
|
|
2260
|
+
}
|
|
2261
|
+
});
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
if (session.chatMode) {
|
|
2265
|
+
model.inputModel.setState({
|
|
2266
|
+
mode: {
|
|
2267
|
+
id: session.chatMode.id,
|
|
2268
|
+
kind: session.chatMode.kind
|
|
2269
|
+
}
|
|
2270
|
+
});
|
|
2271
|
+
}
|
|
2272
|
+
if (session.selectedOptions.size > 0) {
|
|
2273
|
+
this.chatSessionsService.updateSessionOptions(resource, session.selectedOptions);
|
|
2274
|
+
}
|
|
2275
|
+
if (permissionLevel) {
|
|
2276
|
+
model.inputModel.setState({
|
|
2277
|
+
permissionLevel
|
|
2278
|
+
});
|
|
2279
|
+
}
|
|
2280
|
+
return modelRef;
|
|
2281
|
+
}
|
|
2282
|
+
async _sendExistingChat(sessionId, newChatSession, options) {
|
|
2283
|
+
newChatSession.setStatus(SessionStatus.InProgress);
|
|
2284
|
+
const key = ( newChatSession.resource.toString());
|
|
2285
|
+
this._sessionGroupCache.delete(sessionId);
|
|
2286
|
+
this._onDidChangeSessions.fire({
|
|
2287
|
+
added: [],
|
|
2288
|
+
removed: [],
|
|
2289
|
+
changed: [this._chatToSession(newChatSession)]
|
|
2290
|
+
});
|
|
2291
|
+
const {
|
|
2292
|
+
query,
|
|
2293
|
+
attachedContext
|
|
2294
|
+
} = options;
|
|
2295
|
+
const contribution = this.chatSessionsService.getChatSessionContribution(newChatSession.target);
|
|
2296
|
+
const sendOptions = {
|
|
2297
|
+
location: ChatAgentLocation.Chat,
|
|
2298
|
+
userSelectedModelId: newChatSession.selectedModelId,
|
|
2299
|
+
modeInfo: {
|
|
2300
|
+
kind: ChatModeKind.Agent,
|
|
2301
|
+
isBuiltin: true,
|
|
2302
|
+
modeInstructions: undefined,
|
|
2303
|
+
telemetryModeId: "agent",
|
|
2304
|
+
applyCodeBlockSuggestionId: undefined,
|
|
2305
|
+
permissionLevel: newChatSession.permissionLevel.get()
|
|
2306
|
+
},
|
|
2307
|
+
agentIdSilent: contribution?.type,
|
|
2308
|
+
attachedContext,
|
|
2309
|
+
hideFromTranscript: options.hideFromTranscript,
|
|
2310
|
+
agentHostSessionConfig: newChatSession.getAgentHostSessionConfig()
|
|
2311
|
+
};
|
|
2312
|
+
const ref = await this._updateChatSessionState(newChatSession.resource, newChatSession);
|
|
2313
|
+
try {
|
|
2314
|
+
const result = await this.chatService.sendRequest(newChatSession.resource, query, sendOptions);
|
|
2315
|
+
if (result.kind === "rejected") {
|
|
2316
|
+
this._sessionCache.delete(key);
|
|
2317
|
+
this._invalidateGroupingCaches();
|
|
2318
|
+
throw ( new Error(`[DefaultCopilotProvider] sendRequest rejected: ${result.reason}`));
|
|
2319
|
+
}
|
|
2320
|
+
const responseCompletePromise = result.kind === "sent" ? result.data.responseCompletePromise : undefined;
|
|
2321
|
+
const responseCreatedPromise = result.kind === "sent" ? result.data.responseCreatedPromise : undefined;
|
|
2322
|
+
try {
|
|
2323
|
+
const committedResource = await this._waitForCommittedSession(newChatSession.resource, responseCompletePromise, responseCreatedPromise);
|
|
2324
|
+
const committedChat = await this._waitForSessionInCache(committedResource);
|
|
2325
|
+
this._sessionCache.delete(key);
|
|
2326
|
+
this._invalidateGroupingCaches();
|
|
2327
|
+
this._clearCurrentNewSessionIfMatch(newChatSession);
|
|
2328
|
+
this._sessionGroupCache.delete(sessionId);
|
|
2329
|
+
this._onDidGroupMembershipChange.fire({
|
|
2330
|
+
sessionId
|
|
2331
|
+
});
|
|
2332
|
+
const updatedSession = this._chatToSession(committedChat);
|
|
2333
|
+
this._onDidChangeSessions.fire({
|
|
2334
|
+
added: [],
|
|
2335
|
+
removed: [],
|
|
2336
|
+
changed: [updatedSession]
|
|
2337
|
+
});
|
|
2338
|
+
return updatedSession;
|
|
2339
|
+
} catch (error) {
|
|
2340
|
+
this._clearCurrentNewSessionIfMatch(newChatSession, true);
|
|
2341
|
+
if (error instanceof CancellationError) {
|
|
2342
|
+
newChatSession.setStatus(SessionStatus.Completed);
|
|
2343
|
+
this._sessionGroupCache.delete(sessionId);
|
|
2344
|
+
const updatedSession = this._chatToSession(newChatSession);
|
|
2345
|
+
this._onDidChangeSessions.fire({
|
|
2346
|
+
added: [],
|
|
2347
|
+
removed: [],
|
|
2348
|
+
changed: [updatedSession]
|
|
2349
|
+
});
|
|
2350
|
+
return updatedSession;
|
|
2351
|
+
}
|
|
2352
|
+
this._sessionCache.delete(key);
|
|
2353
|
+
this._invalidateGroupingCaches();
|
|
2354
|
+
this._sessionGroupCache.delete(sessionId);
|
|
2355
|
+
newChatSession.dispose();
|
|
2356
|
+
const parentChatIds = this._getChatIdsInGroup(sessionId);
|
|
2357
|
+
const parentChatId = parentChatIds[0];
|
|
2358
|
+
const parentChat = parentChatId ? this._sessionCache.get(this._localIdFromchatId(parentChatId)) : undefined;
|
|
2359
|
+
if (parentChat) {
|
|
2360
|
+
this._onDidChangeSessions.fire({
|
|
2361
|
+
added: [],
|
|
2362
|
+
removed: [],
|
|
2363
|
+
changed: [this._chatToSession(parentChat)]
|
|
2364
|
+
});
|
|
2365
|
+
}
|
|
2366
|
+
throw error;
|
|
2367
|
+
}
|
|
2368
|
+
} finally {
|
|
2369
|
+
ref.dispose();
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
async _waitForCommittedSession(untitledResource, responseCompletePromise, responseCreatedPromise, options) {
|
|
2373
|
+
const timeoutMs = options?.deferred ? 5 * 60_000 : 5_000;
|
|
2374
|
+
const disposables = ( new DisposableStore());
|
|
2375
|
+
try {
|
|
2376
|
+
const commitPromise = ( new Promise(resolve => {
|
|
2377
|
+
disposables.add(this.chatSessionsService.onDidCommitSession(e => {
|
|
2378
|
+
if (isEqual(e.original, untitledResource)) {
|
|
2379
|
+
resolve(e.committed);
|
|
2380
|
+
}
|
|
2381
|
+
}));
|
|
2382
|
+
}));
|
|
2383
|
+
if (!options?.deferred && responseCompletePromise) {
|
|
2384
|
+
const committed = await Promise.race([commitPromise.then(uri => ({
|
|
2385
|
+
committed: true,
|
|
2386
|
+
uri
|
|
2387
|
+
})), responseCompletePromise.then(() => ({
|
|
2388
|
+
committed: false
|
|
2389
|
+
}))]);
|
|
2390
|
+
if (committed.committed) {
|
|
2391
|
+
return committed.uri;
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
const candidates = [raceTimeout(commitPromise, timeoutMs).then(uri => uri ? {
|
|
2395
|
+
kind: "commit",
|
|
2396
|
+
uri
|
|
2397
|
+
} : {
|
|
2398
|
+
kind: "timeout"
|
|
2399
|
+
})];
|
|
2400
|
+
if (responseCreatedPromise) {
|
|
2401
|
+
candidates.push(responseCreatedPromise.then(r => r?.isCanceled ? {
|
|
2402
|
+
kind: "cancelled"
|
|
2403
|
+
} : ( new Promise(() => {}))));
|
|
2404
|
+
}
|
|
2405
|
+
const outcome = await Promise.race(candidates);
|
|
2406
|
+
if (outcome.kind === "commit") {
|
|
2407
|
+
return outcome.uri;
|
|
2408
|
+
}
|
|
2409
|
+
if (outcome.kind === "cancelled") {
|
|
2410
|
+
throw ( new CancellationError());
|
|
2411
|
+
}
|
|
2412
|
+
const response = responseCreatedPromise ? await responseCreatedPromise : undefined;
|
|
2413
|
+
if (response?.isCanceled) {
|
|
2414
|
+
throw ( new CancellationError());
|
|
2415
|
+
}
|
|
2416
|
+
throw ( new Error("Timed out waiting for session commit"));
|
|
2417
|
+
} finally {
|
|
2418
|
+
disposables.dispose();
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
async _waitForSessionInCache(resource, token) {
|
|
2422
|
+
const key = ( resource.toString());
|
|
2423
|
+
const existing = this._sessionCache.get(key);
|
|
2424
|
+
if (existing instanceof AgentSessionAdapter) {
|
|
2425
|
+
return existing;
|
|
2426
|
+
}
|
|
2427
|
+
const disposables = ( new DisposableStore());
|
|
2428
|
+
try {
|
|
2429
|
+
const sessionPromise = ( new Promise(resolve => {
|
|
2430
|
+
disposables.add(this.onDidChangeSessions(e => {
|
|
2431
|
+
const cached = this._sessionCache.get(key);
|
|
2432
|
+
if (cached instanceof AgentSessionAdapter) {
|
|
2433
|
+
resolve(cached);
|
|
2434
|
+
}
|
|
2435
|
+
}));
|
|
2436
|
+
}));
|
|
2437
|
+
const result = await raceTimeout(
|
|
2438
|
+
token ? raceCancellationError(sessionPromise, token) : sessionPromise,
|
|
2439
|
+
30_000
|
|
2440
|
+
);
|
|
2441
|
+
if (!result) {
|
|
2442
|
+
throw ( new Error("Timed out waiting for committed session in cache"));
|
|
2443
|
+
}
|
|
2444
|
+
return result;
|
|
2445
|
+
} finally {
|
|
2446
|
+
disposables.dispose();
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
async _browseForRepository() {
|
|
2450
|
+
const allowRepositoryUrl = this._supportsLocalRepositoryActions();
|
|
2451
|
+
const repository = await this.commandService.executeCommand(OPEN_REPO_COMMAND, undefined, {
|
|
2452
|
+
allowRepositoryUrl
|
|
2453
|
+
});
|
|
2454
|
+
if (!repository) {
|
|
2455
|
+
return undefined;
|
|
2456
|
+
}
|
|
2457
|
+
const repoId = getGitHubRepositoryId(repository);
|
|
2458
|
+
if (!repoId) {
|
|
2459
|
+
return allowRepositoryUrl ? this._cloneRepository(repository) : undefined;
|
|
2460
|
+
}
|
|
2461
|
+
const uri = ( URI.from({
|
|
2462
|
+
scheme: GITHUB_REMOTE_FILE_SCHEME,
|
|
2463
|
+
authority: "github",
|
|
2464
|
+
path: `/${repoId}/HEAD`
|
|
2465
|
+
}));
|
|
2466
|
+
const folder = {
|
|
2467
|
+
root: uri,
|
|
2468
|
+
workingDirectory: uri,
|
|
2469
|
+
name: basename(uri),
|
|
2470
|
+
description: undefined,
|
|
2471
|
+
gitRepository: undefined
|
|
2472
|
+
};
|
|
2473
|
+
return {
|
|
2474
|
+
uri: ( URI.parse(`https://github.com/${repoId}`)),
|
|
2475
|
+
label: this._labelFromUri(uri),
|
|
2476
|
+
icon: this._iconFromUri(uri),
|
|
2477
|
+
group: SESSION_WORKSPACE_GROUP_GITHUB,
|
|
2478
|
+
folders: [folder],
|
|
2479
|
+
requiresWorkspaceTrust: false,
|
|
2480
|
+
isVirtualWorkspace: true
|
|
2481
|
+
};
|
|
2482
|
+
}
|
|
2483
|
+
_supportsLocalRepositoryActions() {
|
|
2484
|
+
return !isWeb && (this.pathService.defaultUriScheme === Schemas.file || this.pathService.defaultUriScheme === GITHUB_REMOTE_FILE_SCHEME || this.pathService.defaultUriScheme === SessionType.CopilotCloud);
|
|
2485
|
+
}
|
|
2486
|
+
async _cloneRepository(url) {
|
|
2487
|
+
try {
|
|
2488
|
+
const repositoryPath = await this.commandService.executeCommand("git.clone", url, undefined, {
|
|
2489
|
+
postCloneAction: "none",
|
|
2490
|
+
returnRepositoryPath: true
|
|
2491
|
+
});
|
|
2492
|
+
if (repositoryPath?.endsWith(".code-workspace")) {
|
|
2493
|
+
this.notificationService.error(( localize(
|
|
2494
|
+
4230,
|
|
2495
|
+
"The selected clone is a workspace file. Choose the repository again to select a repository folder."
|
|
2496
|
+
)));
|
|
2497
|
+
return undefined;
|
|
2498
|
+
}
|
|
2499
|
+
return repositoryPath ? this.resolveWorkspace(URI.file(repositoryPath)) : undefined;
|
|
2500
|
+
} catch (error) {
|
|
2501
|
+
if (!isCancellationError(error)) {
|
|
2502
|
+
this.notificationService.error(error);
|
|
2503
|
+
}
|
|
2504
|
+
return undefined;
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
async _browseForGitHubContext(commandId, icon, currentWorkspace) {
|
|
2508
|
+
const repositoryIds = ( new Set());
|
|
2509
|
+
for (const folder of currentWorkspace?.folders ?? []) {
|
|
2510
|
+
const repositoryId = resolveGitHubRepositoryId(folder);
|
|
2511
|
+
if (repositoryId) {
|
|
2512
|
+
repositoryIds.add(repositoryId);
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
const repository = repositoryIds.size === 1 ? ( repositoryIds.values()).next().value : currentWorkspace?.folders.length === 1 && currentWorkspace.folders[0].root.scheme === Schemas.file ? currentWorkspace.folders[0].root : await this.commandService.executeCommand(OPEN_REPO_COMMAND);
|
|
2516
|
+
if (!repository) {
|
|
2517
|
+
return undefined;
|
|
2518
|
+
}
|
|
2519
|
+
const selection = await this.commandService.executeCommand(commandId, repository);
|
|
2520
|
+
if (!selection) {
|
|
2521
|
+
return undefined;
|
|
2522
|
+
}
|
|
2523
|
+
const root = ( URI.from({
|
|
2524
|
+
scheme: GITHUB_REMOTE_FILE_SCHEME,
|
|
2525
|
+
authority: "github",
|
|
2526
|
+
path: `/${selection.repoId}/HEAD`
|
|
2527
|
+
}));
|
|
2528
|
+
return {
|
|
2529
|
+
uri: ( URI.parse(selection.url)),
|
|
2530
|
+
label: selection.label,
|
|
2531
|
+
icon,
|
|
2532
|
+
group: SESSION_WORKSPACE_GROUP_GITHUB,
|
|
2533
|
+
folders: [{
|
|
2534
|
+
root,
|
|
2535
|
+
workingDirectory: root,
|
|
2536
|
+
name: basename(root),
|
|
2537
|
+
description: undefined,
|
|
2538
|
+
gitRepository: undefined
|
|
2539
|
+
}],
|
|
2540
|
+
requiresWorkspaceTrust: false,
|
|
2541
|
+
isVirtualWorkspace: true
|
|
2542
|
+
};
|
|
2543
|
+
}
|
|
2544
|
+
resolveWorkspace(uri) {
|
|
2545
|
+
if (uri.scheme !== Schemas.file && uri.scheme !== GITHUB_REMOTE_FILE_SCHEME) {
|
|
2546
|
+
return undefined;
|
|
2547
|
+
}
|
|
2548
|
+
const folder = {
|
|
2549
|
+
root: uri,
|
|
2550
|
+
workingDirectory: uri,
|
|
2551
|
+
name: basename(uri),
|
|
2552
|
+
description: undefined,
|
|
2553
|
+
gitRepository: uri.scheme === Schemas.file ? this._getLocalGitRepository(uri) : undefined
|
|
2554
|
+
};
|
|
2555
|
+
return {
|
|
2556
|
+
uri: uri,
|
|
2557
|
+
label: this._labelFromUri(uri),
|
|
2558
|
+
description: this._descriptionFromUri(uri),
|
|
2559
|
+
group: uri.scheme === GITHUB_REMOTE_FILE_SCHEME ? SESSION_WORKSPACE_GROUP_GITHUB : SESSION_WORKSPACE_GROUP_LOCAL,
|
|
2560
|
+
icon: this._iconFromUri(uri),
|
|
2561
|
+
folders: [folder],
|
|
2562
|
+
requiresWorkspaceTrust: uri.scheme !== GITHUB_REMOTE_FILE_SCHEME,
|
|
2563
|
+
isVirtualWorkspace: uri.scheme === GITHUB_REMOTE_FILE_SCHEME
|
|
2564
|
+
};
|
|
2565
|
+
}
|
|
2566
|
+
_getLocalGitRepository(uri) {
|
|
2567
|
+
const state = this._getLocalGitRepositoryState(uri);
|
|
2568
|
+
const resolveRepository = () => this._resolveLocalGitRepository(uri, state);
|
|
2569
|
+
return {
|
|
2570
|
+
uri,
|
|
2571
|
+
workTreeUri: uri,
|
|
2572
|
+
baseBranchName: undefined,
|
|
2573
|
+
isRepository: state.isRepository,
|
|
2574
|
+
gitHubInfo: state.gitHubInfo,
|
|
2575
|
+
resolveRepository,
|
|
2576
|
+
resolveGitHubInfo: resolveRepository
|
|
2577
|
+
};
|
|
2578
|
+
}
|
|
2579
|
+
_getLocalGitRepositoryState(uri) {
|
|
2580
|
+
const key = this.uriIdentityService.extUri.getComparisonKey(uri);
|
|
2581
|
+
let state = this._localGitRepositoryState.get(key);
|
|
2582
|
+
if (state) {
|
|
2583
|
+
return state;
|
|
2584
|
+
}
|
|
2585
|
+
if (this._localGitRepositoryState.size >= 50) {
|
|
2586
|
+
const oldestKey = ( this._localGitRepositoryState.keys()).next().value;
|
|
2587
|
+
if (oldestKey !== undefined) {
|
|
2588
|
+
this._localGitRepositoryState.delete(oldestKey);
|
|
2589
|
+
this._localGitRepositoryResolutionStarted.delete(oldestKey);
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
state = {
|
|
2593
|
+
isRepository: observableValue(this, false),
|
|
2594
|
+
gitHubInfo: observableValue(this, undefined)
|
|
2595
|
+
};
|
|
2596
|
+
this._localGitRepositoryState.set(key, state);
|
|
2597
|
+
return state;
|
|
2598
|
+
}
|
|
2599
|
+
_resolveLocalGitRepository(uri, state) {
|
|
2600
|
+
const key = this.uriIdentityService.extUri.getComparisonKey(uri);
|
|
2601
|
+
if (( this._localGitRepositoryResolutionStarted.has(key))) {
|
|
2602
|
+
return;
|
|
2603
|
+
}
|
|
2604
|
+
this._localGitRepositoryResolutionStarted.add(key);
|
|
2605
|
+
void resolveGitRepositoryFromGitConfig(this.fileService, uri).then(repositoryInfo => {
|
|
2606
|
+
if (this._localGitRepositoryState.get(key) !== state) {
|
|
2607
|
+
this._localGitRepositoryResolutionStarted.delete(key);
|
|
2608
|
+
return;
|
|
2609
|
+
}
|
|
2610
|
+
if (!repositoryInfo) {
|
|
2611
|
+
this._localGitRepositoryResolutionStarted.delete(key);
|
|
2612
|
+
return;
|
|
2613
|
+
}
|
|
2614
|
+
const nextGitHubInfo = repositoryInfo.gitHub ? {
|
|
2615
|
+
owner: repositoryInfo.gitHub.owner,
|
|
2616
|
+
repo: repositoryInfo.gitHub.repo
|
|
2617
|
+
} : undefined;
|
|
2618
|
+
if (!state.isRepository.get() || !gitHubInfoEqual(state.gitHubInfo.get(), nextGitHubInfo)) {
|
|
2619
|
+
transaction(tx => {
|
|
2620
|
+
state.isRepository.set(true, tx);
|
|
2621
|
+
state.gitHubInfo.set(nextGitHubInfo, tx);
|
|
2622
|
+
});
|
|
2623
|
+
this._onDidChangeSessionTypes.fire();
|
|
2624
|
+
}
|
|
2625
|
+
if (!repositoryInfo.gitHub) {
|
|
2626
|
+
this._localGitRepositoryResolutionStarted.delete(key);
|
|
2627
|
+
}
|
|
2628
|
+
}, error => {
|
|
2629
|
+
this._localGitRepositoryResolutionStarted.delete(key);
|
|
2630
|
+
this.logService.warn(`Failed to resolve Git repository metadata for '${( uri.toString())}'.`, error);
|
|
2631
|
+
});
|
|
2632
|
+
}
|
|
2633
|
+
_labelFromUri(uri) {
|
|
2634
|
+
return githubRemoteRepoLabel(uri) ?? basename(uri);
|
|
2635
|
+
}
|
|
2636
|
+
_descriptionFromUri(uri) {
|
|
2637
|
+
if (uri.scheme === GITHUB_REMOTE_FILE_SCHEME) {
|
|
2638
|
+
const parts = uri.path.substring(1).split("/");
|
|
2639
|
+
return parts.length >= 2 ? parts[0] : undefined;
|
|
2640
|
+
}
|
|
2641
|
+
return this.labelService.getUriLabel(dirname(uri), {
|
|
2642
|
+
relative: false
|
|
2643
|
+
});
|
|
2644
|
+
}
|
|
2645
|
+
_iconFromUri(uri) {
|
|
2646
|
+
if (uri.scheme === GITHUB_REMOTE_FILE_SCHEME) {
|
|
2647
|
+
return Codicon.repo;
|
|
2648
|
+
}
|
|
2649
|
+
return Codicon.folder;
|
|
2650
|
+
}
|
|
2651
|
+
_ensureSessionCache() {
|
|
2652
|
+
if (this._sessionCache.size > 0) {
|
|
2653
|
+
return;
|
|
2654
|
+
}
|
|
2655
|
+
this._refreshSessionCache();
|
|
2656
|
+
}
|
|
2657
|
+
_invalidateGroupingCaches() {
|
|
2658
|
+
this._chatByRawSessionIdCache = undefined;
|
|
2659
|
+
this._groupIdByChatIdCache = undefined;
|
|
2660
|
+
this._chatIdsByGroupIdCache = undefined;
|
|
2661
|
+
}
|
|
2662
|
+
_ensureGroupingCaches() {
|
|
2663
|
+
if (this._chatByRawSessionIdCache && this._groupIdByChatIdCache && this._chatIdsByGroupIdCache) {
|
|
2664
|
+
return;
|
|
2665
|
+
}
|
|
2666
|
+
const chats = Array.from(( this._sessionCache.values()));
|
|
2667
|
+
const chatByRawSessionId = ( new Map());
|
|
2668
|
+
for (const chat of chats) {
|
|
2669
|
+
chatByRawSessionId.set(chat.resource.path.slice(1), chat);
|
|
2670
|
+
}
|
|
2671
|
+
const groupIdByChatId = ( new Map());
|
|
2672
|
+
const chatsByGroupId = ( new Map());
|
|
2673
|
+
const resolveGroupId = chat => {
|
|
2674
|
+
const cachedGroupId = groupIdByChatId.get(chat.sessionId);
|
|
2675
|
+
if (cachedGroupId) {
|
|
2676
|
+
return cachedGroupId;
|
|
2677
|
+
}
|
|
2678
|
+
const trail = [];
|
|
2679
|
+
const seen = ( new Set());
|
|
2680
|
+
let current = chat;
|
|
2681
|
+
for (let depth = 0; depth < 100; depth++) {
|
|
2682
|
+
const currentCachedGroupId = groupIdByChatId.get(current.sessionId);
|
|
2683
|
+
if (currentCachedGroupId) {
|
|
2684
|
+
for (const trailChat of trail) {
|
|
2685
|
+
groupIdByChatId.set(trailChat.sessionId, currentCachedGroupId);
|
|
2686
|
+
}
|
|
2687
|
+
return currentCachedGroupId;
|
|
2688
|
+
}
|
|
2689
|
+
if (( seen.has(current.sessionId))) {
|
|
2690
|
+
for (const trailChat of trail) {
|
|
2691
|
+
groupIdByChatId.set(trailChat.sessionId, current.sessionId);
|
|
2692
|
+
}
|
|
2693
|
+
return current.sessionId;
|
|
2694
|
+
}
|
|
2695
|
+
trail.push(current);
|
|
2696
|
+
seen.add(current.sessionId);
|
|
2697
|
+
const parentRawSessionId = this._getDirectParentRawSessionId(current);
|
|
2698
|
+
if (!parentRawSessionId) {
|
|
2699
|
+
for (const trailChat of trail) {
|
|
2700
|
+
groupIdByChatId.set(trailChat.sessionId, current.sessionId);
|
|
2701
|
+
}
|
|
2702
|
+
return current.sessionId;
|
|
2703
|
+
}
|
|
2704
|
+
const parentChat = chatByRawSessionId.get(parentRawSessionId);
|
|
2705
|
+
if (!parentChat) {
|
|
2706
|
+
const syntheticGroupId = this._getSyntheticGroupId(parentRawSessionId);
|
|
2707
|
+
for (const trailChat of trail) {
|
|
2708
|
+
groupIdByChatId.set(trailChat.sessionId, syntheticGroupId);
|
|
2709
|
+
}
|
|
2710
|
+
return syntheticGroupId;
|
|
2711
|
+
}
|
|
2712
|
+
current = parentChat;
|
|
2713
|
+
}
|
|
2714
|
+
groupIdByChatId.set(chat.sessionId, chat.sessionId);
|
|
2715
|
+
return chat.sessionId;
|
|
2716
|
+
};
|
|
2717
|
+
for (const chat of chats) {
|
|
2718
|
+
const groupId = resolveGroupId(chat);
|
|
2719
|
+
const groupChats = chatsByGroupId.get(groupId) ?? [];
|
|
2720
|
+
groupChats.push(chat);
|
|
2721
|
+
chatsByGroupId.set(groupId, groupChats);
|
|
2722
|
+
}
|
|
2723
|
+
const chatIdsByGroupId = ( new Map());
|
|
2724
|
+
for (const [groupId, groupChats] of chatsByGroupId) {
|
|
2725
|
+
groupChats.sort((a, b) => a.createdAt.getTime() - b.createdAt.getTime());
|
|
2726
|
+
chatIdsByGroupId.set(groupId, groupChats.map(chat => chat.sessionId));
|
|
2727
|
+
}
|
|
2728
|
+
this._chatByRawSessionIdCache = chatByRawSessionId;
|
|
2729
|
+
this._groupIdByChatIdCache = groupIdByChatId;
|
|
2730
|
+
this._chatIdsByGroupIdCache = chatIdsByGroupId;
|
|
2731
|
+
}
|
|
2732
|
+
_cleanupTempSession(sessionId) {
|
|
2733
|
+
const chatSession = this._findChatSession(sessionId);
|
|
2734
|
+
if (!chatSession) {
|
|
2735
|
+
return;
|
|
2736
|
+
}
|
|
2737
|
+
const key = ( chatSession.resource.toString());
|
|
2738
|
+
this._sessionCache.delete(key);
|
|
2739
|
+
this._invalidateGroupingCaches();
|
|
2740
|
+
this._sessionGroupCache.delete(chatSession.sessionId);
|
|
2741
|
+
if (( this._newSessions.has(chatSession.sessionId))) {
|
|
2742
|
+
this._newSessions.deleteAndLeak(chatSession.sessionId);
|
|
2743
|
+
}
|
|
2744
|
+
const removedSession = this._chatToSession(chatSession);
|
|
2745
|
+
this._sessionGroupCache.delete(chatSession.sessionId);
|
|
2746
|
+
this._onDidChangeSessions.fire({
|
|
2747
|
+
added: [],
|
|
2748
|
+
removed: [removedSession],
|
|
2749
|
+
changed: []
|
|
2750
|
+
});
|
|
2751
|
+
if (isNewSession(chatSession)) {
|
|
2752
|
+
chatSession.dispose();
|
|
2753
|
+
}
|
|
2754
|
+
}
|
|
2755
|
+
_refreshSessionCache() {
|
|
2756
|
+
const currentKeys = ( new Set());
|
|
2757
|
+
const addedData = [];
|
|
2758
|
+
const changedData = [];
|
|
2759
|
+
const sessionsToMarkUnread = [];
|
|
2760
|
+
let cacheChanged = false;
|
|
2761
|
+
for (const session of this.agentSessionsService.model.sessions) {
|
|
2762
|
+
if (session.providerType !== AgentSessionProviders.Background && session.providerType !== AgentSessionProviders.Cloud) {
|
|
2763
|
+
continue;
|
|
2764
|
+
}
|
|
2765
|
+
const key = ( session.resource.toString());
|
|
2766
|
+
currentKeys.add(key);
|
|
2767
|
+
const existing = this._sessionCache.get(key);
|
|
2768
|
+
if (existing) {
|
|
2769
|
+
const previousStatus = existing.status.get();
|
|
2770
|
+
if (existing.update(session)) {
|
|
2771
|
+
changedData.push(existing);
|
|
2772
|
+
}
|
|
2773
|
+
const currentStatus = existing.status.get();
|
|
2774
|
+
if (previousStatus === SessionStatus.InProgress && currentStatus !== SessionStatus.InProgress && currentStatus !== SessionStatus.Untitled && existing.isRead.get()) {
|
|
2775
|
+
sessionsToMarkUnread.push(session);
|
|
2776
|
+
}
|
|
2777
|
+
} else {
|
|
2778
|
+
const adapter = ( new AgentSessionAdapter(session, this.id, this.gitHubService, this.pullRequestIconCache));
|
|
2779
|
+
this._sessionCache.set(key, adapter);
|
|
2780
|
+
addedData.push(adapter);
|
|
2781
|
+
cacheChanged = true;
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
const removedData = [];
|
|
2785
|
+
for (const [key, adapter] of this._sessionCache) {
|
|
2786
|
+
if (!( currentKeys.has(key)) && adapter instanceof AgentSessionAdapter && !( this._inFlightCommits.has(key))) {
|
|
2787
|
+
removedData.push(adapter);
|
|
2788
|
+
cacheChanged = true;
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
let removedGroupIds;
|
|
2792
|
+
if (removedData.length > 0 && this._isMultiChatEnabled()) {
|
|
2793
|
+
removedGroupIds = ( new Map());
|
|
2794
|
+
for (const removed of removedData) {
|
|
2795
|
+
removedGroupIds.set(removed, this._getGroupIdForChat(removed));
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
for (const removed of removedData) {
|
|
2799
|
+
this._sessionCache.delete(( removed.resource.toString()));
|
|
2800
|
+
}
|
|
2801
|
+
if (cacheChanged) {
|
|
2802
|
+
this._invalidateGroupingCaches();
|
|
2803
|
+
}
|
|
2804
|
+
if (addedData.length > 0 || removedData.length > 0 || changedData.length > 0) {
|
|
2805
|
+
if (this._isMultiChatEnabled()) {
|
|
2806
|
+
this._refreshSessionCacheMultiChat(addedData, removedData, changedData, removedGroupIds);
|
|
2807
|
+
} else {
|
|
2808
|
+
this._onDidChangeSessions.fire({
|
|
2809
|
+
added: addedData.map(d => this._chatToSession(d)),
|
|
2810
|
+
removed: removedData.map(d => this._chatToSession(d)),
|
|
2811
|
+
changed: changedData.map(d => this._chatToSession(d))
|
|
2812
|
+
});
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
for (const session of sessionsToMarkUnread) {
|
|
2816
|
+
session.setRead(false);
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
_refreshSessionCacheMultiChat(addedData, removedData, changedData, removedGroupIds) {
|
|
2820
|
+
const trulyRemovedSessions = [];
|
|
2821
|
+
const changedSessionIds = ( new Set());
|
|
2822
|
+
for (const removed of removedData) {
|
|
2823
|
+
const sessionId = removedGroupIds.get(removed);
|
|
2824
|
+
const remainingChatIds = this._getChatIdsInGroup(sessionId);
|
|
2825
|
+
if (remainingChatIds.length > 0) {
|
|
2826
|
+
this._sessionGroupCache.delete(sessionId);
|
|
2827
|
+
this._onDidGroupMembershipChange.fire({
|
|
2828
|
+
sessionId
|
|
2829
|
+
});
|
|
2830
|
+
if (!( changedSessionIds.has(sessionId))) {
|
|
2831
|
+
changedSessionIds.add(sessionId);
|
|
2832
|
+
const primaryChat = this._sessionCache.get(this._localIdFromchatId(remainingChatIds[0]));
|
|
2833
|
+
if (primaryChat) {
|
|
2834
|
+
changedData.push(primaryChat);
|
|
2835
|
+
}
|
|
2836
|
+
}
|
|
2837
|
+
} else {
|
|
2838
|
+
this._sessionGroupCache.delete(sessionId);
|
|
2839
|
+
trulyRemovedSessions.push({
|
|
2840
|
+
chat: removed,
|
|
2841
|
+
groupId: sessionId
|
|
2842
|
+
});
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
const newSessions = [];
|
|
2846
|
+
for (const added of addedData) {
|
|
2847
|
+
const groupId = this._getGroupIdForChat(added);
|
|
2848
|
+
const groupChatIds = this._getChatIdsInGroup(groupId);
|
|
2849
|
+
if (groupChatIds.length > 1) {
|
|
2850
|
+
this._sessionGroupCache.delete(groupId);
|
|
2851
|
+
this._onDidGroupMembershipChange.fire({
|
|
2852
|
+
sessionId: groupId
|
|
2853
|
+
});
|
|
2854
|
+
if (!( changedSessionIds.has(groupId))) {
|
|
2855
|
+
changedSessionIds.add(groupId);
|
|
2856
|
+
changedData.push(added);
|
|
2857
|
+
}
|
|
2858
|
+
} else {
|
|
2859
|
+
newSessions.push(added);
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
const seenChanged = ( new Set());
|
|
2863
|
+
const deduplicatedChanged = [];
|
|
2864
|
+
for (const d of changedData) {
|
|
2865
|
+
const groupId = this._getGroupIdForChat(d);
|
|
2866
|
+
if (!( seenChanged.has(groupId))) {
|
|
2867
|
+
seenChanged.add(groupId);
|
|
2868
|
+
deduplicatedChanged.push(d);
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
this._onDidChangeSessions.fire({
|
|
2872
|
+
added: newSessions.map(d => this._chatToSession(d)),
|
|
2873
|
+
removed: trulyRemovedSessions.map((
|
|
2874
|
+
{
|
|
2875
|
+
chat,
|
|
2876
|
+
groupId
|
|
2877
|
+
}
|
|
2878
|
+
) => {
|
|
2879
|
+
const session = this._sessionGroupCache.get(groupId);
|
|
2880
|
+
this._sessionGroupCache.delete(groupId);
|
|
2881
|
+
return session ?? this._chatToSession(chat);
|
|
2882
|
+
}),
|
|
2883
|
+
changed: deduplicatedChanged.map(d => this._chatToSession(d))
|
|
2884
|
+
});
|
|
2885
|
+
}
|
|
2886
|
+
_findChatSession(chatId) {
|
|
2887
|
+
const directMatch = this._sessionCache.get(this._localIdFromchatId(chatId));
|
|
2888
|
+
if (directMatch) {
|
|
2889
|
+
return directMatch;
|
|
2890
|
+
}
|
|
2891
|
+
const groupChatIds = this._getChatIdsInGroup(chatId);
|
|
2892
|
+
const firstChatId = groupChatIds[0];
|
|
2893
|
+
return firstChatId ? this._sessionCache.get(this._localIdFromchatId(firstChatId)) : undefined;
|
|
2894
|
+
}
|
|
2895
|
+
_findAgentSession(chatId) {
|
|
2896
|
+
const adapter = this._findChatSession(chatId);
|
|
2897
|
+
if (!adapter) {
|
|
2898
|
+
return undefined;
|
|
2899
|
+
}
|
|
2900
|
+
return this.agentSessionsService.getSession(adapter.resource);
|
|
2901
|
+
}
|
|
2902
|
+
_getGroupIdForChat(chat) {
|
|
2903
|
+
this._ensureGroupingCaches();
|
|
2904
|
+
return this._groupIdByChatIdCache?.get(chat.sessionId) ?? chat.sessionId;
|
|
2905
|
+
}
|
|
2906
|
+
_getChatIdsInGroup(groupId) {
|
|
2907
|
+
this._ensureGroupingCaches();
|
|
2908
|
+
return this._chatIdsByGroupIdCache?.get(groupId) ?? [];
|
|
2909
|
+
}
|
|
2910
|
+
_getDirectParentRawSessionId(chat) {
|
|
2911
|
+
const agentSession = this.agentSessionsService.getSession(chat.resource);
|
|
2912
|
+
const sessionParentId = agentSession?.metadata?.sessionParentId;
|
|
2913
|
+
if (typeof sessionParentId === "string" && sessionParentId.length > 0) {
|
|
2914
|
+
return sessionParentId;
|
|
2915
|
+
}
|
|
2916
|
+
if (isNewSession(chat)) {
|
|
2917
|
+
const parentOption = chat.selectedOptions.get(PARENT_SESSION_OPTION_ID);
|
|
2918
|
+
if (parentOption?.id) {
|
|
2919
|
+
return parentOption.id;
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
return undefined;
|
|
2923
|
+
}
|
|
2924
|
+
_getSyntheticGroupId(rawSessionId) {
|
|
2925
|
+
return `${this.id}:group:${rawSessionId}`;
|
|
2926
|
+
}
|
|
2927
|
+
_findSession(sessionId) {
|
|
2928
|
+
return this._sessionGroupCache.get(sessionId);
|
|
2929
|
+
}
|
|
2930
|
+
_localIdFromchatId(chatId) {
|
|
2931
|
+
const prefix = `${this.id}:`;
|
|
2932
|
+
return chatId.startsWith(prefix) ? chatId.substring(prefix.length) : chatId;
|
|
2933
|
+
}
|
|
2934
|
+
_getGroupMembershipSignal(sessionId) {
|
|
2935
|
+
let signal = this._groupMembershipSignals.get(sessionId);
|
|
2936
|
+
if (!signal) {
|
|
2937
|
+
signal = observableSignal(this);
|
|
2938
|
+
this._groupMembershipSignals.set(sessionId, signal);
|
|
2939
|
+
}
|
|
2940
|
+
return signal;
|
|
2941
|
+
}
|
|
2942
|
+
_chatArraysEqual(a, b) {
|
|
2943
|
+
if (a === b) {
|
|
2944
|
+
return true;
|
|
2945
|
+
}
|
|
2946
|
+
if (!a || !b || a.length !== b.length) {
|
|
2947
|
+
return false;
|
|
2948
|
+
}
|
|
2949
|
+
return a.every(
|
|
2950
|
+
(chat, i) => this.uriIdentityService.extUri.isEqual(chat.resource, b[i].resource)
|
|
2951
|
+
);
|
|
2952
|
+
}
|
|
2953
|
+
_chatToSession(chat) {
|
|
2954
|
+
if (!this._isMultiChatEnabled()) {
|
|
2955
|
+
return this._chatToSingleChatSession(chat);
|
|
2956
|
+
}
|
|
2957
|
+
const sessionId = this._getGroupIdForChat(chat);
|
|
2958
|
+
const cached = this._sessionGroupCache.get(sessionId);
|
|
2959
|
+
if (cached) {
|
|
2960
|
+
return cached;
|
|
2961
|
+
}
|
|
2962
|
+
const mainChatIds = this._getChatIdsInGroup(sessionId);
|
|
2963
|
+
const firstChatId = mainChatIds[0];
|
|
2964
|
+
const primaryChat = firstChatId ? this._sessionCache.get(this._localIdFromchatId(firstChatId)) ?? chat : chat;
|
|
2965
|
+
const mainChat = primaryChat.mainChat;
|
|
2966
|
+
const membershipSignal = this._getGroupMembershipSignal(sessionId);
|
|
2967
|
+
const groupChatsObs = derivedOpts({
|
|
2968
|
+
owner: this,
|
|
2969
|
+
equalsFn: (a, b) => this._chatArraysEqual(a, b)
|
|
2970
|
+
}, reader => {
|
|
2971
|
+
membershipSignal.read(reader);
|
|
2972
|
+
const chatIds = this._getChatIdsInGroup(sessionId);
|
|
2973
|
+
if (chatIds.length === 0) {
|
|
2974
|
+
return undefined;
|
|
2975
|
+
}
|
|
2976
|
+
const resolved = [];
|
|
2977
|
+
for (const id of chatIds) {
|
|
2978
|
+
const c = this._sessionCache.get(this._localIdFromchatId(id));
|
|
2979
|
+
if (c) {
|
|
2980
|
+
resolved.push(c);
|
|
2981
|
+
}
|
|
2982
|
+
}
|
|
2983
|
+
if (resolved.length === 0) {
|
|
2984
|
+
return undefined;
|
|
2985
|
+
}
|
|
2986
|
+
return resolved.map(c => this._toChat(c));
|
|
2987
|
+
});
|
|
2988
|
+
const chatsObs = derived(reader => {
|
|
2989
|
+
const groupChats = groupChatsObs.read(reader);
|
|
2990
|
+
return groupChats ?? [mainChat.read(reader)];
|
|
2991
|
+
});
|
|
2992
|
+
const session = {
|
|
2993
|
+
sessionId,
|
|
2994
|
+
resource: primaryChat.resource,
|
|
2995
|
+
providerId: primaryChat.providerId,
|
|
2996
|
+
sessionType: primaryChat.sessionType,
|
|
2997
|
+
icon: primaryChat.icon,
|
|
2998
|
+
createdAt: primaryChat.createdAt,
|
|
2999
|
+
workspace: primaryChat.workspace,
|
|
3000
|
+
hasGitRepository: primaryChat.hasGitRepository,
|
|
3001
|
+
title: primaryChat.title,
|
|
3002
|
+
updatedAt: chatsObs.map((chats, reader) => this._latestDate(chats, c => c.updatedAt.read(reader))),
|
|
3003
|
+
status: chatsObs.map((chats, reader) => this._aggregateStatus(chats, reader)),
|
|
3004
|
+
changesets: this._createChangesets(primaryChat.sessionType, primaryChat.workspace, chatsObs),
|
|
3005
|
+
changesSummary: primaryChat.changesSummary,
|
|
3006
|
+
changes: primaryChat.changes,
|
|
3007
|
+
modelId: primaryChat.modelId,
|
|
3008
|
+
mode: primaryChat.mode,
|
|
3009
|
+
loading: primaryChat.loading,
|
|
3010
|
+
isArchived: primaryChat.isArchived,
|
|
3011
|
+
isRead: chatsObs.map((chats, reader) => chats.every(c => c.isRead.read(reader))),
|
|
3012
|
+
description: primaryChat.description,
|
|
3013
|
+
lastTurnEnd: chatsObs.map(
|
|
3014
|
+
(chats, reader) => this._latestDate(chats, c => c.lastTurnEnd.read(reader))
|
|
3015
|
+
),
|
|
3016
|
+
chats: chatsObs,
|
|
3017
|
+
mainChat,
|
|
3018
|
+
capabilities: constObservable({
|
|
3019
|
+
supportsMultipleChats: primaryChat.sessionType === CopilotCLISessionType.id && this._isMultiChatEnabled(),
|
|
3020
|
+
supportsRename: this._sessionTypeSupportsRename(primaryChat.sessionType),
|
|
3021
|
+
supportsDelete: this._sessionTypeSupportsDelete(primaryChat.sessionType),
|
|
3022
|
+
runsWorktreeCreatedTasks: primaryChat.sessionType === CopilotCloudSessionType.id
|
|
3023
|
+
})
|
|
3024
|
+
};
|
|
3025
|
+
this._sessionGroupCache.set(sessionId, session);
|
|
3026
|
+
return session;
|
|
3027
|
+
}
|
|
3028
|
+
_chatToSingleChatSession(chat) {
|
|
3029
|
+
const mainChat = chat.mainChat;
|
|
3030
|
+
const chatsObs = mainChat.map(c => [c]);
|
|
3031
|
+
const changesets = this._createChangesets(chat.sessionType, chat.workspace, chatsObs);
|
|
3032
|
+
return {
|
|
3033
|
+
sessionId: chat.sessionId,
|
|
3034
|
+
resource: chat.resource,
|
|
3035
|
+
providerId: chat.providerId,
|
|
3036
|
+
sessionType: chat.sessionType,
|
|
3037
|
+
icon: chat.icon,
|
|
3038
|
+
createdAt: chat.createdAt,
|
|
3039
|
+
workspace: chat.workspace,
|
|
3040
|
+
hasGitRepository: chat.hasGitRepository,
|
|
3041
|
+
title: chat.title,
|
|
3042
|
+
updatedAt: chat.updatedAt,
|
|
3043
|
+
status: chat.status,
|
|
3044
|
+
changesets,
|
|
3045
|
+
changesSummary: chat.changesSummary,
|
|
3046
|
+
changes: chat.changes,
|
|
3047
|
+
modelId: chat.modelId,
|
|
3048
|
+
mode: chat.mode,
|
|
3049
|
+
loading: chat.loading,
|
|
3050
|
+
isArchived: chat.isArchived,
|
|
3051
|
+
isRead: chat.isRead,
|
|
3052
|
+
description: chat.description,
|
|
3053
|
+
lastTurnEnd: chat.lastTurnEnd,
|
|
3054
|
+
chats: chatsObs,
|
|
3055
|
+
mainChat,
|
|
3056
|
+
capabilities: constObservable({
|
|
3057
|
+
supportsMultipleChats: false,
|
|
3058
|
+
supportsRename: this._sessionTypeSupportsRename(chat.sessionType),
|
|
3059
|
+
supportsDelete: this._sessionTypeSupportsDelete(chat.sessionType),
|
|
3060
|
+
runsWorktreeCreatedTasks: chat.sessionType === CopilotCloudSessionType.id
|
|
3061
|
+
})
|
|
3062
|
+
};
|
|
3063
|
+
}
|
|
3064
|
+
_sessionTypeSupportsRename(sessionType) {
|
|
3065
|
+
return sessionType === CopilotCLISessionType.id;
|
|
3066
|
+
}
|
|
3067
|
+
_sessionTypeSupportsDelete(sessionType) {
|
|
3068
|
+
return sessionType === CopilotCLISessionType.id;
|
|
3069
|
+
}
|
|
3070
|
+
_toChat(chat, resource, interactivity = ChatInteractivity.Full) {
|
|
3071
|
+
return {
|
|
3072
|
+
resource: resource ?? chat.resource,
|
|
3073
|
+
createdAt: chat.createdAt,
|
|
3074
|
+
title: chat.title,
|
|
3075
|
+
updatedAt: chat.updatedAt,
|
|
3076
|
+
status: chat.status,
|
|
3077
|
+
changes: chat.changes,
|
|
3078
|
+
checkpoints: chat.checkpoints,
|
|
3079
|
+
modelId: chat.modelId,
|
|
3080
|
+
modelSource: chat.modelSource,
|
|
3081
|
+
mode: chat.mode,
|
|
3082
|
+
isArchived: chat.isArchived,
|
|
3083
|
+
isRead: chat.isRead,
|
|
3084
|
+
interactivity: constObservable(interactivity),
|
|
3085
|
+
description: chat.description,
|
|
3086
|
+
lastTurnEnd: chat.lastTurnEnd
|
|
3087
|
+
};
|
|
3088
|
+
}
|
|
3089
|
+
_createChangesets(sessionType, workspaceObs, chatsObs) {
|
|
3090
|
+
return createChangesets(sessionType, workspaceObs, chatsObs, this.instantiationService);
|
|
3091
|
+
}
|
|
3092
|
+
_latestDate(chats, getter) {
|
|
3093
|
+
let latest;
|
|
3094
|
+
for (const chat of chats) {
|
|
3095
|
+
const d = getter(chat);
|
|
3096
|
+
if (d && (!latest || d > latest)) {
|
|
3097
|
+
latest = d;
|
|
3098
|
+
}
|
|
3099
|
+
}
|
|
3100
|
+
return latest;
|
|
3101
|
+
}
|
|
3102
|
+
_aggregateStatus(chats, reader) {
|
|
3103
|
+
for (const c of chats) {
|
|
3104
|
+
if (c.status.read(reader) === SessionStatus.NeedsInput) {
|
|
3105
|
+
return SessionStatus.NeedsInput;
|
|
3106
|
+
}
|
|
3107
|
+
}
|
|
3108
|
+
for (const c of chats) {
|
|
3109
|
+
if (c.status.read(reader) === SessionStatus.InProgress) {
|
|
3110
|
+
return SessionStatus.InProgress;
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3113
|
+
return chats[0].status.read(reader);
|
|
3114
|
+
}
|
|
3115
|
+
_isMultiChatEnabled() {
|
|
3116
|
+
return this._multiChatEnabled;
|
|
3117
|
+
}
|
|
3118
|
+
};
|
|
3119
|
+
CopilotChatSessionsProvider = CopilotChatSessionsProvider_1 = ( __decorate([( __param(0, IAgentSessionsService)), ( __param(1, IChatService)), ( __param(2, IChatSessionsService)), ( __param(3, IDialogService)), ( __param(4, ICommandService)), ( __param(5, IInstantiationService)), ( __param(6, ILanguageModelsService)), ( __param(7, ILanguageModelToolsService)), ( __param(8, IConfigurationService)), ( __param(9, IAgentHostEnablementService)), ( __param(10, ILogService)), ( __param(11, INotificationService)), ( __param(12, IGitHubService)), ( __param(13, IPullRequestIconCache)), ( __param(14, ILabelService)), ( __param(15, IChatModeService)), ( __param(16, IUriIdentityService)), ( __param(17, IFileService)), ( __param(18, IPathService))], CopilotChatSessionsProvider));
|
|
3120
|
+
|
|
3121
|
+
export { COPILOT_MULTI_CHAT_SETTING, COPILOT_PROVIDER_ID, CopilotChatSessionsProvider, CopilotCloudSessionType, RemoteNewSession };
|