@codingame/monaco-vscode-chat-service-override 36.2.7 → 37.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -0
- package/index.js +92 -10
- package/package.json +5 -5
- package/vscode/src/vs/platform/agentHost/browser/agentHostConnectionsService.d.ts +10 -3
- package/vscode/src/vs/platform/agentHost/browser/agentHostConnectionsService.js +54 -17
- package/vscode/src/vs/platform/agentHost/browser/agentHostEnablementService.d.ts +14 -0
- package/vscode/src/vs/platform/agentHost/browser/agentHostEnablementService.js +46 -0
- package/vscode/src/vs/platform/agentHost/browser/agentHostIpcChannelTransport.d.ts +7 -2
- package/vscode/src/vs/platform/agentHost/browser/agentHostIpcChannelTransport.js +34 -2
- package/vscode/src/vs/platform/agentHost/browser/{remoteAgentHostProtocolClient.d.ts → agentHostProtocolClient.d.ts} +240 -60
- package/vscode/src/vs/platform/agentHost/browser/agentHostProtocolClient.js +1911 -0
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.d.ts +30 -33
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.js +381 -315
- package/vscode/src/vs/platform/agentHost/browser/webSocketClientTransport.d.ts +3 -1
- package/vscode/src/vs/platform/agentHost/browser/webSocketClientTransport.js +2 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostClientInfo.d.ts +9 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostClientInfo.js +20 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostExtensionProtocol.d.ts +144 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostExtensionProtocol.js +20 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemProvider.d.ts +14 -6
- package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemProvider.js +14 -10
- package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemService.js +1 -1
- package/vscode/src/vs/platform/agentHost/common/agentHostManagedRules.d.ts +47 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostManagedRules.js +75 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostManagedSettings.d.ts +68 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostManagedSettings.js +161 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostStarter.config.contribution.js +288 -45
- package/vscode/src/vs/platform/agentHost/common/agentMerge.d.ts +261 -0
- package/vscode/src/vs/platform/agentHost/common/agentMerge.js +67 -0
- package/vscode/src/vs/platform/agentHost/common/agentSdkSetup.d.ts +53 -0
- package/vscode/src/vs/platform/agentHost/common/agentSdkSetup.js +45 -0
- package/vscode/src/vs/platform/agentHost/common/changesetUri.d.ts +130 -0
- package/vscode/src/vs/platform/agentHost/common/changesetUri.js +27 -0
- package/vscode/src/vs/platform/agentHost/common/customAgents.d.ts +8 -2
- package/vscode/src/vs/platform/agentHost/common/customAgents.js +7 -0
- package/vscode/src/vs/platform/agentHost/common/meta/agentChatSurfaceMeta.d.ts +39 -0
- package/vscode/src/vs/platform/agentHost/common/meta/agentChatSurfaceMeta.js +25 -0
- package/vscode/src/vs/platform/agentHost/common/meta/agentCompletionAttachmentMeta.d.ts +110 -0
- package/vscode/src/vs/platform/agentHost/common/meta/agentCompletionAttachmentMeta.js +38 -0
- package/vscode/src/vs/platform/agentHost/common/meta/agentHostArtifactRemovalMeta.d.ts +4 -0
- package/vscode/src/vs/platform/agentHost/common/meta/clientPluginCustomizationMeta.d.ts +7 -0
- package/vscode/src/vs/platform/agentHost/common/meta/clientPluginCustomizationMeta.js +14 -0
- package/vscode/src/vs/platform/agentHost/common/sandboxConfigSchema.d.ts +3 -3
- package/vscode/src/vs/platform/agentHost/common/sandboxConfigSchema.js +16 -24
- package/vscode/src/vs/platform/agentHost/common/semanticSearchConstants.d.ts +8 -0
- package/vscode/src/vs/platform/agentHost/common/semanticSearchConstants.js +8 -0
- package/vscode/src/vs/platform/agentHost/common/sessionArtifacts.d.ts +75 -0
- package/vscode/src/vs/platform/agentHost/common/sessionArtifacts.js +84 -0
- package/vscode/src/vs/platform/agentHost/common/shellInitScript.d.ts +24 -0
- package/vscode/src/vs/platform/agentHost/common/shellInitScript.js +63 -0
- package/vscode/src/vs/platform/agentHost/common/state/agentSubscription.d.ts +71 -20
- package/vscode/src/vs/platform/agentHost/common/state/agentSubscription.js +187 -26
- package/vscode/src/vs/platform/agentHost/common/state/legacyProtocolCompatibility.d.ts +30 -0
- package/vscode/src/vs/platform/agentHost/common/state/legacyProtocolCompatibility.js +87 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-annotations/reducer.js +2 -2
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-automation/reducer.d.ts +4 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-automation/reducer.js +37 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-automation-run/reducer.d.ts +4 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-automation-run/reducer.js +45 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-changeset/reducer.d.ts +5 -4
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-changeset/reducer.js +100 -35
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-chat/reducer.js +193 -49
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-session/reducer.js +161 -40
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-terminal/reducer.d.ts +1 -1
- package/vscode/src/vs/platform/agentHost/common/state/protocol/channels-terminal/reducer.js +5 -1
- package/vscode/src/vs/platform/agentHost/common/state/protocol/common/reducer-helpers.d.ts +2 -2
- package/vscode/src/vs/platform/agentHost/common/state/protocol/common/timestamps.d.ts +1 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/common/timestamps.js +7 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/version/registry.d.ts +1 -1
- package/vscode/src/vs/platform/agentHost/common/state/protocol/version/registry.js +114 -3
- package/vscode/src/vs/platform/agentHost/common/state/sessionActions.d.ts +28 -5
- package/vscode/src/vs/platform/agentHost/common/state/sessionActions.js +4 -2
- package/vscode/src/vs/platform/agentHost/common/state/sessionWorkingDirectories.d.ts +34 -0
- package/vscode/src/vs/platform/agentHost/common/state/sessionWorkingDirectories.js +28 -0
- package/vscode/src/vs/platform/agentHost/common/worktreePaths.d.ts +24 -0
- package/vscode/src/vs/platform/agentHost/common/worktreePaths.js +15 -0
- package/vscode/src/vs/platform/browserView/common/browserChatToolReferenceNames.d.ts +1 -1
- package/vscode/src/vs/platform/chat/common/aiAgentEnv.d.ts +18 -0
- package/vscode/src/vs/platform/chat/common/aiAgentEnv.js +6 -0
- package/vscode/src/vs/platform/networkFilter/common/domainMatcher.d.ts +5 -1
- package/vscode/src/vs/platform/networkFilter/common/domainMatcher.js +77 -5
- package/vscode/src/vs/platform/networkFilter/common/networkFilterService.d.ts +1 -1
- package/vscode/src/vs/platform/networkFilter/common/networkFilterService.js +9 -5
- package/vscode/src/vs/platform/networkFilter/common/settings.d.ts +1 -5
- package/vscode/src/vs/platform/networkFilter/common/settings.js +0 -4
- package/vscode/src/vs/platform/sandbox/common/terminalSandboxEngine.d.ts +19 -7
- package/vscode/src/vs/platform/sandbox/common/terminalSandboxEngine.js +49 -37
- package/vscode/src/vs/platform/sandbox/common/terminalSandboxReadAllowList.d.ts +2 -1
- package/vscode/src/vs/platform/sandbox/common/terminalSandboxReadAllowList.js +12 -0
- package/vscode/src/vs/platform/sandbox/common/terminalSandboxRuntimeConfigurationPerOperation.js +1 -2
- package/vscode/src/vs/platform/sandbox/common/terminalSandboxService.d.ts +1 -0
- package/vscode/src/vs/platform/terminal/common/autoApprove/autoApproveParseSafety.d.ts +5 -0
- package/vscode/src/vs/platform/terminal/common/autoApprove/autoApproveParseSafety.js +7 -0
- package/vscode/src/vs/platform/terminal/common/autoApprove/cmdDelayedExpansion.d.ts +5 -0
- package/vscode/src/vs/platform/terminal/common/autoApprove/cmdDelayedExpansion.js +8 -0
- package/vscode/src/vs/{workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers → platform/terminal/common/autoApprove}/sedFileWriteParser.d.ts +1 -2
- package/vscode/src/vs/workbench/browser/chatChangesPill.d.ts +29 -0
- package/vscode/src/vs/workbench/browser/chatChangesPill.js +84 -0
- package/vscode/src/vs/workbench/common/chatPullRequest.d.ts +19 -0
- package/vscode/src/vs/workbench/common/chatPullRequest.js +53 -0
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoice.contribution.js +342 -155
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceSessionsPicker.js +2 -2
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.d.ts +25 -2
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidget.js +150 -67
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidgetBinding.js +5 -3
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWindowService.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWindowService.js +39 -9
- 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 +4 -2
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/headerComponent.js +54 -17
- 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/tokens.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/components/tokens.js +5 -1
- 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/media/voiceModeOnboarding.css +252 -0
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscripts.contribution.js +13 -13
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/transcriptsView/voiceTranscriptsView.js +7 -7
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/voiceModeOnboarding.d.ts +146 -0
- package/vscode/src/vs/workbench/contrib/agentsVoice/browser/voiceModeOnboarding.js +889 -0
- package/vscode/src/vs/workbench/contrib/agentsVoice/common/voiceTranscriptStore.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityService.d.ts +2 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityService.js +3 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.d.ts +32 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.js +214 -161
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.js +10 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +256 -72
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClear.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatClear.js +11 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +19 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +30 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +19 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFindActions.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFindActions.js +237 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +7 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatNewActions.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatNewActions.js +68 -61
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.js +17 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPluginActions.js +17 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPromptNavigationActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQueueActions.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQueueActions.js +68 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +21 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/createPluginAction.d.ts +7 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/createPluginAction.js +222 -72
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/exportAgentHostDebugLogsAction.d.ts +64 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/exportAgentHostDebugLogsAction.js +530 -305
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/openAgentHostStateFileAction.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/openAgentHostStateFileAction.js +63 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentHostCompletionAction.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentHostCompletionAction.js +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginCommands.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginCommands.js +95 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditor.js +10 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginItems.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.d.ts +18 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.js +86 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.js +61 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.d.ts +43 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.js +326 -76
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostCustomizationService.d.ts +112 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostCustomizationService.js +33 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostImportConversationStore.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostImportConversationStore.js +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLocalCustomizations.d.ts +28 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLocalCustomizations.js +110 -126
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpServerSupport.d.ts +131 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpServerSupport.js +638 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpServerSupportScope.d.ts +41 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpServerSupportScope.js +202 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostModeSynchronizer.d.ts +24 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostModeSynchronizer.js +26 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPermissionUiContribution.js +10 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostProtectedResourcesService.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostProtectedResourcesService.js +55 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostResponseFileChanges.d.ts +62 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostResponseFileChanges.js +40 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionInputPills.d.ts +59 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionInputPills.js +624 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionWorkingDirectorySynchronizer.d.ts +90 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionWorkingDirectorySynchronizer.js +207 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostShellInitSynchronizer.d.ts +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostShellInitSynchronizer.js +140 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostToolSetEnablementService.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostToolSetEnablementService.js +5 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostToolUtils.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostUntitledProvisionalSessionService.d.ts +74 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostUntitledProvisionalSessionService.js +511 -171
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/applyAgentHostSessionConfig.d.ts +32 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/applyAgentHostSessionConfig.js +48 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/syncedCustomizationBundler.d.ts +55 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/syncedCustomizationBundler.js +210 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution.js +43 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.d.ts +46 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.js +216 -110
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.d.ts +9 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.js +26 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjection.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionsExperiments.contribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.js +30 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/media/agenttitlebarstatuswidget.css +5 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/media/unifiedQuickAccess.css +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccess.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccessActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/externalSessionsFilterMenu.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/externalSessionsFilterMenu.js +62 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/media/sessionSummaryHover.css +104 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/sessionSummaryHover.d.ts +115 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/sessionSummaryHover.js +168 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/sessionSummaryHoverService.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/sessionSummaryHoverService.js +32 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessionsConfiguration.js +56 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.d.ts +0 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.js +16 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.d.ts +7 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemsModel.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemsModel.js +10 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.d.ts +48 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.js +913 -220
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.contribution.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.contribution.js +148 -84
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.d.ts +161 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.js +2367 -247
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditorInput.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditorInput.js +21 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementSectionRegistry.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementSectionRegistry.js +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationPresentation.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationPresentation.js +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePage.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePage.js +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePagePromptLaunchers.d.ts +10 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePagePromptLaunchers.js +143 -68
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWorkspaceService.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWorkspaceService.js +10 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCardList.d.ts +40 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCardList.js +302 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCreatorService.d.ts +1 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCreatorService.js +49 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationGroupHeaderRenderer.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigration.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigration.js +240 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationAccessibility.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationAccessibility.js +53 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationCategories.d.ts +82 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationCategories.js +762 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationDashboard.d.ts +80 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationDashboard.js +279 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationServiceImpl.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationServiceImpl.js +437 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedAgentPluginDetail.d.ts +85 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedAgentPluginDetail.js +697 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedExtensionToolsDetail.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedMcpServerDetail.d.ts +40 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedMcpServerDetail.js +164 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/galleryItemRenderer.js +6 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.d.ts +260 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.js +2097 -589
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpServerCustomizationMigration.d.ts +32 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpServerCustomizationMigration.js +860 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationManagement.css +2229 -1338
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationWelcomePromptLaunchers.css +79 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/customizationMigrationDashboard.css +354 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.d.ts +85 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.js +1550 -357
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.d.ts +2 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.js +13 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/toolsListWidget.d.ts +38 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/toolsListWidget.js +637 -319
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.js +28 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatPasteTargetService.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatPasteTargetService.js +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatReferenceAttachmentWidget.contribution.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatReferenceAttachmentWidget.contribution.js +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/transcriptContextAttachmentWidget.contribution.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/transcriptContextAttachmentWidget.contribution.js +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.shared.contribution.js +1675 -633
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostChatDebugProvider.d.ts +93 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostChatDebugProvider.js +823 -52
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostLogSources.d.ts +132 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostLogSources.js +446 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostUsageSidecar.d.ts +183 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostUsageSidecar.js +218 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.js +45 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheExplorerView.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheExplorerView.js +163 -136
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheInsights.js +72 -72
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugDetailPanel.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.d.ts +22 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.js +105 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEnablement.d.ts +32 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEnablement.js +49 -0
- 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 +27 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHomeView.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHomeView.js +22 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHookContentRenderer.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.js +25 -25
- 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.d.ts +7 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.js +76 -43
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugToolCallContentRenderer.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugTypes.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugTypes.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugWireLogView.d.ts +145 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugWireLogView.js +839 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/media/chatDebug.css +277 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.d.ts +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationModelManager.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +8 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.d.ts +6 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +35 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +16 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSessionStorage.js +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingEditorOverlay.css +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingExplanationWidget.css +7 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/notebookCellChanges.d.ts +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatImageCarouselService.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPills.d.ts +86 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPills.js +282 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +14 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.js +37 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.d.ts +7 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.js +135 -82
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatModelsWidget.css +22 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutlineCreator.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutlineCreator.js +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +32 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievementPreview.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievementPreview.js +114 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievements.contribution.d.ts +45 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievements.contribution.js +326 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievementsEditor.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievementsEditor.js +99 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievementsEditorInput.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievementsEditorInput.js +46 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievementsWidget.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievementsWidget.js +301 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPromoNotification.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPromoNotification.js +103 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuotaNotification.d.ts +9 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuotaNotification.js +103 -196
- package/vscode/src/vs/workbench/contrib/chat/browser/chatRepoInfo.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.js +36 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.js +51 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupGrowthSession.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.js +31 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.d.ts +65 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.js +291 -138
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/media/chatSetup.css +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/media/microsoft-dark.svg +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/media/microsoft-light.svg +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSideChat.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSideChat.js +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommands.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommands.js +59 -35
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.d.ts +7 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.js +221 -145
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.js +15 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/media/chatStatus.css +21 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSubmitRequestHandlerService.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSubmitRequestHandlerService.js +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipCatalog.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipCatalog.js +23 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.d.ts +6 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.js +62 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWindowNotifier.d.ts +15 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWindowNotifier.js +97 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/claudePluginRecommendations.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/contextContrib/chatContext.contribution.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/contextContrib/chatContextService.d.ts +11 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/contextContrib/chatContextService.js +24 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/defaultModelContribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/enablementStatusWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/expNotification/chatExpNotificationConfig.d.ts +44 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/expNotification/chatExpNotificationConfig.js +232 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/expNotification/chatExpNotificationContribution.d.ts +36 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/expNotification/chatExpNotificationContribution.js +127 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/exploreAgentDefaultModel.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/feedbackSurvey/chatModelFeedbackSurveyPromptContribution.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/feedbackSurvey/chatModelFeedbackSurveyPromptContribution.js +55 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/hasByokModelsContribution.js +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelsConfigurationService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatPetAchievements.css +236 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/planAgentDefaultModel.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorOverlay.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorOverlay.js +260 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackService.d.ts +39 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackService.js +155 -56
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginAutoUpdate.d.ts +10 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginAutoUpdate.js +29 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginGitCommandService.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginGitCommandService.js +76 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.js +53 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginUrlHandler.js +8 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +29 -71
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.js +36 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolSetsCodeLensProvider.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +9 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/skillActions.js +5 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/media/promptTimeline.css +820 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptBucketing.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptBucketing.js +100 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimeline.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimeline.contribution.js +51 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineCard.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineCard.js +113 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineGutterRail.d.ts +146 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineGutterRail.js +440 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineLayout.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineLayout.js +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineModel.d.ts +194 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineModel.js +525 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineRail.d.ts +33 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineRulerRail.d.ts +128 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineRulerRail.js +460 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineStickyHeader.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineStickyHeader.js +120 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineWidgetContrib.d.ts +53 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineWidgetContrib.js +160 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/promptsDebugContribution.js +25 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/sessionChatPillOptions.d.ts +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/sessionChatPillOptions.js +52 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/sessionPullRequestPill.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/sessionPullRequestPill.js +58 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/speechToText/voiceCodeTranscriptionClient.d.ts +63 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/speechToText/voiceCodeTranscriptionClient.js +361 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/telemetry/chatEditorTopologyTelemetry.d.ts +35 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/telemetry/chatEditorTopologyTelemetry.js +90 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/clientToolSetsContribution.js +25 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsConfirmationService.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsConfirmationService.js +77 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.js +60 -43
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.js +60 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.d.ts +10 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.js +13 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.js +44 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/utilityModelContribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceClientService.d.ts +52 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceClientService.js +446 -79
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceInputUtils.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceInputUtils.js +13 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceInputMode/voiceInputMode.d.ts +66 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceInputMode/voiceInputMode.js +297 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentOpenChat.d.ts +137 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatSubagentOpenChat.js +714 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/media/chatSubagentOpenChat.css +379 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatFind/chatFindAccessibilityHelp.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatFind/chatFindAccessibilityHelp.js +78 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatPetWidgetService.d.ts +36 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatPetWidgetService.js +172 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidgetService.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidgetService.js +8 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNoticeHub.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatInputNoticeHub.js +30 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatQueuePickerActionItem.d.ts +11 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatQueuePickerActionItem.js +41 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletions.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletions.js +133 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletionsBase.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletionsBase.js +11 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatEditorInputContentProvider.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCommandArgumentHint.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCommandArgumentHint.js +96 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletionUtils.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletionUtils.js +36 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +67 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorContrib.js +23 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorHover.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorHover.js +72 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputPlaceholderDecoration.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/{agentsVoice/common/agentsVoiceColors.js → chat/browser/widget/input/editor/chatInputPlaceholderDecoration.js} +17 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputReferenceDecorations.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputReferenceDecorations.js +16 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/chatQuick.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditor.d.ts +6 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditor.js +21 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.d.ts +48 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.js +457 -142
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl.js +22 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/media/chatViewPane.css +6 -22
- package/vscode/src/vs/workbench/contrib/chat/common/automations/automationBlueprint.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/common/automations/automationBlueprint.js +163 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.d.ts +27 -5
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.js +79 -32
- package/vscode/src/vs/workbench/contrib/chat/common/chatNotification.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatNotification.js +12 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.d.ts +44 -11
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.js +404 -51
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceTelemetry.d.ts +64 -4
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceTelemetry.js +33 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatSideChatService.d.ts +68 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatSideChatService.js +70 -0
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatModelStore.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionOperationLog.js +18 -5
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionStore.js +43 -14
- package/vscode/src/vs/workbench/contrib/chat/common/participants/chatSlashCommands.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.d.ts +4 -9
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.js +164 -71
- 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 +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +18 -18
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptLinkProvider.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptLinkProvider.js +19 -10
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +172 -159
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/customizationMigrationService.d.ts +115 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/customizationMigrationService.js +69 -0
- package/vscode/src/vs/workbench/contrib/chat/common/sessionChatPills.d.ts +60 -0
- package/vscode/src/vs/workbench/contrib/chat/common/sessionChatPills.js +139 -0
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/voicePlaybackService.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/common/voicePlaybackService.js +21 -1
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatResponseResourceFileSystemProvider.d.ts +25 -2
- package/vscode/src/vs/workbench/contrib/chat/common/widget/chatResponseResourceFileSystemProvider.js +55 -18
- package/vscode/src/vs/workbench/contrib/imageCarousel/browser/imageCarousel.contribution.js +10 -10
- 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/inlineChat.contribution.js +1 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +15 -15
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatDefaultModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditReviewSession.d.ts +59 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditReviewSession.js +323 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionResolver.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionResolver.js +79 -0
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +6 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +118 -13
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +14 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +10 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +1 -1
- package/vscode/src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.js +8 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminal.chat.contribution.js +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.d.ts +81 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.js +85 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +17 -17
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +23 -23
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatEnabler.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.d.ts +17 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.js +81 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatSessionResolver.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatSessionResolver.js +86 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.d.ts +10 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +97 -18
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/agentHostSandboxForwarder.d.ts +2 -22
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/agentHostSandboxForwarder.js +10 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/largeOutputFileWriter.js +2 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +42 -36
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.js +10 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +2 -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 +25 -16
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +4 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/consoleCompactor/consoleCompactor.d.ts +70 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/consoleCompactor/consoleCompactor.js +4316 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/killTerminalTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.d.ts +6 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +188 -148
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sendToTerminalTool.js +10 -10
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +14 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +7 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +14 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.js +82 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/sandboxSettingsReader.d.ts +5 -6
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/sandboxSettingsReader.js +5 -42
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalOutput.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalOutput.js +8 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.js +27 -8
- package/vscode/src/vs/workbench/services/accounts/browser/defaultAccount.d.ts +205 -0
- package/vscode/src/vs/workbench/services/accounts/browser/defaultAccount.js +1580 -0
- package/vscode/src/vs/workbench/services/agentEditorComments/browser/agentEditorCommentsOverlayWidget.d.ts +30 -0
- package/vscode/src/vs/workbench/services/agentEditorComments/browser/agentEditorCommentsOverlayWidget.js +175 -0
- package/vscode/src/vs/workbench/services/agentEditorComments/browser/media/agentEditorCommentsOverlayWidget.css +65 -0
- package/vscode/src/vs/workbench/services/agentHost/browser/agentSdkSetupService.d.ts +47 -0
- package/vscode/src/vs/workbench/services/agentHost/browser/agentSdkSetupService.js +129 -0
- package/vscode/src/vs/workbench/services/agentHost/browser/editorRemoteAgentHostServiceClient.d.ts +26 -8
- package/vscode/src/vs/workbench/services/agentHost/browser/editorRemoteAgentHostServiceClient.js +89 -27
- package/vscode/src/vs/workbench/services/agentHost/browser/webAgentHostEnablementService.d.ts +8 -0
- package/vscode/src/vs/workbench/services/agentHost/browser/webAgentHostEnablementService.js +28 -0
- package/vscode/src/vs/workbench/services/agentHost/common/agentHostFileSystemService.js +5 -1
- package/vscode/src/vs/workbench/services/agentHost/common/agentHostResourceService.d.ts +18 -18
- package/vscode/src/vs/workbench/services/agentHost/common/agentHostResourceService.js +159 -60
- package/vscode/src/vs/workbench/services/agentHost/common/editorRemoteAgentHostTransport.d.ts +47 -0
- package/vscode/src/vs/workbench/services/agentHost/common/editorRemoteAgentHostTransport.js +362 -0
- package/vscode/src/vs/platform/agentHost/browser/agentHost.config.contribution.d.ts +0 -1
- package/vscode/src/vs/platform/agentHost/browser/agentHost.config.contribution.js +0 -40
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.js +0 -1110
- package/vscode/src/vs/platform/agentHost/common/agentHost.config.contribution.js +0 -76
- package/vscode/src/vs/platform/agentHost/common/agentHostResourceService.d.ts +0 -63
- package/vscode/src/vs/platform/agentHost/common/agentHostResourceService.js +0 -25
- package/vscode/src/vs/platform/agentHost/common/agentHostSchema.d.ts +0 -254
- package/vscode/src/vs/platform/agentHost/common/agentHostSchema.js +0 -451
- package/vscode/src/vs/platform/agentHost/common/agentService.d.ts +0 -1294
- package/vscode/src/vs/platform/agentHost/common/agentService.js +0 -92
- package/vscode/src/vs/platform/agentHost/common/state/protocol/common/errors.d.ts +0 -186
- package/vscode/src/vs/platform/agentHost/common/state/protocol/common/errors.js +0 -10
- package/vscode/src/vs/platform/agentHost/common/state/sessionTransport.d.ts +0 -42
- package/vscode/src/vs/platform/agentHost/common/state/sessionTransport.js +0 -7
- package/vscode/src/vs/workbench/contrib/agentsVoice/common/agentsVoice.d.ts +0 -15
- package/vscode/src/vs/workbench/contrib/agentsVoice/common/agentsVoice.js +0 -15
- package/vscode/src/vs/workbench/contrib/agentsVoice/common/agentsVoiceColors.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatForkActions.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatForkActions.js +0 -243
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/openCopilotCliStateFileAction.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/openCopilotCliStateFileAction.js +0 -77
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginActions.d.ts +0 -92
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginActions.js +0 -224
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostNewSessionFolderService.d.ts +0 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostNewSessionFolderService.js +0 -52
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsQuickAccess.d.ts +0 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsQuickAccess.js +0 -96
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentDisabledInputTipContribution.d.ts +0 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentDisabledInputTipContribution.js +0 -152
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/automationsListWidget.d.ts +0 -87
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/automationsListWidget.js +0 -772
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseFileChangesService.d.ts +0 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/chatResponseFileChangesService.js +0 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/enablementActions.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/enablementActions.js +0 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/media/planReviewFeedback.css +0 -160
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorActions.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorActions.js +0 -123
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorContribution.d.ts +0 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorContribution.js +0 -572
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/micCaptureService.d.ts +0 -125
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/micCaptureService.js +0 -399
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceSessionController.d.ts +0 -321
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceSessionController.js +0 -2117
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceToolDispatchService.d.ts +0 -57
- package/vscode/src/vs/workbench/contrib/chat/browser/voiceClient/voiceToolDispatchService.js +0 -367
- package/vscode/src/vs/workbench/contrib/chat/common/automations/automation.d.ts +0 -78
- package/vscode/src/vs/workbench/contrib/chat/common/automations/automationDialogService.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/chat/common/automations/automationDialogService.service.d.ts +0 -11
- package/vscode/src/vs/workbench/contrib/chat/common/automations/automationDialogService.service.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/common/automations/automationRunner.service.d.ts +0 -16
- package/vscode/src/vs/workbench/contrib/chat/common/automations/automationRunner.service.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/common/automations/automationService.d.ts +0 -46
- package/vscode/src/vs/workbench/contrib/chat/common/automations/automationService.service.d.ts +0 -36
- package/vscode/src/vs/workbench/contrib/chat/common/automations/automationService.service.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/common/automations/automationsEnabled.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/chat/common/automations/automationsEnabled.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/common/automations/schedule.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/chat/common/automations/schedule.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.d.ts +0 -15
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.js +0 -177
- 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 -65
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.js +0 -264
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.d.ts +0 -190
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.js +0 -865
- 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/terminalContrib/chatAgentTools/browser/commandParsers/commandFileWriteParser.d.ts +0 -24
- /package/vscode/src/vs/{workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers → platform/terminal/common/autoApprove}/sedFileWriteParser.js +0 -0
- /package/vscode/src/vs/{platform/agentHost/common/agentHost.config.contribution.d.ts → workbench/contrib/chat/browser/agentSessionsConfiguration.d.ts} +0 -0
|
@@ -0,0 +1,1911 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { TimeoutTimer, DeferredPromise } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
4
|
+
import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
5
|
+
import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
6
|
+
import { Disposable, MutableDisposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
7
|
+
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
8
|
+
import { hasKey } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
9
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
10
|
+
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
11
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
12
|
+
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
13
|
+
import { toFileSystemProviderErrorCode, FileSystemProviderErrorCode } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files';
|
|
14
|
+
import { ConfigurationTarget, ConfigurationTargetToString } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration';
|
|
15
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
16
|
+
import { AgentSession } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agent';
|
|
17
|
+
import { AGENT_HOST_DEBUG_LOGS_MAX_ENTRIES, AGENT_HOST_DEBUG_LOGS_CHUNK_BYTES } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentService';
|
|
18
|
+
import { RemoveSessionArtifactExtensionMethod, CreateAgentHostDetachedWorktreeExtensionMethod, SetAgentHostDetachedWorktreeArchivedExtensionMethod, ClaimAgentHostDetachedWorktreeExtensionMethod, DeleteAgentHostDetachedWorktreeExtensionMethod, ReconcileAgentHostDetachedWorktreesExtensionMethod, supportsAgentHostChatStateFile, GetAgentHostSessionStateFileExtensionMethod, CollectAgentHostDebugLogsExtensionMethod, ReadAgentHostDebugLogsChunkExtensionMethod, RequestAgentHostWorkspaceTrustExtensionMethod } from '../common/agentHostExtensionProtocol.js';
|
|
19
|
+
import { AMBIENT_AGENT_HOST_AUTHORITY } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostConnectionsService';
|
|
20
|
+
import { createRemoteWatchHandle } from '../common/agentHostFileSystemProvider.js';
|
|
21
|
+
import { AgentSubscriptionManager } from '../common/state/agentSubscription.js';
|
|
22
|
+
import { agentHostAuthority, identityAgentHostResourceUriMapper, createAgentHostResourceUriMapper, AGENT_HOST_SCHEME, fromAgentHostUri, toAgentHostUri } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostUri';
|
|
23
|
+
import { LOCAL_AGENT_HOST_RESOURCE_IDENTITY, AgentHostResourcePermissionError } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostResourceService';
|
|
24
|
+
import { IAgentHostResourceService } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostResourceService.service';
|
|
25
|
+
import { ActionType } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/common/actions';
|
|
26
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/common/notifications';
|
|
27
|
+
import { ROOT_STATE_URI, isAhpRootChannel, StateComponents, isDefaultChatUri } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/sessionState';
|
|
28
|
+
import { normalizeLegacyActionEnvelope } from '../common/state/legacyProtocolCompatibility.js';
|
|
29
|
+
import { SUPPORTED_PROTOCOL_VERSIONS } from '../common/state/protocol/version/registry.js';
|
|
30
|
+
import { ProtocolError, isJsonRpcRequest, isJsonRpcResponse, isJsonRpcNotification } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/sessionProtocol';
|
|
31
|
+
import { isClientTransport, NonReconnectableTransportError } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/sessionTransport';
|
|
32
|
+
import { AhpErrorCodes, JsonRpcErrorCodes } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/common/errors';
|
|
33
|
+
import { ReconnectResultType, ContentEncoding } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/common/commands';
|
|
34
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-session/commands';
|
|
35
|
+
import { ChatSourceKind } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-chat/commands';
|
|
36
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-changeset/commands';
|
|
37
|
+
import { decodeBase64, encodeBase64 } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
38
|
+
import { getExpirationTime, isExpired, getRemainingTimeInSeconds } from '@codingame/monaco-vscode-api/vscode/vs/base/common/date';
|
|
39
|
+
import { LoadEstimator } from '@codingame/monaco-vscode-api/vscode/vs/base/parts/ipc/common/ipc.net';
|
|
40
|
+
import { TELEMETRY_SETTING_ID, TELEMETRY_OLD_SETTING_ID, TELEMETRY_CRASH_REPORTER_SETTING_ID, TelemetryLevel } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry';
|
|
41
|
+
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
42
|
+
import { getTelemetryLevel } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetryUtils';
|
|
43
|
+
import { GLOBAL_AUTO_APPROVE_SETTING_ID, TERMINAL_AUTO_APPROVE_ENABLED_SETTING_ID, TERMINAL_AUTO_APPROVE_SETTING_ID, TERMINAL_IGNORE_DEFAULT_AUTO_APPROVE_RULES_SETTING_ID, DISABLE_REPO_INFO_TELEMETRY_SETTING_ID, AgentHostAutoApprovePolicyRestrictedConfigKey, AgentHostWorkspaceTrustConfigKey, AgentHostTelemetryLevelConfigKey, telemetryLevelToAgentHostConfigValue, AgentHostDisableRepoInfoTelemetryConfigKey, AgentHostTerminalAutoApproveEnabledConfigKey, AgentHostTerminalAutoApproveRulesConfigKey, getAgentHostTerminalAutoApproveRulesConfig } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostSchema';
|
|
44
|
+
import { getAgentHostConfigurationSyncEntries, getAgentHostConfigurationSyncTarget, resolveAgentHostConfigurationSyncValue, formatAgentHostConfigurationSyncValueForLog, resolveAgentHostConfigurationSyncPatch } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostConfigurationSync';
|
|
45
|
+
import { managedPermissionsConfigurationIds, resolveManagedSettingsPermissions } from '../common/agentHostManagedSettings.js';
|
|
46
|
+
import { toAgentHostClientMeta, AgentHostClientConnectionKind } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostTelemetry';
|
|
47
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
48
|
+
import { isFileResourceRead } from '../common/resourceReadLogging.js';
|
|
49
|
+
import { ResourceSet } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
50
|
+
import { DEFAULT_RECONNECT_POLICY, hasExhaustedReconnectAttempts, computeReconnectDelay } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/reconnectPolicy';
|
|
51
|
+
import { IWorkspaceTrustEnablementService, IWorkspaceTrustManagementService, IWorkspaceTrustRequestService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspaceTrust.service';
|
|
52
|
+
import { isWorktreeUnderRepository } from '../common/worktreePaths.js';
|
|
53
|
+
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
|
|
54
|
+
import { MessageAttachmentKind } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-chat/state';
|
|
55
|
+
|
|
56
|
+
const AHP_CLIENT_CONNECTION_CLOSED = -32e3;
|
|
57
|
+
const CLIENT_SUPPORTED_PROTOCOL_VERSIONS = SUPPORTED_PROTOCOL_VERSIONS.filter(version => version !== "0.8.0");
|
|
58
|
+
const PING_INTERVAL_MS = 5_000;
|
|
59
|
+
const LIVENESS_TIMEOUT_MS = 20_000;
|
|
60
|
+
function connectionTimeoutError(address, silenceMs) {
|
|
61
|
+
return ( new ProtocolError(
|
|
62
|
+
AHP_CLIENT_CONNECTION_CLOSED,
|
|
63
|
+
`Connection appears dead: ${address}; no message received for ${silenceMs}ms.`
|
|
64
|
+
));
|
|
65
|
+
}
|
|
66
|
+
function connectionClosedError(address) {
|
|
67
|
+
return ( new ProtocolError(AHP_CLIENT_CONNECTION_CLOSED, `Connection closed: ${address}`));
|
|
68
|
+
}
|
|
69
|
+
function connectionDisposedError(address) {
|
|
70
|
+
return ( new ProtocolError(AHP_CLIENT_CONNECTION_CLOSED, `Connection disposed: ${address}`));
|
|
71
|
+
}
|
|
72
|
+
function transportLostError(address) {
|
|
73
|
+
return ( new ProtocolError(AHP_CLIENT_CONNECTION_CLOSED, `Transport lost (reconnecting): ${address}`));
|
|
74
|
+
}
|
|
75
|
+
function isConnectionClosedError(error) {
|
|
76
|
+
return error instanceof ProtocolError && error.code === AHP_CLIENT_CONNECTION_CLOSED;
|
|
77
|
+
}
|
|
78
|
+
var AgentHostClientState;
|
|
79
|
+
(function(AgentHostClientState) {
|
|
80
|
+
AgentHostClientState["Connecting"] = "connecting";
|
|
81
|
+
AgentHostClientState["Incompatible"] = "incompatible";
|
|
82
|
+
AgentHostClientState["Connected"] = "connected";
|
|
83
|
+
AgentHostClientState["Reconnecting"] = "reconnecting";
|
|
84
|
+
AgentHostClientState["Closed"] = "closed";
|
|
85
|
+
})(AgentHostClientState || (AgentHostClientState = {}));
|
|
86
|
+
class InitialAuthenticationError extends Error {
|
|
87
|
+
constructor(error) {
|
|
88
|
+
super(
|
|
89
|
+
`Initial authentication failed: ${error instanceof Error ? error.message : String(error)}`
|
|
90
|
+
);
|
|
91
|
+
this.name = "InitialAuthenticationError";
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
let AgentHostProtocolClient = class AgentHostProtocolClient extends Disposable {
|
|
95
|
+
get clientId() {
|
|
96
|
+
return this._clientId;
|
|
97
|
+
}
|
|
98
|
+
get address() {
|
|
99
|
+
return this._address;
|
|
100
|
+
}
|
|
101
|
+
get defaultDirectory() {
|
|
102
|
+
return this._defaultDirectory;
|
|
103
|
+
}
|
|
104
|
+
get connectionState() {
|
|
105
|
+
return this._state.kind;
|
|
106
|
+
}
|
|
107
|
+
get nextReconnectAt() {
|
|
108
|
+
return this._state.kind === AgentHostClientState.Reconnecting ? this._state.reconnect.nextAttemptAt : undefined;
|
|
109
|
+
}
|
|
110
|
+
get initializeResult() {
|
|
111
|
+
return this._initializeResult;
|
|
112
|
+
}
|
|
113
|
+
constructor(
|
|
114
|
+
identity,
|
|
115
|
+
transportOrFactory,
|
|
116
|
+
options,
|
|
117
|
+
_logService,
|
|
118
|
+
_resourceService,
|
|
119
|
+
_configurationService,
|
|
120
|
+
_telemetryService,
|
|
121
|
+
_workspaceTrustEnablementService,
|
|
122
|
+
_workspaceTrustManagementService,
|
|
123
|
+
_workspaceTrustRequestService
|
|
124
|
+
) {
|
|
125
|
+
super();
|
|
126
|
+
this._logService = _logService;
|
|
127
|
+
this._resourceService = _resourceService;
|
|
128
|
+
this._configurationService = _configurationService;
|
|
129
|
+
this._telemetryService = _telemetryService;
|
|
130
|
+
this._workspaceTrustEnablementService = _workspaceTrustEnablementService;
|
|
131
|
+
this._workspaceTrustManagementService = _workspaceTrustManagementService;
|
|
132
|
+
this._workspaceTrustRequestService = _workspaceTrustRequestService;
|
|
133
|
+
this._transportListeners = this._register(( new MutableDisposable()));
|
|
134
|
+
this._serverSeq = 0;
|
|
135
|
+
this._nextClientSeq = 1;
|
|
136
|
+
this._initializeResult = observableValue("agentHostInitializeResult", undefined);
|
|
137
|
+
this._onDidAction = this._register(( new Emitter()));
|
|
138
|
+
this.onDidAction = this._onDidAction.event;
|
|
139
|
+
this._onDidNotification = this._register(( new Emitter()));
|
|
140
|
+
this.onDidNotification = this._onDidNotification.event;
|
|
141
|
+
this._onMcpNotification = this._register(( new Emitter()));
|
|
142
|
+
this.onMcpNotification = this._onMcpNotification.event;
|
|
143
|
+
this._onDidReceiveOtlpLogs = this._register(( new Emitter()));
|
|
144
|
+
this.onDidReceiveOtlpLogs = this._onDidReceiveOtlpLogs.event;
|
|
145
|
+
this._onDidClose = this._register(( new Emitter()));
|
|
146
|
+
this.onDidClose = this._onDidClose.event;
|
|
147
|
+
this._onDidFatalClose = this._register(( new Emitter()));
|
|
148
|
+
this.onDidFatalClose = this._onDidFatalClose.event;
|
|
149
|
+
this._onDidChangeConnectionState = this._register(( new Emitter()));
|
|
150
|
+
this.onDidChangeConnectionState = this._onDidChangeConnectionState.event;
|
|
151
|
+
this._onDidScheduleReconnect = this._register(( new Emitter()));
|
|
152
|
+
this.onDidScheduleReconnect = this._onDidScheduleReconnect.event;
|
|
153
|
+
this._state = {
|
|
154
|
+
kind: AgentHostClientState.Connecting,
|
|
155
|
+
outbox: []
|
|
156
|
+
};
|
|
157
|
+
this._pendingRequests = ( new Map());
|
|
158
|
+
this._authentication = ( new Map());
|
|
159
|
+
this._nextRequestId = 1;
|
|
160
|
+
this._pendingReverseRequests = ( new WeakMap());
|
|
161
|
+
this._livenessDeferred = false;
|
|
162
|
+
this._subscriptionsAwaitingRestore = ( new Set());
|
|
163
|
+
this._authenticationRestorePending = false;
|
|
164
|
+
this._lastReadTime = Date.now();
|
|
165
|
+
this._pingTimer = this._register(new TimeoutTimer());
|
|
166
|
+
this._closeTimer = this._register(new TimeoutTimer());
|
|
167
|
+
this._grantedImplicitReadUris = ( new ResourceSet());
|
|
168
|
+
this._implicitReadGrants = this._register(( new DisposableStore()));
|
|
169
|
+
this._resourceIdentity = identity;
|
|
170
|
+
this._address = identity === LOCAL_AGENT_HOST_RESOURCE_IDENTITY ? AMBIENT_AGENT_HOST_AUTHORITY : identity;
|
|
171
|
+
this._clientId = options?.clientId ?? generateUuid();
|
|
172
|
+
this._connectionAuthority = identity === LOCAL_AGENT_HOST_RESOURCE_IDENTITY ? AMBIENT_AGENT_HOST_AUTHORITY : agentHostAuthority(identity);
|
|
173
|
+
this.resourceUris = identity === LOCAL_AGENT_HOST_RESOURCE_IDENTITY ? identityAgentHostResourceUriMapper : createAgentHostResourceUriMapper(this._connectionAuthority);
|
|
174
|
+
this._loadEstimator = options?.loadEstimator ?? LoadEstimator.getInstance();
|
|
175
|
+
this._clientInfo = options?.clientInfo;
|
|
176
|
+
this._reconnectPolicy = options?.reconnectPolicy ?? DEFAULT_RECONNECT_POLICY;
|
|
177
|
+
this._resolveInitialAuthentication = options?.resolveInitialAuthentication;
|
|
178
|
+
if (typeof transportOrFactory === "function") {
|
|
179
|
+
this._transportFactory = transportOrFactory;
|
|
180
|
+
this._installTransport(transportOrFactory());
|
|
181
|
+
} else {
|
|
182
|
+
this._transportFactory = undefined;
|
|
183
|
+
this._installTransport(transportOrFactory);
|
|
184
|
+
}
|
|
185
|
+
this._subscriptionManager = this._register(( new AgentSubscriptionManager(
|
|
186
|
+
this._clientId,
|
|
187
|
+
() => this.nextClientSeq(),
|
|
188
|
+
msg => this._logService.warn(`[AgentHostProtocolClient] ${msg}`),
|
|
189
|
+
resource => this.subscribe(resource),
|
|
190
|
+
resource => this.unsubscribe(resource)
|
|
191
|
+
)));
|
|
192
|
+
this._register(this.onDidAction(envelope => {
|
|
193
|
+
this._subscriptionManager.receiveEnvelope(envelope);
|
|
194
|
+
}));
|
|
195
|
+
this._register(this._configurationService.onDidChangeConfiguration(e => {
|
|
196
|
+
if (this._state.kind !== AgentHostClientState.Connected) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const patch = {};
|
|
200
|
+
const mirrored = [];
|
|
201
|
+
if (e.source !== ConfigurationTarget.WORKSPACE && e.source !== ConfigurationTarget.WORKSPACE_FOLDER && e.source !== ConfigurationTarget.MEMORY) {
|
|
202
|
+
for (const entry of getAgentHostConfigurationSyncEntries(getAgentHostConfigurationSyncTarget(this._resourceIdentity))) {
|
|
203
|
+
if (!e.affectsConfiguration(entry.settingId)) {
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
const value = resolveAgentHostConfigurationSyncValue(this._configurationService, entry);
|
|
207
|
+
if (value !== undefined) {
|
|
208
|
+
patch[entry.sync.key] = value;
|
|
209
|
+
mirrored.push(
|
|
210
|
+
`${entry.sync.key}=${formatAgentHostConfigurationSyncValueForLog(entry.settingId, value)} (${entry.settingId})`
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (( Object.keys(patch)).length) {
|
|
216
|
+
this._logService.info(
|
|
217
|
+
`[RemoteAgentHostProtocol] Mirroring configuration to host root config from ${ConfigurationTargetToString(e.source)}: ${mirrored.join(", ")}`
|
|
218
|
+
);
|
|
219
|
+
this._dispatchRootConfig(patch);
|
|
220
|
+
}
|
|
221
|
+
if (e.affectsConfiguration(GLOBAL_AUTO_APPROVE_SETTING_ID)) {
|
|
222
|
+
this._updateAutoApprovePolicyRestriction();
|
|
223
|
+
}
|
|
224
|
+
if (e.affectsConfiguration(TELEMETRY_SETTING_ID) || e.affectsConfiguration(TELEMETRY_OLD_SETTING_ID) || e.affectsConfiguration(TELEMETRY_CRASH_REPORTER_SETTING_ID)) {
|
|
225
|
+
this._updateTelemetryLevel();
|
|
226
|
+
}
|
|
227
|
+
if (e.affectsConfiguration(TERMINAL_AUTO_APPROVE_ENABLED_SETTING_ID)) {
|
|
228
|
+
this._updateTerminalAutoApproveEnabled();
|
|
229
|
+
}
|
|
230
|
+
if (e.affectsConfiguration(TERMINAL_AUTO_APPROVE_SETTING_ID) || e.affectsConfiguration(TERMINAL_IGNORE_DEFAULT_AUTO_APPROVE_RULES_SETTING_ID)) {
|
|
231
|
+
this._updateTerminalAutoApproveRules();
|
|
232
|
+
}
|
|
233
|
+
if (e.affectsConfiguration(DISABLE_REPO_INFO_TELEMETRY_SETTING_ID)) {
|
|
234
|
+
this._updateDisableRepoInfoTelemetry();
|
|
235
|
+
}
|
|
236
|
+
if (( managedPermissionsConfigurationIds.some(settingId => e.affectsConfiguration(settingId)))) {
|
|
237
|
+
void this._updateManagedSettingsPermissions();
|
|
238
|
+
}
|
|
239
|
+
}));
|
|
240
|
+
this._register(Event.any(
|
|
241
|
+
this._workspaceTrustManagementService.onDidChangeTrustedFolders,
|
|
242
|
+
this._workspaceTrustManagementService.onDidChangeTrust
|
|
243
|
+
)(() => {
|
|
244
|
+
if (this._state.kind === AgentHostClientState.Connected) {
|
|
245
|
+
this._updateWorkspaceTrust();
|
|
246
|
+
}
|
|
247
|
+
}));
|
|
248
|
+
if (!isClientTransport(this._transport)) {
|
|
249
|
+
this._resetLivenessTimers();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
_installTransport(transport) {
|
|
253
|
+
const listeners = ( new DisposableStore());
|
|
254
|
+
listeners.add(transport);
|
|
255
|
+
listeners.add(transport.onMessage(msg => this._handleMessage(msg)));
|
|
256
|
+
listeners.add(transport.onClose(() => this._handleTransportClose()));
|
|
257
|
+
this._transport = transport;
|
|
258
|
+
this._transportListeners.value = listeners;
|
|
259
|
+
}
|
|
260
|
+
_transitionTo(next) {
|
|
261
|
+
if (this._state.kind === next.kind) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (this._state.kind === AgentHostClientState.Reconnecting) {
|
|
265
|
+
const reconnect = this._state.reconnect;
|
|
266
|
+
if (reconnect.timeoutHandle !== undefined) {
|
|
267
|
+
clearTimeout(reconnect.timeoutHandle);
|
|
268
|
+
reconnect.timeoutHandle = undefined;
|
|
269
|
+
}
|
|
270
|
+
reconnect.nextAttemptAt = undefined;
|
|
271
|
+
}
|
|
272
|
+
this._state = next;
|
|
273
|
+
this._onDidChangeConnectionState.fire(next.kind);
|
|
274
|
+
}
|
|
275
|
+
_newReconnectGate() {
|
|
276
|
+
const deferred = ( new DeferredPromise());
|
|
277
|
+
deferred.p.then(undefined, () => {});
|
|
278
|
+
return deferred;
|
|
279
|
+
}
|
|
280
|
+
_newReconnectState() {
|
|
281
|
+
return {
|
|
282
|
+
gate: this._newReconnectGate(),
|
|
283
|
+
outbox: [],
|
|
284
|
+
attempt: 0,
|
|
285
|
+
timeoutHandle: undefined,
|
|
286
|
+
nextAttemptAt: undefined
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
dispose() {
|
|
290
|
+
this._handleClose(connectionDisposedError(this._address));
|
|
291
|
+
super.dispose();
|
|
292
|
+
}
|
|
293
|
+
async connect() {
|
|
294
|
+
try {
|
|
295
|
+
if (isClientTransport(this._transport)) {
|
|
296
|
+
await this._raceClose(this._transport.connect());
|
|
297
|
+
}
|
|
298
|
+
if (this._state.kind !== AgentHostClientState.Connecting) {
|
|
299
|
+
throw transportLostError(this._address);
|
|
300
|
+
}
|
|
301
|
+
const result = await this._dispatchRequest("initialize", {
|
|
302
|
+
channel: ROOT_STATE_URI,
|
|
303
|
+
protocolVersions: [...CLIENT_SUPPORTED_PROTOCOL_VERSIONS],
|
|
304
|
+
clientId: this._clientId,
|
|
305
|
+
clientInfo: this._clientInfo,
|
|
306
|
+
_meta: this._clientMeta(),
|
|
307
|
+
initialSubscriptions: [ROOT_STATE_URI]
|
|
308
|
+
}, {
|
|
309
|
+
bypassInitializeQueue: true
|
|
310
|
+
});
|
|
311
|
+
this._applyInitializeResult(result);
|
|
312
|
+
if (this._resolveInitialAuthentication || this._authentication.size > 0) {
|
|
313
|
+
await this._restoreAuthenticationAfterFreshInitialize(AgentHostClientState.Connecting);
|
|
314
|
+
if (this._state.kind !== AgentHostClientState.Connecting) {
|
|
315
|
+
throw transportLostError(this._address);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
for (const snapshot of result.snapshots ?? []) {
|
|
319
|
+
if (isAhpRootChannel(snapshot.resource)) {
|
|
320
|
+
this._subscriptionManager.handleRootSnapshot(snapshot.state, snapshot.fromSeq);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (isClientTransport(this._transport) && this._state.kind === AgentHostClientState.Connecting) {
|
|
324
|
+
for (const message of this._state.outbox) {
|
|
325
|
+
this._transport.send(message);
|
|
326
|
+
}
|
|
327
|
+
this._state.outbox.length = 0;
|
|
328
|
+
}
|
|
329
|
+
this._transitionTo({
|
|
330
|
+
kind: AgentHostClientState.Connected
|
|
331
|
+
});
|
|
332
|
+
this._resetLivenessTimers();
|
|
333
|
+
} catch (error) {
|
|
334
|
+
const protocolError = error instanceof ProtocolError ? error : ( new ProtocolError(
|
|
335
|
+
AHP_CLIENT_CONNECTION_CLOSED,
|
|
336
|
+
error instanceof Error ? error.message : String(error)
|
|
337
|
+
));
|
|
338
|
+
if (protocolError.code === AhpErrorCodes.UnsupportedProtocolVersion || error instanceof InitialAuthenticationError) {
|
|
339
|
+
this._cancelLivenessTimers();
|
|
340
|
+
if (this._state.kind === AgentHostClientState.Connecting) {
|
|
341
|
+
this._state.outbox.length = 0;
|
|
342
|
+
}
|
|
343
|
+
this._rejectPendingRequests(protocolError);
|
|
344
|
+
this._transitionTo({
|
|
345
|
+
kind: AgentHostClientState.Incompatible,
|
|
346
|
+
error: protocolError
|
|
347
|
+
});
|
|
348
|
+
throw error;
|
|
349
|
+
}
|
|
350
|
+
if (error instanceof NonReconnectableTransportError) {
|
|
351
|
+
this._handleFatalClose(protocolError, error.reason);
|
|
352
|
+
throw error;
|
|
353
|
+
}
|
|
354
|
+
if (this._state.kind === AgentHostClientState.Reconnecting) {
|
|
355
|
+
throw error;
|
|
356
|
+
}
|
|
357
|
+
if (protocolError.code === AHP_CLIENT_CONNECTION_CLOSED && this._beginReconnectFromConnecting(protocolError)) {
|
|
358
|
+
throw error;
|
|
359
|
+
}
|
|
360
|
+
this._handleClose(protocolError);
|
|
361
|
+
throw error;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
notifyTransportClosed() {
|
|
365
|
+
this._handleTransportClose();
|
|
366
|
+
}
|
|
367
|
+
_handleTransportClose() {
|
|
368
|
+
switch (this._state.kind) {
|
|
369
|
+
case AgentHostClientState.Closed:
|
|
370
|
+
return;
|
|
371
|
+
case AgentHostClientState.Connecting:
|
|
372
|
+
if (!this._beginReconnectFromConnecting(connectionClosedError(this._address))) {
|
|
373
|
+
this._handleClose(connectionClosedError(this._address));
|
|
374
|
+
}
|
|
375
|
+
return;
|
|
376
|
+
case AgentHostClientState.Incompatible:
|
|
377
|
+
this._handleClose(connectionClosedError(this._address));
|
|
378
|
+
return;
|
|
379
|
+
case AgentHostClientState.Connected:
|
|
380
|
+
{
|
|
381
|
+
if (!this._transportFactory) {
|
|
382
|
+
this._handleClose(connectionClosedError(this._address));
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
if (!this._reconnectPolicy.autoRestore) {
|
|
386
|
+
const error = connectionClosedError(this._address);
|
|
387
|
+
this._logService.info(
|
|
388
|
+
`[RemoteAgentHostProtocol] Transport lost for ${this._address}; automatic reconnect is disabled.`
|
|
389
|
+
);
|
|
390
|
+
this._handleFatalClose(error);
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
this._logService.info(
|
|
394
|
+
`[RemoteAgentHostProtocol] Transport lost for ${this._address}; scheduling reconnect.`
|
|
395
|
+
);
|
|
396
|
+
this._transitionTo({
|
|
397
|
+
kind: AgentHostClientState.Reconnecting,
|
|
398
|
+
reconnect: this._newReconnectState()
|
|
399
|
+
});
|
|
400
|
+
this._cancelLivenessTimers();
|
|
401
|
+
this._rejectPendingRequests(transportLostError(this._address));
|
|
402
|
+
this._scheduleReconnect();
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
case AgentHostClientState.Reconnecting:
|
|
406
|
+
this._logService.info(
|
|
407
|
+
`[RemoteAgentHostProtocol] Transport lost for ${this._address} mid-reconnect; aborting the current attempt.`
|
|
408
|
+
);
|
|
409
|
+
this._cancelLivenessTimers();
|
|
410
|
+
this._rejectPendingRequests(transportLostError(this._address));
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
_beginReconnectFromConnecting(error) {
|
|
415
|
+
if (this._state.kind !== AgentHostClientState.Connecting || !this._transportFactory) {
|
|
416
|
+
return false;
|
|
417
|
+
}
|
|
418
|
+
if (!this._reconnectPolicy.autoRestore) {
|
|
419
|
+
this._logService.info(
|
|
420
|
+
`[RemoteAgentHostProtocol] Transport lost while connecting to ${this._address}; automatic reconnect is disabled.`
|
|
421
|
+
);
|
|
422
|
+
this._handleFatalClose(error);
|
|
423
|
+
return true;
|
|
424
|
+
}
|
|
425
|
+
this._logService.info(
|
|
426
|
+
`[RemoteAgentHostProtocol] Transport lost while connecting to ${this._address}; scheduling a fresh initialize.`
|
|
427
|
+
);
|
|
428
|
+
const outbox = this._state.outbox;
|
|
429
|
+
this._rejectPendingRequests(error);
|
|
430
|
+
this._grantedImplicitReadUris.clear();
|
|
431
|
+
this._implicitReadGrants.clear();
|
|
432
|
+
this._transitionTo({
|
|
433
|
+
kind: AgentHostClientState.Reconnecting,
|
|
434
|
+
reconnect: {
|
|
435
|
+
...this._newReconnectState(),
|
|
436
|
+
outbox
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
this._cancelLivenessTimers();
|
|
440
|
+
this._scheduleReconnect();
|
|
441
|
+
return true;
|
|
442
|
+
}
|
|
443
|
+
reconnectFromClosed() {
|
|
444
|
+
if (this._state.kind !== AgentHostClientState.Closed || !this._transportFactory || this._store.isDisposed) {
|
|
445
|
+
return false;
|
|
446
|
+
}
|
|
447
|
+
this._transitionTo({
|
|
448
|
+
kind: AgentHostClientState.Reconnecting,
|
|
449
|
+
reconnect: this._newReconnectState()
|
|
450
|
+
});
|
|
451
|
+
this._scheduleReconnect(true);
|
|
452
|
+
return true;
|
|
453
|
+
}
|
|
454
|
+
reconnectNow() {
|
|
455
|
+
if (this._state.kind !== AgentHostClientState.Reconnecting || this._state.reconnect.timeoutHandle === undefined) {
|
|
456
|
+
return false;
|
|
457
|
+
}
|
|
458
|
+
const reconnect = this._state.reconnect;
|
|
459
|
+
clearTimeout(reconnect.timeoutHandle);
|
|
460
|
+
reconnect.timeoutHandle = undefined;
|
|
461
|
+
reconnect.nextAttemptAt = undefined;
|
|
462
|
+
reconnect.attempt = 0;
|
|
463
|
+
this._onDidScheduleReconnect.fire();
|
|
464
|
+
void this._attemptReconnect();
|
|
465
|
+
return true;
|
|
466
|
+
}
|
|
467
|
+
_scheduleReconnect(userInitiated = false) {
|
|
468
|
+
if (this._state.kind !== AgentHostClientState.Reconnecting || !this._transportFactory) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
const reconnect = this._state.reconnect;
|
|
472
|
+
if (reconnect.timeoutHandle !== undefined) {
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
if (!userInitiated && !this._reconnectPolicy.autoRestore) {
|
|
476
|
+
const error = connectionClosedError(this._address);
|
|
477
|
+
this._logService.info(
|
|
478
|
+
`[RemoteAgentHostProtocol] Automatic reconnect to ${this._address} is disabled.`
|
|
479
|
+
);
|
|
480
|
+
this._handleFatalClose(error);
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
if (!userInitiated && hasExhaustedReconnectAttempts(this._reconnectPolicy, reconnect.attempt)) {
|
|
484
|
+
const error = ( new ProtocolError(
|
|
485
|
+
AHP_CLIENT_CONNECTION_CLOSED,
|
|
486
|
+
`Automatic reconnect gave up after ${reconnect.attempt} attempts.`
|
|
487
|
+
));
|
|
488
|
+
this._logService.warn(
|
|
489
|
+
`[RemoteAgentHostProtocol] Automatic reconnect to ${this._address} gave up after ${reconnect.attempt} attempts.`
|
|
490
|
+
);
|
|
491
|
+
this._handleFatalClose(error);
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
const attempt = reconnect.attempt + 1;
|
|
495
|
+
const delay = computeReconnectDelay(this._reconnectPolicy, attempt);
|
|
496
|
+
this._logService.info(
|
|
497
|
+
`[RemoteAgentHostProtocol] Reconnecting to ${this._address} in ${delay}ms (attempt ${attempt}).`
|
|
498
|
+
);
|
|
499
|
+
reconnect.nextAttemptAt = Date.now() + delay;
|
|
500
|
+
reconnect.timeoutHandle = setTimeout(() => {
|
|
501
|
+
if (this._state.kind === AgentHostClientState.Reconnecting) {
|
|
502
|
+
this._state.reconnect.timeoutHandle = undefined;
|
|
503
|
+
this._state.reconnect.nextAttemptAt = undefined;
|
|
504
|
+
}
|
|
505
|
+
void this._attemptReconnect();
|
|
506
|
+
}, delay);
|
|
507
|
+
this._onDidScheduleReconnect.fire();
|
|
508
|
+
}
|
|
509
|
+
async _attemptReconnect() {
|
|
510
|
+
if (this._state.kind !== AgentHostClientState.Reconnecting || !this._transportFactory) {
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
const reconnect = this._state.reconnect;
|
|
514
|
+
reconnect.attempt++;
|
|
515
|
+
let transport;
|
|
516
|
+
try {
|
|
517
|
+
transport = this._transportFactory();
|
|
518
|
+
this._installTransport(transport);
|
|
519
|
+
if (isClientTransport(transport)) {
|
|
520
|
+
await transport.connect();
|
|
521
|
+
}
|
|
522
|
+
if (this._state.kind !== AgentHostClientState.Reconnecting) {
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
const subscriptions = ( this._subscriptionManager.currentSubscriptionUris().map(u => ( u.toString())));
|
|
526
|
+
if (!subscriptions.includes(ROOT_STATE_URI)) {
|
|
527
|
+
subscriptions.unshift(ROOT_STATE_URI);
|
|
528
|
+
}
|
|
529
|
+
const lastSeenServerSeq = this._serverSeq;
|
|
530
|
+
const {
|
|
531
|
+
result,
|
|
532
|
+
freshInitialize
|
|
533
|
+
} = await this._reconnectOrInitialize(lastSeenServerSeq, subscriptions);
|
|
534
|
+
if (this._state.kind !== AgentHostClientState.Reconnecting) {
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
this._applyReconnectResult(result, freshInitialize);
|
|
538
|
+
this._updateManagedSettingsPermissions(true);
|
|
539
|
+
if ((freshInitialize && result.type === ReconnectResultType.Snapshot) || this._authenticationRestorePending) {
|
|
540
|
+
if (freshInitialize && result.type === ReconnectResultType.Snapshot) {
|
|
541
|
+
this._markSubscriptionsAwaitingRestore(result.snapshots);
|
|
542
|
+
}
|
|
543
|
+
await this._restoreAuthenticationAfterFreshInitialize(AgentHostClientState.Reconnecting);
|
|
544
|
+
if (this._state.kind !== AgentHostClientState.Reconnecting) {
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
if (this._subscriptionsAwaitingRestore.size > 0) {
|
|
549
|
+
await this._restoreSubscriptionsAwaitingRestore();
|
|
550
|
+
if (this._state.kind !== AgentHostClientState.Reconnecting) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
this._forwardClientConfig(false);
|
|
555
|
+
const {
|
|
556
|
+
gate
|
|
557
|
+
} = reconnect;
|
|
558
|
+
this._drainAfterReconnect(reconnect.outbox);
|
|
559
|
+
this._lastReadTime = Date.now();
|
|
560
|
+
this._resetLivenessTimers();
|
|
561
|
+
this._transitionTo({
|
|
562
|
+
kind: AgentHostClientState.Connected
|
|
563
|
+
});
|
|
564
|
+
gate.complete();
|
|
565
|
+
this._logService.info(`[RemoteAgentHostProtocol] Reconnected to ${this._address}.`);
|
|
566
|
+
} catch (err) {
|
|
567
|
+
this._logService.warn(
|
|
568
|
+
`[RemoteAgentHostProtocol] Reconnect attempt failed for ${this._address}: ${err instanceof Error ? err.message : String(err)}`
|
|
569
|
+
);
|
|
570
|
+
transport?.dispose();
|
|
571
|
+
if (this._state.kind !== AgentHostClientState.Reconnecting) {
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
if (err instanceof NonReconnectableTransportError) {
|
|
575
|
+
const protocolError = ( new ProtocolError(AHP_CLIENT_CONNECTION_CLOSED, err.message));
|
|
576
|
+
this._handleFatalClose(protocolError, err.reason);
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
if (err instanceof InitialAuthenticationError) {
|
|
580
|
+
const protocolError = ( new ProtocolError(AHP_CLIENT_CONNECTION_CLOSED, err.message));
|
|
581
|
+
this._cancelLivenessTimers();
|
|
582
|
+
this._rejectPendingRequests(protocolError);
|
|
583
|
+
reconnect.gate.error(err);
|
|
584
|
+
this._transitionTo({
|
|
585
|
+
kind: AgentHostClientState.Incompatible,
|
|
586
|
+
error: protocolError
|
|
587
|
+
});
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
const oldGate = this._state.reconnect.gate;
|
|
591
|
+
this._state.reconnect.gate = this._newReconnectGate();
|
|
592
|
+
oldGate.error(err);
|
|
593
|
+
this._scheduleReconnect();
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
async _reconnectOrInitialize(lastSeenServerSeq, subscriptions) {
|
|
597
|
+
try {
|
|
598
|
+
const result = await this._dispatchRequest("reconnect", {
|
|
599
|
+
clientId: this._clientId,
|
|
600
|
+
lastSeenServerSeq,
|
|
601
|
+
subscriptions,
|
|
602
|
+
_meta: this._clientMeta()
|
|
603
|
+
}, {
|
|
604
|
+
bypassReconnectGate: true
|
|
605
|
+
});
|
|
606
|
+
return {
|
|
607
|
+
result,
|
|
608
|
+
freshInitialize: false
|
|
609
|
+
};
|
|
610
|
+
} catch (error) {
|
|
611
|
+
if (!(error instanceof ProtocolError) || error.code !== AhpErrorCodes.NotFound) {
|
|
612
|
+
throw error;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
this._logService.info(
|
|
616
|
+
`[RemoteAgentHostProtocol] Server forgot client ${this._clientId}; initializing a fresh connection.`
|
|
617
|
+
);
|
|
618
|
+
const initializeResult = await this._dispatchRequest("initialize", {
|
|
619
|
+
channel: ROOT_STATE_URI,
|
|
620
|
+
protocolVersions: [...CLIENT_SUPPORTED_PROTOCOL_VERSIONS],
|
|
621
|
+
clientId: this._clientId,
|
|
622
|
+
clientInfo: this._clientInfo,
|
|
623
|
+
_meta: this._clientMeta(),
|
|
624
|
+
initialSubscriptions: subscriptions
|
|
625
|
+
}, {
|
|
626
|
+
bypassReconnectGate: true
|
|
627
|
+
});
|
|
628
|
+
this._applyInitializeResult(initializeResult, false);
|
|
629
|
+
return {
|
|
630
|
+
result: {
|
|
631
|
+
type: ReconnectResultType.Snapshot,
|
|
632
|
+
snapshots: initializeResult.snapshots ?? []
|
|
633
|
+
},
|
|
634
|
+
freshInitialize: true
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
_markSubscriptionsAwaitingRestore(initialSnapshots) {
|
|
638
|
+
const restored = ( new Set(( initialSnapshots.map(snapshot => snapshot.resource))));
|
|
639
|
+
this._subscriptionsAwaitingRestore.clear();
|
|
640
|
+
for (const subscription of this._subscriptionManager.getActiveSubscriptions()) {
|
|
641
|
+
const resource = ( subscription.resource.toString());
|
|
642
|
+
if (!( restored.has(resource))) {
|
|
643
|
+
this._subscriptionsAwaitingRestore.add(resource);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
async _restoreSubscriptionsAwaitingRestore() {
|
|
648
|
+
if (this._subscriptionsAwaitingRestore.size === 0) {
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
const pending = this._subscriptionManager.getActiveSubscriptions().filter(subscription => ( this._subscriptionsAwaitingRestore.has(( subscription.resource.toString()))));
|
|
652
|
+
this._subscriptionsAwaitingRestore.clear();
|
|
653
|
+
for (const subscription of pending) {
|
|
654
|
+
this._subscriptionsAwaitingRestore.add(( subscription.resource.toString()));
|
|
655
|
+
this._subscriptionManager.beginSnapshotRefresh(subscription.resource);
|
|
656
|
+
}
|
|
657
|
+
const restoreGroup = async subscriptions => {
|
|
658
|
+
await Promise.all(( subscriptions.map(async subscription => {
|
|
659
|
+
const resource = ( subscription.resource.toString());
|
|
660
|
+
try {
|
|
661
|
+
const result = await this._dispatchRequest("subscribe", {
|
|
662
|
+
channel: resource
|
|
663
|
+
}, {
|
|
664
|
+
bypassReconnectGate: true
|
|
665
|
+
});
|
|
666
|
+
if (!result.snapshot) {
|
|
667
|
+
throw ( new Error(`subscribe returned no snapshot for ${resource}`));
|
|
668
|
+
}
|
|
669
|
+
this._subscriptionManager.applyReconnectSnapshot(
|
|
670
|
+
result.snapshot.resource,
|
|
671
|
+
result.snapshot.state,
|
|
672
|
+
result.snapshot.fromSeq,
|
|
673
|
+
true
|
|
674
|
+
);
|
|
675
|
+
this._serverSeq = Math.max(this._serverSeq, result.snapshot.fromSeq);
|
|
676
|
+
this._subscriptionsAwaitingRestore.delete(resource);
|
|
677
|
+
} catch (error) {
|
|
678
|
+
if (error instanceof ProtocolError && error.code === AHP_CLIENT_CONNECTION_CLOSED) {
|
|
679
|
+
this._subscriptionManager.cancelSnapshotRefresh(subscription.resource);
|
|
680
|
+
throw error;
|
|
681
|
+
}
|
|
682
|
+
this._logService.warn(
|
|
683
|
+
`[AgentHostProtocolClient] Failed to restore subscription ${resource} after host restart: ${error instanceof Error ? error.message : String(error)}`
|
|
684
|
+
);
|
|
685
|
+
this._subscriptionManager.cancelSnapshotRefresh(subscription.resource);
|
|
686
|
+
this._subscriptionManager.markSubscriptionsMissing([subscription.resource]);
|
|
687
|
+
this._subscriptionsAwaitingRestore.delete(resource);
|
|
688
|
+
}
|
|
689
|
+
})));
|
|
690
|
+
};
|
|
691
|
+
await restoreGroup(
|
|
692
|
+
pending.filter(subscription => subscription.kind === StateComponents.Session)
|
|
693
|
+
);
|
|
694
|
+
await Promise.all([
|
|
695
|
+
restoreGroup(pending.filter(subscription => subscription.kind === StateComponents.Chat)),
|
|
696
|
+
restoreGroup(pending.filter(
|
|
697
|
+
subscription => subscription.kind !== StateComponents.Session && subscription.kind !== StateComponents.Chat
|
|
698
|
+
))
|
|
699
|
+
]);
|
|
700
|
+
}
|
|
701
|
+
async _restoreAuthenticationAfterFreshInitialize(expectedState) {
|
|
702
|
+
this._authenticationRestorePending = true;
|
|
703
|
+
let initialAuthenticationKey;
|
|
704
|
+
if (this._resolveInitialAuthentication) {
|
|
705
|
+
try {
|
|
706
|
+
const initialAuthentication = await this._resolveInitialAuthentication();
|
|
707
|
+
if (initialAuthentication) {
|
|
708
|
+
const normalizedParams = this._normalizeAuthenticationParams(initialAuthentication);
|
|
709
|
+
initialAuthenticationKey = this._authenticationKey(normalizedParams);
|
|
710
|
+
const expiresAt = getExpirationTime(normalizedParams.expiresIn);
|
|
711
|
+
this._authentication.set(initialAuthenticationKey, {
|
|
712
|
+
params: normalizedParams,
|
|
713
|
+
expiresAt
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
} catch (error) {
|
|
717
|
+
throw ( new InitialAuthenticationError(error));
|
|
718
|
+
}
|
|
719
|
+
if (this._state.kind !== expectedState) {
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
await Promise.all(( [...this._authentication.entries()].map(async ([key, authentication]) => {
|
|
724
|
+
const now = Date.now();
|
|
725
|
+
if (isExpired(authentication.expiresAt, now)) {
|
|
726
|
+
this._authentication.delete(key);
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
const expiresIn = getRemainingTimeInSeconds(authentication.expiresAt, now);
|
|
730
|
+
const params = authentication.params;
|
|
731
|
+
try {
|
|
732
|
+
await this._dispatchRequest("authenticate", {
|
|
733
|
+
channel: ROOT_STATE_URI,
|
|
734
|
+
...params,
|
|
735
|
+
scopes: params.scopes ? [...params.scopes] : undefined,
|
|
736
|
+
...(expiresIn === undefined ? {} : {
|
|
737
|
+
expiresIn
|
|
738
|
+
})
|
|
739
|
+
}, this._state.kind === AgentHostClientState.Connecting ? {
|
|
740
|
+
bypassInitializeQueue: true,
|
|
741
|
+
bypassReconnectGate: true
|
|
742
|
+
} : {
|
|
743
|
+
bypassReconnectGate: true
|
|
744
|
+
});
|
|
745
|
+
} catch (error) {
|
|
746
|
+
if (isConnectionClosedError(error)) {
|
|
747
|
+
throw error;
|
|
748
|
+
}
|
|
749
|
+
if (key === initialAuthenticationKey) {
|
|
750
|
+
throw ( new InitialAuthenticationError(error));
|
|
751
|
+
}
|
|
752
|
+
this._logService.warn(
|
|
753
|
+
`[AgentHostProtocolClient] Failed to restore authentication for ${params.resource} after host restart: ${error instanceof Error ? error.message : String(error)}`
|
|
754
|
+
);
|
|
755
|
+
}
|
|
756
|
+
})));
|
|
757
|
+
this._authenticationRestorePending = false;
|
|
758
|
+
}
|
|
759
|
+
_clientMeta() {
|
|
760
|
+
const telemetryLevel = this._effectiveTelemetryLevel();
|
|
761
|
+
const sendIdentity = telemetryLevel >= TelemetryLevel.USAGE;
|
|
762
|
+
return toAgentHostClientMeta(
|
|
763
|
+
this._transport.clientConnectionKind,
|
|
764
|
+
telemetryLevel,
|
|
765
|
+
sendIdentity ? this._telemetryService.machineId : undefined,
|
|
766
|
+
sendIdentity ? this._telemetryService.devDeviceId : undefined
|
|
767
|
+
);
|
|
768
|
+
}
|
|
769
|
+
_applyInitializeResult(result, forwardClientConfig = true) {
|
|
770
|
+
this._initializeResult.set(result, undefined);
|
|
771
|
+
this._serverSeq = result.serverSeq;
|
|
772
|
+
if (result.defaultDirectory) {
|
|
773
|
+
const directory = result.defaultDirectory;
|
|
774
|
+
this._defaultDirectory = typeof directory === "string" ? ( URI.parse(directory)).path : URI.revive(directory).path;
|
|
775
|
+
}
|
|
776
|
+
if (forwardClientConfig) {
|
|
777
|
+
this._forwardClientConfig();
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
_forwardClientConfig(includeManagedSettings = true) {
|
|
781
|
+
this._dispatchRootConfig(resolveAgentHostConfigurationSyncPatch(
|
|
782
|
+
this._configurationService,
|
|
783
|
+
getAgentHostConfigurationSyncTarget(this._resourceIdentity)
|
|
784
|
+
));
|
|
785
|
+
this._updateTelemetryLevel();
|
|
786
|
+
this._updateTerminalAutoApproveEnabled();
|
|
787
|
+
this._updateTerminalAutoApproveRules();
|
|
788
|
+
this._updateAutoApprovePolicyRestriction();
|
|
789
|
+
this._updateWorkspaceTrust();
|
|
790
|
+
this._updateDisableRepoInfoTelemetry();
|
|
791
|
+
if (includeManagedSettings) {
|
|
792
|
+
void this._updateManagedSettingsPermissions();
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
_updateAutoApprovePolicyRestriction() {
|
|
796
|
+
const policyRestricted = this._configurationService.inspect(GLOBAL_AUTO_APPROVE_SETTING_ID)?.policyValue === false;
|
|
797
|
+
this._dispatchRootConfig({
|
|
798
|
+
[AgentHostAutoApprovePolicyRestrictedConfigKey]: policyRestricted
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
_updateWorkspaceTrust() {
|
|
802
|
+
const remoteAuthority = typeof this._resourceIdentity === "string" && this._resourceIdentity.startsWith(`${Schemas.vscodeRemote}://`) ? ( URI.parse(this._resourceIdentity)).authority : undefined;
|
|
803
|
+
const trustedUris = ( ( this._workspaceTrustManagementService.getTrustedUris().filter(
|
|
804
|
+
uri => this._resourceIdentity === LOCAL_AGENT_HOST_RESOURCE_IDENTITY ? uri.scheme === Schemas.file : (uri.scheme === AGENT_HOST_SCHEME && uri.authority === this._connectionAuthority) || (remoteAuthority !== undefined && uri.scheme === Schemas.vscodeRemote && uri.authority === remoteAuthority)
|
|
805
|
+
).map(uri => uri.scheme === Schemas.vscodeRemote ? uri.with({
|
|
806
|
+
scheme: Schemas.file,
|
|
807
|
+
authority: ""
|
|
808
|
+
}) : this.resourceUris.toAgentHost(uri))).filter(uri => uri.scheme === Schemas.file).map(uri => ( uri.toString())));
|
|
809
|
+
this._dispatchRootConfig({
|
|
810
|
+
[AgentHostWorkspaceTrustConfigKey]: {
|
|
811
|
+
enabled: this._workspaceTrustEnablementService.isWorkspaceTrustEnabled(),
|
|
812
|
+
trustedUris
|
|
813
|
+
}
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
_applyReconnectResult(result, preservePending = false) {
|
|
817
|
+
if (result.type === ReconnectResultType.Replay) {
|
|
818
|
+
let maxSeq = this._serverSeq;
|
|
819
|
+
for (const envelope of result.actions) {
|
|
820
|
+
if (envelope.origin?.clientId === this._clientId && envelope.origin.clientSeq !== undefined && !envelope.rejectionReason) {
|
|
821
|
+
this._subscriptionManager.dropPendingAction(envelope.channel, envelope.origin.clientSeq);
|
|
822
|
+
}
|
|
823
|
+
if (envelope.serverSeq > maxSeq) {
|
|
824
|
+
maxSeq = envelope.serverSeq;
|
|
825
|
+
}
|
|
826
|
+
this._onDidAction.fire(normalizeLegacyActionEnvelope(envelope));
|
|
827
|
+
}
|
|
828
|
+
this._serverSeq = maxSeq;
|
|
829
|
+
if (result.missing.length > 0) {
|
|
830
|
+
this._logService.info(
|
|
831
|
+
`[RemoteAgentHostProtocol] Server cannot resume ${result.missing.length} subscription(s) after reconnect.`
|
|
832
|
+
);
|
|
833
|
+
this._subscriptionManager.markSubscriptionsMissing(( result.missing.map(u => ( URI.parse(u)))));
|
|
834
|
+
for (const resource of result.missing) {
|
|
835
|
+
this._subscriptionsAwaitingRestore.delete(resource);
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
} else {
|
|
839
|
+
let maxSeq = this._serverSeq;
|
|
840
|
+
for (const snapshot of result.snapshots) {
|
|
841
|
+
this._subscriptionManager.applyReconnectSnapshot(snapshot.resource, snapshot.state, snapshot.fromSeq, preservePending);
|
|
842
|
+
this._subscriptionsAwaitingRestore.delete(snapshot.resource);
|
|
843
|
+
if (snapshot.fromSeq > maxSeq) {
|
|
844
|
+
maxSeq = snapshot.fromSeq;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
this._serverSeq = maxSeq;
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
_drainAfterReconnect(outbox) {
|
|
851
|
+
const queuedSeqs = ( new Set());
|
|
852
|
+
for (const msg of outbox) {
|
|
853
|
+
if (hasKey(msg, {
|
|
854
|
+
method: true
|
|
855
|
+
}) && msg.method === "dispatchAction") {
|
|
856
|
+
queuedSeqs.add(msg.params.clientSeq);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
const replays = [];
|
|
860
|
+
for (const entry of this._subscriptionManager.getPendingActions()) {
|
|
861
|
+
if (( queuedSeqs.has(entry.clientSeq))) {
|
|
862
|
+
continue;
|
|
863
|
+
}
|
|
864
|
+
this._grantImplicitReadsForOutgoingAction(entry.action);
|
|
865
|
+
replays.push({
|
|
866
|
+
jsonrpc: "2.0",
|
|
867
|
+
method: "dispatchAction",
|
|
868
|
+
params: {
|
|
869
|
+
channel: entry.channel,
|
|
870
|
+
clientSeq: entry.clientSeq,
|
|
871
|
+
action: entry.action
|
|
872
|
+
}
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
if (replays.length > 0) {
|
|
876
|
+
this._logService.info(
|
|
877
|
+
`[RemoteAgentHostProtocol] Replaying ${replays.length} pending action(s) after reconnect to ${this._address}.`
|
|
878
|
+
);
|
|
879
|
+
}
|
|
880
|
+
for (const msg of replays) {
|
|
881
|
+
this._transport.send(msg);
|
|
882
|
+
}
|
|
883
|
+
for (const msg of outbox) {
|
|
884
|
+
this._transport.send(msg);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
get rootState() {
|
|
888
|
+
return this._subscriptionManager.rootState;
|
|
889
|
+
}
|
|
890
|
+
getSubscription(kind, resource, owner) {
|
|
891
|
+
return this._subscriptionManager.getSubscription(kind, resource, owner);
|
|
892
|
+
}
|
|
893
|
+
getSubscriptionUnmanaged(_kind, resource) {
|
|
894
|
+
return this._subscriptionManager.getSubscriptionUnmanaged(resource);
|
|
895
|
+
}
|
|
896
|
+
getInflightSessionCreate(resource) {
|
|
897
|
+
return this._subscriptionManager.getInflightSessionCreate(resource);
|
|
898
|
+
}
|
|
899
|
+
trackSessionCreate(resource, promise) {
|
|
900
|
+
this._subscriptionManager.trackSessionCreate(resource, promise);
|
|
901
|
+
}
|
|
902
|
+
getActiveSubscriptions() {
|
|
903
|
+
return this._subscriptionManager.getActiveSubscriptions();
|
|
904
|
+
}
|
|
905
|
+
dispatch(channel, action) {
|
|
906
|
+
const seq = this._subscriptionManager.dispatchOptimistic(channel, action);
|
|
907
|
+
this.dispatchAction(channel, action, this._clientId, seq);
|
|
908
|
+
}
|
|
909
|
+
async subscribe(resource) {
|
|
910
|
+
this._logService.trace(`[RemoteAgentHostProtocol] subscribe start: ${( resource.toString())}`);
|
|
911
|
+
const result = await this._sendRequest("subscribe", {
|
|
912
|
+
channel: ( resource.toString())
|
|
913
|
+
});
|
|
914
|
+
if (!result.snapshot) {
|
|
915
|
+
throw ( new Error(`subscribe to ${( resource.toString())} returned no snapshot`));
|
|
916
|
+
}
|
|
917
|
+
this._logService.trace(`[RemoteAgentHostProtocol] subscribe done: ${( resource.toString())}`);
|
|
918
|
+
return result.snapshot;
|
|
919
|
+
}
|
|
920
|
+
async subscribeStateless(resource) {
|
|
921
|
+
await this._sendRequest("subscribe", {
|
|
922
|
+
channel: ( resource.toString())
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
unsubscribe(resource) {
|
|
926
|
+
this._sendNotification("unsubscribe", {
|
|
927
|
+
channel: ( resource.toString())
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
dispatchAction(channel, action, _clientId, clientSeq) {
|
|
931
|
+
this._grantImplicitReadsForOutgoingAction(action);
|
|
932
|
+
this._sendNotification("dispatchAction", {
|
|
933
|
+
channel,
|
|
934
|
+
clientSeq,
|
|
935
|
+
action
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
createSession(config) {
|
|
939
|
+
const provider = config?.provider;
|
|
940
|
+
if (!provider) {
|
|
941
|
+
throw ( new Error("Cannot create remote agent host session without a provider."));
|
|
942
|
+
}
|
|
943
|
+
const session = config?.session ?? AgentSession.uri(provider, generateUuid());
|
|
944
|
+
if (config?.activeClient?.customizations) {
|
|
945
|
+
this._grantImplicitReadsForCustomizations(config.activeClient.customizations);
|
|
946
|
+
}
|
|
947
|
+
const promise = this._sendRequest("createSession", {
|
|
948
|
+
channel: ( session.toString()),
|
|
949
|
+
_meta: config?._meta,
|
|
950
|
+
provider,
|
|
951
|
+
workingDirectories: config?.workingDirectories?.map(d => ( fromAgentHostUri(d).toString())),
|
|
952
|
+
config: config?.config,
|
|
953
|
+
activeClient: config?.activeClient,
|
|
954
|
+
progressToken: config?.progressToken
|
|
955
|
+
}).then(() => session);
|
|
956
|
+
this._subscriptionManager.trackSessionCreate(session, promise);
|
|
957
|
+
return promise;
|
|
958
|
+
}
|
|
959
|
+
async removeSessionArtifact(session, artifactId) {
|
|
960
|
+
await this._sendExtensionRequest(RemoveSessionArtifactExtensionMethod, {
|
|
961
|
+
session: ( session.toString()),
|
|
962
|
+
artifactId
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
async createDetachedWorktree(session, prompt) {
|
|
966
|
+
const result = await this._sendExtensionRequest(CreateAgentHostDetachedWorktreeExtensionMethod, {
|
|
967
|
+
session: ( session.toString()),
|
|
968
|
+
prompt
|
|
969
|
+
});
|
|
970
|
+
if (!result) {
|
|
971
|
+
throw ( new Error("Agent Host does not support detached worktrees."));
|
|
972
|
+
}
|
|
973
|
+
return {
|
|
974
|
+
handle: result.handle,
|
|
975
|
+
worktree: ( URI.parse(result.resource))
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
async setDetachedWorktreeArchived(handle, archived) {
|
|
979
|
+
await this._sendExtensionRequest(SetAgentHostDetachedWorktreeArchivedExtensionMethod, {
|
|
980
|
+
handle,
|
|
981
|
+
archived
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
async claimDetachedWorktree(handle) {
|
|
985
|
+
await this._sendExtensionRequest(ClaimAgentHostDetachedWorktreeExtensionMethod, {
|
|
986
|
+
handle
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
async deleteDetachedWorktree(handle) {
|
|
990
|
+
await this._sendExtensionRequest(DeleteAgentHostDetachedWorktreeExtensionMethod, {
|
|
991
|
+
handle
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
async reconcileDetachedWorktrees(scope, activeHandles) {
|
|
995
|
+
await this._sendExtensionRequest(ReconcileAgentHostDetachedWorktreesExtensionMethod, {
|
|
996
|
+
scope,
|
|
997
|
+
activeHandles: [...activeHandles]
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
async resolveSessionConfig(params) {
|
|
1001
|
+
return this._sendRequest("resolveSessionConfig", {
|
|
1002
|
+
channel: ROOT_STATE_URI,
|
|
1003
|
+
provider: params.provider,
|
|
1004
|
+
workingDirectory: params.workingDirectory ? ( fromAgentHostUri(params.workingDirectory).toString()) : undefined,
|
|
1005
|
+
config: params.config
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
async sessionConfigCompletions(params) {
|
|
1009
|
+
return this._sendRequest("sessionConfigCompletions", {
|
|
1010
|
+
channel: ROOT_STATE_URI,
|
|
1011
|
+
provider: params.provider,
|
|
1012
|
+
workingDirectory: params.workingDirectory ? ( fromAgentHostUri(params.workingDirectory).toString()) : undefined,
|
|
1013
|
+
config: params.config,
|
|
1014
|
+
property: params.property,
|
|
1015
|
+
query: params.query
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
async completions(params) {
|
|
1019
|
+
return this._sendRequest("completions", params);
|
|
1020
|
+
}
|
|
1021
|
+
async listAutomationTriggerDefinitions(params) {
|
|
1022
|
+
return this._sendRequest("listAutomationTriggerDefinitions", params);
|
|
1023
|
+
}
|
|
1024
|
+
async runAutomation(params) {
|
|
1025
|
+
return this._sendRequest("runAutomation", params);
|
|
1026
|
+
}
|
|
1027
|
+
async fetchAutomationRuns(params) {
|
|
1028
|
+
return this._sendRequest("fetchAutomationRuns", params);
|
|
1029
|
+
}
|
|
1030
|
+
async ping() {
|
|
1031
|
+
await this._sendRequest("ping", {
|
|
1032
|
+
channel: ROOT_STATE_URI
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
async getCompletionTriggerCharacters() {
|
|
1036
|
+
while (this._state.kind === AgentHostClientState.Connecting) {
|
|
1037
|
+
await Event.toPromise(this.onDidChangeConnectionState);
|
|
1038
|
+
}
|
|
1039
|
+
switch (this._state.kind) {
|
|
1040
|
+
case AgentHostClientState.Incompatible:
|
|
1041
|
+
case AgentHostClientState.Closed:
|
|
1042
|
+
throw this._state.error;
|
|
1043
|
+
case AgentHostClientState.Connected:
|
|
1044
|
+
case AgentHostClientState.Reconnecting:
|
|
1045
|
+
return this._initializeResult.get()?.completionTriggerCharacters ?? [];
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
async authenticate(params) {
|
|
1049
|
+
const normalizedParams = this._normalizeAuthenticationParams(params);
|
|
1050
|
+
const expiresAt = getExpirationTime(params.expiresIn);
|
|
1051
|
+
await this._sendRequest("authenticate", {
|
|
1052
|
+
channel: ROOT_STATE_URI,
|
|
1053
|
+
...normalizedParams,
|
|
1054
|
+
scopes: normalizedParams.scopes ? [...normalizedParams.scopes] : undefined
|
|
1055
|
+
});
|
|
1056
|
+
const key = this._authenticationKey(normalizedParams);
|
|
1057
|
+
if (params.token) {
|
|
1058
|
+
this._authentication.set(key, {
|
|
1059
|
+
params: normalizedParams,
|
|
1060
|
+
expiresAt
|
|
1061
|
+
});
|
|
1062
|
+
} else {
|
|
1063
|
+
this._authentication.delete(key);
|
|
1064
|
+
}
|
|
1065
|
+
return {
|
|
1066
|
+
authenticated: true
|
|
1067
|
+
};
|
|
1068
|
+
}
|
|
1069
|
+
_normalizeAuthenticationParams(params) {
|
|
1070
|
+
return {
|
|
1071
|
+
...params,
|
|
1072
|
+
scopes: params.scopes ? [...( new Set(params.scopes))].sort() : undefined
|
|
1073
|
+
};
|
|
1074
|
+
}
|
|
1075
|
+
_authenticationKey(params) {
|
|
1076
|
+
return `${params.resource}\0${JSON.stringify(params.scopes ?? [])}`;
|
|
1077
|
+
}
|
|
1078
|
+
async shutdown() {
|
|
1079
|
+
await this._sendExtensionRequest("shutdown");
|
|
1080
|
+
}
|
|
1081
|
+
async getNetworkDiagnosticsInfo() {
|
|
1082
|
+
return this._sendExtensionRequest("getNetworkDiagnosticsInfo");
|
|
1083
|
+
}
|
|
1084
|
+
async getManagedSettingsDiagnostics() {
|
|
1085
|
+
return this._sendExtensionRequest("getManagedSettingsDiagnostics");
|
|
1086
|
+
}
|
|
1087
|
+
async getSessionStateFile(session, chat) {
|
|
1088
|
+
const targetChat = chat && !isDefaultChatUri(chat) ? chat : undefined;
|
|
1089
|
+
if (targetChat && !supportsAgentHostChatStateFile(this._initializeResult.get())) {
|
|
1090
|
+
return undefined;
|
|
1091
|
+
}
|
|
1092
|
+
const result = await this._sendExtensionRequest(GetAgentHostSessionStateFileExtensionMethod, {
|
|
1093
|
+
session: ( session.toString()),
|
|
1094
|
+
chat: targetChat?.toString()
|
|
1095
|
+
});
|
|
1096
|
+
if (!result.resource) {
|
|
1097
|
+
return undefined;
|
|
1098
|
+
}
|
|
1099
|
+
const resource = ( URI.parse(result.resource, true));
|
|
1100
|
+
if (resource.scheme !== Schemas.file) {
|
|
1101
|
+
throw ( new ProtocolError(
|
|
1102
|
+
JsonRpcErrorCodes.InvalidParams,
|
|
1103
|
+
`Agent Host returned a non-file session state resource: ${( resource.toString())}`
|
|
1104
|
+
));
|
|
1105
|
+
}
|
|
1106
|
+
return toAgentHostUri(resource, this._connectionAuthority);
|
|
1107
|
+
}
|
|
1108
|
+
async collectDebugLogs(session, kind, chat) {
|
|
1109
|
+
const result = await this._sendExtensionRequest(CollectAgentHostDebugLogsExtensionMethod, {
|
|
1110
|
+
session: session?.toString(),
|
|
1111
|
+
chat: chat?.toString(),
|
|
1112
|
+
kind
|
|
1113
|
+
});
|
|
1114
|
+
if (result.kind !== kind) {
|
|
1115
|
+
throw ( new ProtocolError(
|
|
1116
|
+
JsonRpcErrorCodes.InvalidParams,
|
|
1117
|
+
`Agent Host returned ${result.kind} debug logs for a ${kind} request`
|
|
1118
|
+
));
|
|
1119
|
+
}
|
|
1120
|
+
const resource = ( URI.parse(result.resource, true));
|
|
1121
|
+
if (resource.scheme !== Schemas.file) {
|
|
1122
|
+
throw ( new ProtocolError(
|
|
1123
|
+
JsonRpcErrorCodes.InvalidParams,
|
|
1124
|
+
`Agent Host returned a non-file debug log resource: ${( resource.toString())}`
|
|
1125
|
+
));
|
|
1126
|
+
}
|
|
1127
|
+
if (!Number.isSafeInteger(result.size) || result.size < 0 || !Number.isSafeInteger(result.uncompressedSize) || result.uncompressedSize < 0) {
|
|
1128
|
+
throw ( new ProtocolError(
|
|
1129
|
+
JsonRpcErrorCodes.InvalidParams,
|
|
1130
|
+
"Agent Host returned invalid debug log artifact sizes"
|
|
1131
|
+
));
|
|
1132
|
+
}
|
|
1133
|
+
if (!Array.isArray(result.entries) || result.entries.length > AGENT_HOST_DEBUG_LOGS_MAX_ENTRIES) {
|
|
1134
|
+
throw ( new ProtocolError(
|
|
1135
|
+
JsonRpcErrorCodes.InvalidParams,
|
|
1136
|
+
"Agent Host returned an invalid debug log artifact manifest"
|
|
1137
|
+
));
|
|
1138
|
+
}
|
|
1139
|
+
const entryPaths = ( new Set());
|
|
1140
|
+
let manifestSize = 0;
|
|
1141
|
+
for (const entry of result.entries) {
|
|
1142
|
+
const segments = entry.path.split("/");
|
|
1143
|
+
if (!entry.path || entry.path.includes("\\") || ( segments.some(segment => !segment || segment === "." || segment === "..")) || !Number.isSafeInteger(entry.size) || entry.size < 0 || ( entryPaths.has(entry.path))) {
|
|
1144
|
+
throw ( new ProtocolError(
|
|
1145
|
+
JsonRpcErrorCodes.InvalidParams,
|
|
1146
|
+
"Agent Host returned an invalid debug log artifact manifest entry"
|
|
1147
|
+
));
|
|
1148
|
+
}
|
|
1149
|
+
entryPaths.add(entry.path);
|
|
1150
|
+
manifestSize += entry.size;
|
|
1151
|
+
}
|
|
1152
|
+
if (!Number.isSafeInteger(manifestSize) || manifestSize !== result.uncompressedSize) {
|
|
1153
|
+
throw ( new ProtocolError(
|
|
1154
|
+
JsonRpcErrorCodes.InvalidParams,
|
|
1155
|
+
"Agent Host debug log artifact manifest size does not match its declared size"
|
|
1156
|
+
));
|
|
1157
|
+
}
|
|
1158
|
+
return {
|
|
1159
|
+
kind: result.kind,
|
|
1160
|
+
resource: toAgentHostUri(resource, this._connectionAuthority),
|
|
1161
|
+
providerLogsIncluded: result.providerLogsIncluded,
|
|
1162
|
+
size: result.size,
|
|
1163
|
+
uncompressedSize: result.uncompressedSize,
|
|
1164
|
+
entries: result.entries
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
async readDebugLogsChunk(resource, position) {
|
|
1168
|
+
const result = await this._sendExtensionRequest(ReadAgentHostDebugLogsChunkExtensionMethod, {
|
|
1169
|
+
resource: ( fromAgentHostUri(resource).toString()),
|
|
1170
|
+
position
|
|
1171
|
+
});
|
|
1172
|
+
const data = decodeBase64(result.data);
|
|
1173
|
+
if (data.byteLength > AGENT_HOST_DEBUG_LOGS_CHUNK_BYTES) {
|
|
1174
|
+
throw ( new ProtocolError(
|
|
1175
|
+
JsonRpcErrorCodes.InvalidParams,
|
|
1176
|
+
"Agent Host returned an oversized debug log chunk"
|
|
1177
|
+
));
|
|
1178
|
+
}
|
|
1179
|
+
return {
|
|
1180
|
+
data,
|
|
1181
|
+
eof: result.eof === true
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
async diagnosticsFetch(url) {
|
|
1185
|
+
return this._sendExtensionRequest("diagnosticsFetch", {
|
|
1186
|
+
url
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
async disposeSession(session) {
|
|
1190
|
+
await this._sendRequest("disposeSession", {
|
|
1191
|
+
channel: ( session.toString())
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
async createChat(session, chat, options) {
|
|
1195
|
+
await this._sendRequest("createChat", {
|
|
1196
|
+
channel: ( session.toString()),
|
|
1197
|
+
chat: ( chat.toString()),
|
|
1198
|
+
...(options?.fork ? {
|
|
1199
|
+
source: {
|
|
1200
|
+
kind: ChatSourceKind.Fork,
|
|
1201
|
+
chat: ( options.fork.source.toString()),
|
|
1202
|
+
turnId: options.fork.turnId
|
|
1203
|
+
}
|
|
1204
|
+
} : {}),
|
|
1205
|
+
...(options?.sideChat ? {
|
|
1206
|
+
source: {
|
|
1207
|
+
kind: ChatSourceKind.SideChat,
|
|
1208
|
+
chat: ( options.sideChat.source.toString()),
|
|
1209
|
+
turnId: options.sideChat.turnId,
|
|
1210
|
+
...(options.sideChat.selection ? {
|
|
1211
|
+
selection: options.sideChat.selection
|
|
1212
|
+
} : {})
|
|
1213
|
+
}
|
|
1214
|
+
} : {})
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1217
|
+
async disposeChat(chat) {
|
|
1218
|
+
await this._sendRequest("disposeChat", {
|
|
1219
|
+
channel: ( chat.toString())
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
async createTerminal(params) {
|
|
1223
|
+
await this._sendRequest("createTerminal", params);
|
|
1224
|
+
}
|
|
1225
|
+
async disposeTerminal(terminal) {
|
|
1226
|
+
await this._sendRequest("disposeTerminal", {
|
|
1227
|
+
channel: ( terminal.toString())
|
|
1228
|
+
});
|
|
1229
|
+
}
|
|
1230
|
+
async invokeChangesetOperation(params) {
|
|
1231
|
+
return await this._sendRequest("invokeChangesetOperation", params);
|
|
1232
|
+
}
|
|
1233
|
+
async handleMcpRequest(channel, method, params) {
|
|
1234
|
+
return await this._dispatchRequest(method, {
|
|
1235
|
+
...(params ?? {}),
|
|
1236
|
+
channel
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1239
|
+
async listSessions() {
|
|
1240
|
+
const result = await this._sendRequest("listSessions", {
|
|
1241
|
+
channel: ROOT_STATE_URI
|
|
1242
|
+
});
|
|
1243
|
+
return ( result.items.map(s => ({
|
|
1244
|
+
session: ( URI.parse(s.resource)),
|
|
1245
|
+
startTime: Date.parse(s.createdAt),
|
|
1246
|
+
modifiedTime: Date.parse(s.modifiedAt),
|
|
1247
|
+
...(s.project ? {
|
|
1248
|
+
project: {
|
|
1249
|
+
uri: this._toClientUri(( URI.parse(s.project.uri))),
|
|
1250
|
+
displayName: s.project.displayName
|
|
1251
|
+
}
|
|
1252
|
+
} : {}),
|
|
1253
|
+
summary: s.title,
|
|
1254
|
+
status: s.status,
|
|
1255
|
+
activity: s.activity,
|
|
1256
|
+
workingDirectory: typeof s.workingDirectories?.[0] === "string" ? this._toClientUri(( URI.parse(s.workingDirectories[0]))) : undefined,
|
|
1257
|
+
workingDirectories: s.workingDirectories?.map(d => this._toClientUri(( URI.parse(d)))),
|
|
1258
|
+
changes: s.changes,
|
|
1259
|
+
...(s._meta !== undefined ? {
|
|
1260
|
+
_meta: s._meta
|
|
1261
|
+
} : {})
|
|
1262
|
+
})));
|
|
1263
|
+
}
|
|
1264
|
+
_toClientUri(uri) {
|
|
1265
|
+
return uri.scheme === Schemas.file ? toAgentHostUri(uri, this._connectionAuthority) : uri;
|
|
1266
|
+
}
|
|
1267
|
+
_grantImplicitReadsForOutgoingAction(action) {
|
|
1268
|
+
switch (action.type) {
|
|
1269
|
+
case ActionType.SessionActiveClientSet:
|
|
1270
|
+
if (action.activeClient.customizations) {
|
|
1271
|
+
this._grantImplicitReadsForCustomizations(action.activeClient.customizations);
|
|
1272
|
+
}
|
|
1273
|
+
break;
|
|
1274
|
+
case ActionType.ChatTurnStarted:
|
|
1275
|
+
case ActionType.ChatPendingMessageSet:
|
|
1276
|
+
this._grantImplicitReadsForMessage(action.message);
|
|
1277
|
+
break;
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
_grantImplicitReadsForMessage(message) {
|
|
1281
|
+
for (const attachment of message.attachments ?? []) {
|
|
1282
|
+
if (attachment.type !== MessageAttachmentKind.Resource) {
|
|
1283
|
+
continue;
|
|
1284
|
+
}
|
|
1285
|
+
try {
|
|
1286
|
+
this._grantImplicitRead(( URI.parse(attachment.uri)));
|
|
1287
|
+
} catch {
|
|
1288
|
+
continue;
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
_grantImplicitReadsForCustomizations(refs) {
|
|
1293
|
+
for (const ref of refs) {
|
|
1294
|
+
let uri;
|
|
1295
|
+
try {
|
|
1296
|
+
uri = ( URI.parse(ref.uri));
|
|
1297
|
+
} catch {
|
|
1298
|
+
continue;
|
|
1299
|
+
}
|
|
1300
|
+
this._grantImplicitRead(uri);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
_grantImplicitRead(uri) {
|
|
1304
|
+
if (( this._grantedImplicitReadUris.has(uri))) {
|
|
1305
|
+
return;
|
|
1306
|
+
}
|
|
1307
|
+
this._grantedImplicitReadUris.add(uri);
|
|
1308
|
+
this._implicitReadGrants.add(this._resourceService.grantImplicitRead(this._resourceIdentity, uri));
|
|
1309
|
+
}
|
|
1310
|
+
async resourceList(uri) {
|
|
1311
|
+
return await this._sendRequest("resourceList", {
|
|
1312
|
+
channel: ROOT_STATE_URI,
|
|
1313
|
+
uri: ( uri.toString())
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
async resourceRead(uri, encoding) {
|
|
1317
|
+
return this._sendRequest("resourceRead", {
|
|
1318
|
+
channel: ROOT_STATE_URI,
|
|
1319
|
+
uri: ( uri.toString()),
|
|
1320
|
+
encoding
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
async resourceWrite(params) {
|
|
1324
|
+
return this._sendRequest("resourceWrite", params);
|
|
1325
|
+
}
|
|
1326
|
+
async resourceCopy(params) {
|
|
1327
|
+
return this._sendRequest("resourceCopy", params);
|
|
1328
|
+
}
|
|
1329
|
+
async resourceDelete(params) {
|
|
1330
|
+
return this._sendRequest("resourceDelete", params);
|
|
1331
|
+
}
|
|
1332
|
+
async resourceMove(params) {
|
|
1333
|
+
return this._sendRequest("resourceMove", params);
|
|
1334
|
+
}
|
|
1335
|
+
async resourceResolve(params) {
|
|
1336
|
+
return this._sendRequest("resourceResolve", params);
|
|
1337
|
+
}
|
|
1338
|
+
async resourceMkdir(params) {
|
|
1339
|
+
return this._sendRequest("resourceMkdir", params);
|
|
1340
|
+
}
|
|
1341
|
+
async createResourceWatch(params) {
|
|
1342
|
+
return this._sendRequest("createResourceWatch", params);
|
|
1343
|
+
}
|
|
1344
|
+
watchResource(params) {
|
|
1345
|
+
return createRemoteWatchHandle({
|
|
1346
|
+
createResourceWatch: p => this.createResourceWatch(p),
|
|
1347
|
+
subscribe: uri => this.subscribe(uri),
|
|
1348
|
+
unsubscribe: uri => this.unsubscribe(uri),
|
|
1349
|
+
onDidAction: this.onDidAction
|
|
1350
|
+
}, params);
|
|
1351
|
+
}
|
|
1352
|
+
triggerVscodeUpgrade(method) {
|
|
1353
|
+
return this._dispatchRequest(method, {}, {
|
|
1354
|
+
allowIncompatibleUpgrade: true
|
|
1355
|
+
});
|
|
1356
|
+
}
|
|
1357
|
+
_handleMessage(msg) {
|
|
1358
|
+
if (this._state.kind === AgentHostClientState.Closed) {
|
|
1359
|
+
return;
|
|
1360
|
+
}
|
|
1361
|
+
this._lastReadTime = Date.now();
|
|
1362
|
+
this._resetLivenessTimers();
|
|
1363
|
+
if (isJsonRpcRequest(msg)) {
|
|
1364
|
+
this._handleReverseRequest(msg.id, msg.method, msg.params);
|
|
1365
|
+
} else if (isJsonRpcResponse(msg)) {
|
|
1366
|
+
const pending = this._pendingRequests.get(msg.id);
|
|
1367
|
+
if (pending) {
|
|
1368
|
+
this._pendingRequests.delete(msg.id);
|
|
1369
|
+
if (hasKey(msg, {
|
|
1370
|
+
error: true
|
|
1371
|
+
})) {
|
|
1372
|
+
if (this._shouldLogFailedRequest(pending, msg.error)) {
|
|
1373
|
+
this._logService.warn(`[RemoteAgentHostProtocol] Request ${msg.id} failed:`, msg.error);
|
|
1374
|
+
}
|
|
1375
|
+
pending.deferred.error(this._toProtocolError(msg.error));
|
|
1376
|
+
} else {
|
|
1377
|
+
pending.deferred.complete(msg.result);
|
|
1378
|
+
}
|
|
1379
|
+
} else {
|
|
1380
|
+
this._logService.warn(
|
|
1381
|
+
`[RemoteAgentHostProtocol] Received response for unknown request id ${msg.id}`
|
|
1382
|
+
);
|
|
1383
|
+
}
|
|
1384
|
+
} else if (isJsonRpcNotification(msg)) {
|
|
1385
|
+
switch (msg.method) {
|
|
1386
|
+
case "action":
|
|
1387
|
+
{
|
|
1388
|
+
const envelope = msg.params;
|
|
1389
|
+
this._serverSeq = Math.max(this._serverSeq, envelope.serverSeq);
|
|
1390
|
+
this._onDidAction.fire(normalizeLegacyActionEnvelope(envelope));
|
|
1391
|
+
break;
|
|
1392
|
+
}
|
|
1393
|
+
case "root/sessionAdded":
|
|
1394
|
+
case "root/sessionRemoved":
|
|
1395
|
+
case "root/sessionSummaryChanged":
|
|
1396
|
+
case "root/progress":
|
|
1397
|
+
case "auth/required":
|
|
1398
|
+
{
|
|
1399
|
+
this._logService.trace(`[RemoteAgentHostProtocol] Notification: ${msg.method}`);
|
|
1400
|
+
this._onDidNotification.fire({
|
|
1401
|
+
type: msg.method,
|
|
1402
|
+
...msg.params
|
|
1403
|
+
});
|
|
1404
|
+
break;
|
|
1405
|
+
}
|
|
1406
|
+
case "otlp/exportLogs":
|
|
1407
|
+
this._onDidReceiveOtlpLogs.fire(msg.params);
|
|
1408
|
+
break;
|
|
1409
|
+
case "otlp/exportTraces":
|
|
1410
|
+
case "otlp/exportMetrics":
|
|
1411
|
+
break;
|
|
1412
|
+
default:
|
|
1413
|
+
{
|
|
1414
|
+
const rawChannel = msg.params && typeof msg.params === "object" ? msg.params.channel : undefined;
|
|
1415
|
+
if (typeof rawChannel === "string" && rawChannel.toLowerCase().startsWith("mcp:/")) {
|
|
1416
|
+
const {
|
|
1417
|
+
channel: _channel,
|
|
1418
|
+
...rest
|
|
1419
|
+
} = msg.params;
|
|
1420
|
+
this._onMcpNotification.fire({
|
|
1421
|
+
channel: rawChannel,
|
|
1422
|
+
method: msg.method,
|
|
1423
|
+
params: rest
|
|
1424
|
+
});
|
|
1425
|
+
break;
|
|
1426
|
+
}
|
|
1427
|
+
this._logService.trace(`[RemoteAgentHostProtocol] Unhandled method: ${msg.method}`);
|
|
1428
|
+
break;
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
} else {
|
|
1432
|
+
this._logService.warn(`[RemoteAgentHostProtocol] Unrecognized message:`, JSON.stringify(msg));
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
_handleFatalClose(error, reason) {
|
|
1436
|
+
this._onDidFatalClose.fire(error);
|
|
1437
|
+
this._handleClose(error, reason);
|
|
1438
|
+
}
|
|
1439
|
+
_handleClose(error, reason) {
|
|
1440
|
+
if (this._state.kind === AgentHostClientState.Closed) {
|
|
1441
|
+
return;
|
|
1442
|
+
}
|
|
1443
|
+
this._cancelLivenessTimers();
|
|
1444
|
+
if (this._state.kind === AgentHostClientState.Reconnecting) {
|
|
1445
|
+
const reconnect = this._state.reconnect;
|
|
1446
|
+
if (reconnect.timeoutHandle !== undefined) {
|
|
1447
|
+
clearTimeout(reconnect.timeoutHandle);
|
|
1448
|
+
}
|
|
1449
|
+
if (!reconnect.gate.isSettled) {
|
|
1450
|
+
reconnect.gate.error(error);
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
if (this._state.kind === AgentHostClientState.Connecting) {
|
|
1454
|
+
this._state.outbox.length = 0;
|
|
1455
|
+
}
|
|
1456
|
+
this._rejectPendingRequests(error);
|
|
1457
|
+
this._grantedImplicitReadUris.clear();
|
|
1458
|
+
this._implicitReadGrants.clear();
|
|
1459
|
+
this._resourceService.connectionClosed(this._resourceIdentity);
|
|
1460
|
+
this._transitionTo({
|
|
1461
|
+
kind: AgentHostClientState.Closed,
|
|
1462
|
+
error
|
|
1463
|
+
});
|
|
1464
|
+
this._onDidClose.fire(reason);
|
|
1465
|
+
}
|
|
1466
|
+
async _raceClose(promise) {
|
|
1467
|
+
if (this._state.kind === AgentHostClientState.Closed) {
|
|
1468
|
+
return Promise.reject(this._state.error);
|
|
1469
|
+
}
|
|
1470
|
+
let closeListener = Disposable.None;
|
|
1471
|
+
const closePromise = ( new Promise((_resolve, reject) => {
|
|
1472
|
+
closeListener = this.onDidClose(() => reject(
|
|
1473
|
+
this._state.kind === AgentHostClientState.Closed ? this._state.error : connectionClosedError(this._address)
|
|
1474
|
+
));
|
|
1475
|
+
}));
|
|
1476
|
+
try {
|
|
1477
|
+
return await Promise.race([promise, closePromise]);
|
|
1478
|
+
} finally {
|
|
1479
|
+
closeListener.dispose();
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
_handleReverseRequest(id, method, params) {
|
|
1483
|
+
const transport = this._transport;
|
|
1484
|
+
this._pendingReverseRequests.set(transport, (this._pendingReverseRequests.get(transport) ?? 0) + 1);
|
|
1485
|
+
const sendResponse = response => {
|
|
1486
|
+
try {
|
|
1487
|
+
transport.send(response);
|
|
1488
|
+
} finally {
|
|
1489
|
+
const pending = this._pendingReverseRequests.get(transport);
|
|
1490
|
+
if (pending === 1) {
|
|
1491
|
+
this._pendingReverseRequests.delete(transport);
|
|
1492
|
+
if (transport === this._transport) {
|
|
1493
|
+
this._resetLivenessTimers();
|
|
1494
|
+
}
|
|
1495
|
+
} else if (pending !== undefined) {
|
|
1496
|
+
this._pendingReverseRequests.set(transport, pending - 1);
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
};
|
|
1500
|
+
const sendResult = result => {
|
|
1501
|
+
sendResponse({
|
|
1502
|
+
jsonrpc: "2.0",
|
|
1503
|
+
id,
|
|
1504
|
+
result
|
|
1505
|
+
});
|
|
1506
|
+
};
|
|
1507
|
+
const sendError = err => {
|
|
1508
|
+
if (err instanceof AgentHostResourcePermissionError) {
|
|
1509
|
+
sendResponse({
|
|
1510
|
+
jsonrpc: "2.0",
|
|
1511
|
+
id,
|
|
1512
|
+
error: {
|
|
1513
|
+
code: AhpErrorCodes.PermissionDenied,
|
|
1514
|
+
message: err.message,
|
|
1515
|
+
data: err.request ? {
|
|
1516
|
+
request: err.request
|
|
1517
|
+
} : undefined
|
|
1518
|
+
}
|
|
1519
|
+
});
|
|
1520
|
+
return;
|
|
1521
|
+
}
|
|
1522
|
+
const fsCode = toFileSystemProviderErrorCode(err instanceof Error ? err : undefined);
|
|
1523
|
+
let code = -32e3;
|
|
1524
|
+
switch (fsCode) {
|
|
1525
|
+
case FileSystemProviderErrorCode.FileNotFound:
|
|
1526
|
+
code = AhpErrorCodes.NotFound;
|
|
1527
|
+
break;
|
|
1528
|
+
case FileSystemProviderErrorCode.NoPermissions:
|
|
1529
|
+
code = AhpErrorCodes.PermissionDenied;
|
|
1530
|
+
break;
|
|
1531
|
+
case FileSystemProviderErrorCode.FileExists:
|
|
1532
|
+
code = AhpErrorCodes.AlreadyExists;
|
|
1533
|
+
break;
|
|
1534
|
+
}
|
|
1535
|
+
sendResponse({
|
|
1536
|
+
jsonrpc: "2.0",
|
|
1537
|
+
id,
|
|
1538
|
+
error: {
|
|
1539
|
+
code,
|
|
1540
|
+
message: err instanceof Error ? err.message : String(err)
|
|
1541
|
+
}
|
|
1542
|
+
});
|
|
1543
|
+
};
|
|
1544
|
+
const p = (params ?? {});
|
|
1545
|
+
const identity = this._resourceIdentity;
|
|
1546
|
+
void (async () => {
|
|
1547
|
+
try {
|
|
1548
|
+
switch (method) {
|
|
1549
|
+
case RequestAgentHostWorkspaceTrustExtensionMethod:
|
|
1550
|
+
{
|
|
1551
|
+
if (typeof p.workspace !== "string") {
|
|
1552
|
+
throw ( new Error("Missing workspace"));
|
|
1553
|
+
}
|
|
1554
|
+
const hostWorkspace = ( URI.parse(p.workspace, true));
|
|
1555
|
+
if (hostWorkspace.scheme !== Schemas.file || !hostWorkspace.path.startsWith("/")) {
|
|
1556
|
+
throw ( new Error("Workspace must be an absolute file URI"));
|
|
1557
|
+
}
|
|
1558
|
+
const workspace = this.resourceUris.fromAgentHost(hostWorkspace);
|
|
1559
|
+
if (p.trustedParent !== undefined) {
|
|
1560
|
+
if (typeof p.trustedParent !== "string") {
|
|
1561
|
+
throw ( new Error("Invalid trustedParent"));
|
|
1562
|
+
}
|
|
1563
|
+
const hostParent = ( URI.parse(p.trustedParent, true));
|
|
1564
|
+
if (hostParent.scheme !== Schemas.file || !hostParent.path.startsWith("/")) {
|
|
1565
|
+
throw ( new Error("Trusted parent must be an absolute file URI"));
|
|
1566
|
+
}
|
|
1567
|
+
if (!isWorktreeUnderRepository(hostWorkspace, hostParent)) {
|
|
1568
|
+
throw ( new Error("Workspace is not a managed worktree under the trusted parent"));
|
|
1569
|
+
}
|
|
1570
|
+
const parent = this.resourceUris.fromAgentHost(hostParent);
|
|
1571
|
+
const parentTrust = await this._workspaceTrustManagementService.getUriTrustInfo(parent);
|
|
1572
|
+
if (parentTrust.trusted) {
|
|
1573
|
+
const workspaceTrust = await this._workspaceTrustManagementService.getUriTrustInfo(workspace);
|
|
1574
|
+
if (!workspaceTrust.trusted) {
|
|
1575
|
+
await this._workspaceTrustManagementService.setUrisTrust([workspace], true);
|
|
1576
|
+
}
|
|
1577
|
+
sendResult({
|
|
1578
|
+
trusted: true
|
|
1579
|
+
});
|
|
1580
|
+
return;
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
const trusted = await this._workspaceTrustRequestService.requestResourcesTrust({
|
|
1584
|
+
uri: workspace,
|
|
1585
|
+
message: ( localize(
|
|
1586
|
+
1847,
|
|
1587
|
+
"An agent session will be able to read files, run commands, and make changes in this folder."
|
|
1588
|
+
))
|
|
1589
|
+
});
|
|
1590
|
+
sendResult({
|
|
1591
|
+
trusted: trusted === true
|
|
1592
|
+
});
|
|
1593
|
+
return;
|
|
1594
|
+
}
|
|
1595
|
+
case "resourceList":
|
|
1596
|
+
{
|
|
1597
|
+
if (!p.uri) {
|
|
1598
|
+
throw ( new Error("Missing uri"));
|
|
1599
|
+
}
|
|
1600
|
+
const result = await this._resourceService.list(identity, ( URI.parse(p.uri)));
|
|
1601
|
+
sendResult({
|
|
1602
|
+
entries: result.entries
|
|
1603
|
+
});
|
|
1604
|
+
return;
|
|
1605
|
+
}
|
|
1606
|
+
case "resourceRead":
|
|
1607
|
+
{
|
|
1608
|
+
if (!p.uri) {
|
|
1609
|
+
throw ( new Error("Missing uri"));
|
|
1610
|
+
}
|
|
1611
|
+
const result = await this._resourceService.read(identity, ( URI.parse(p.uri)));
|
|
1612
|
+
sendResult({
|
|
1613
|
+
data: encodeBase64(result.bytes),
|
|
1614
|
+
encoding: ContentEncoding.Base64
|
|
1615
|
+
});
|
|
1616
|
+
return;
|
|
1617
|
+
}
|
|
1618
|
+
case "resourceWrite":
|
|
1619
|
+
{
|
|
1620
|
+
if (!p.uri || p.data === undefined) {
|
|
1621
|
+
throw ( new Error("Missing uri or data"));
|
|
1622
|
+
}
|
|
1623
|
+
await this._resourceService.write(identity, p);
|
|
1624
|
+
sendResult({});
|
|
1625
|
+
return;
|
|
1626
|
+
}
|
|
1627
|
+
case "resourceDelete":
|
|
1628
|
+
{
|
|
1629
|
+
if (!p.uri) {
|
|
1630
|
+
throw ( new Error("Missing uri"));
|
|
1631
|
+
}
|
|
1632
|
+
await this._resourceService.del(identity, p);
|
|
1633
|
+
sendResult({});
|
|
1634
|
+
return;
|
|
1635
|
+
}
|
|
1636
|
+
case "resourceMove":
|
|
1637
|
+
{
|
|
1638
|
+
if (!p.source || !p.destination) {
|
|
1639
|
+
throw ( new Error("Missing source or destination"));
|
|
1640
|
+
}
|
|
1641
|
+
await this._resourceService.move(identity, p);
|
|
1642
|
+
sendResult({});
|
|
1643
|
+
return;
|
|
1644
|
+
}
|
|
1645
|
+
case "resourceCopy":
|
|
1646
|
+
{
|
|
1647
|
+
if (!p.source || !p.destination) {
|
|
1648
|
+
throw ( new Error("Missing source or destination"));
|
|
1649
|
+
}
|
|
1650
|
+
await this._resourceService.copy(identity, p);
|
|
1651
|
+
sendResult({});
|
|
1652
|
+
return;
|
|
1653
|
+
}
|
|
1654
|
+
case "resourceResolve":
|
|
1655
|
+
{
|
|
1656
|
+
if (!p.uri) {
|
|
1657
|
+
throw ( new Error("Missing uri"));
|
|
1658
|
+
}
|
|
1659
|
+
const result = await this._resourceService.resolve(identity, p);
|
|
1660
|
+
sendResult(result);
|
|
1661
|
+
return;
|
|
1662
|
+
}
|
|
1663
|
+
case "resourceMkdir":
|
|
1664
|
+
{
|
|
1665
|
+
if (!p.uri) {
|
|
1666
|
+
throw ( new Error("Missing uri"));
|
|
1667
|
+
}
|
|
1668
|
+
await this._resourceService.mkdir(identity, p);
|
|
1669
|
+
sendResult({});
|
|
1670
|
+
return;
|
|
1671
|
+
}
|
|
1672
|
+
case "resourceRequest":
|
|
1673
|
+
{
|
|
1674
|
+
try {
|
|
1675
|
+
await this._resourceService.request(identity, p);
|
|
1676
|
+
sendResult({});
|
|
1677
|
+
} catch (err) {
|
|
1678
|
+
if (err instanceof CancellationError) {
|
|
1679
|
+
throw ( new AgentHostResourcePermissionError(undefined));
|
|
1680
|
+
}
|
|
1681
|
+
throw err;
|
|
1682
|
+
}
|
|
1683
|
+
return;
|
|
1684
|
+
}
|
|
1685
|
+
default:
|
|
1686
|
+
this._logService.warn(`[RemoteAgentHostProtocol] Unhandled reverse request: ${method}`);
|
|
1687
|
+
throw ( new Error(`Unknown method: ${method}`));
|
|
1688
|
+
}
|
|
1689
|
+
} catch (err) {
|
|
1690
|
+
sendError(err);
|
|
1691
|
+
}
|
|
1692
|
+
})();
|
|
1693
|
+
}
|
|
1694
|
+
_sendNotification(method, params) {
|
|
1695
|
+
this._sendNotificationMessage(method, params);
|
|
1696
|
+
}
|
|
1697
|
+
_sendExtensionNotification(method, params, sendDuringReconnect = false) {
|
|
1698
|
+
this._sendNotificationMessage(method, params, sendDuringReconnect);
|
|
1699
|
+
}
|
|
1700
|
+
_sendNotificationMessage(method, params, sendDuringReconnect = false) {
|
|
1701
|
+
if (this._state.kind === AgentHostClientState.Closed || this._state.kind === AgentHostClientState.Incompatible) {
|
|
1702
|
+
return;
|
|
1703
|
+
}
|
|
1704
|
+
const message = {
|
|
1705
|
+
jsonrpc: "2.0",
|
|
1706
|
+
method,
|
|
1707
|
+
params
|
|
1708
|
+
};
|
|
1709
|
+
if (isClientTransport(this._transport) && this._state.kind === AgentHostClientState.Connecting) {
|
|
1710
|
+
this._state.outbox.push(message);
|
|
1711
|
+
return;
|
|
1712
|
+
}
|
|
1713
|
+
if (this._state.kind === AgentHostClientState.Reconnecting && !sendDuringReconnect) {
|
|
1714
|
+
this._state.reconnect.outbox.push(message);
|
|
1715
|
+
return;
|
|
1716
|
+
}
|
|
1717
|
+
this._transport.send(message);
|
|
1718
|
+
}
|
|
1719
|
+
_sendRequest(method, params) {
|
|
1720
|
+
return this._dispatchRequest(method, params);
|
|
1721
|
+
}
|
|
1722
|
+
_sendExtensionRequest(method, params) {
|
|
1723
|
+
return this._dispatchRequest(method, params);
|
|
1724
|
+
}
|
|
1725
|
+
_updateTelemetryLevel() {
|
|
1726
|
+
this._dispatchRootConfig({
|
|
1727
|
+
[AgentHostTelemetryLevelConfigKey]: telemetryLevelToAgentHostConfigValue(this._effectiveTelemetryLevel())
|
|
1728
|
+
});
|
|
1729
|
+
}
|
|
1730
|
+
_effectiveTelemetryLevel() {
|
|
1731
|
+
return Math.min(
|
|
1732
|
+
getTelemetryLevel(this._configurationService),
|
|
1733
|
+
this._telemetryService.telemetryLevel
|
|
1734
|
+
);
|
|
1735
|
+
}
|
|
1736
|
+
_dispatchRootConfig(config) {
|
|
1737
|
+
this.dispatchAction(ROOT_STATE_URI, {
|
|
1738
|
+
type: ActionType.RootConfigChanged,
|
|
1739
|
+
config
|
|
1740
|
+
}, this._clientId, 0);
|
|
1741
|
+
}
|
|
1742
|
+
_updateDisableRepoInfoTelemetry() {
|
|
1743
|
+
const disabled = this._configurationService.getValue(DISABLE_REPO_INFO_TELEMETRY_SETTING_ID) === true;
|
|
1744
|
+
this._dispatchRootConfig({
|
|
1745
|
+
[AgentHostDisableRepoInfoTelemetryConfigKey]: disabled
|
|
1746
|
+
});
|
|
1747
|
+
}
|
|
1748
|
+
_updateTerminalAutoApproveEnabled() {
|
|
1749
|
+
const enabled = this._configurationService.getValue(TERMINAL_AUTO_APPROVE_ENABLED_SETTING_ID) !== false;
|
|
1750
|
+
this._dispatchRootConfig({
|
|
1751
|
+
[AgentHostTerminalAutoApproveEnabledConfigKey]: enabled
|
|
1752
|
+
});
|
|
1753
|
+
}
|
|
1754
|
+
_updateTerminalAutoApproveRules() {
|
|
1755
|
+
this._dispatchRootConfig({
|
|
1756
|
+
[AgentHostTerminalAutoApproveRulesConfigKey]: getAgentHostTerminalAutoApproveRulesConfig(this._configurationService)
|
|
1757
|
+
});
|
|
1758
|
+
}
|
|
1759
|
+
_updateManagedSettingsPermissions(sendDuringReconnect = false) {
|
|
1760
|
+
const permissions = this._resourceIdentity === LOCAL_AGENT_HOST_RESOURCE_IDENTITY ? resolveManagedSettingsPermissions(this._configurationService) : {};
|
|
1761
|
+
this._sendExtensionNotification("setClientManagedSettingsPermissions", {
|
|
1762
|
+
permissions
|
|
1763
|
+
}, sendDuringReconnect);
|
|
1764
|
+
}
|
|
1765
|
+
async _dispatchRequest(method, params, options = {}) {
|
|
1766
|
+
if (this._state.kind === AgentHostClientState.Closed) {
|
|
1767
|
+
throw this._state.error;
|
|
1768
|
+
}
|
|
1769
|
+
if (this._state.kind === AgentHostClientState.Incompatible) {
|
|
1770
|
+
if (!options.allowIncompatibleUpgrade) {
|
|
1771
|
+
throw this._state.error;
|
|
1772
|
+
}
|
|
1773
|
+
const {
|
|
1774
|
+
request,
|
|
1775
|
+
result
|
|
1776
|
+
} = this._createRequest(method, params);
|
|
1777
|
+
this._transport.send(request);
|
|
1778
|
+
return result;
|
|
1779
|
+
}
|
|
1780
|
+
if (!options.bypassInitializeQueue && isClientTransport(this._transport) && this._state.kind === AgentHostClientState.Connecting) {
|
|
1781
|
+
const {
|
|
1782
|
+
request,
|
|
1783
|
+
result
|
|
1784
|
+
} = this._createRequest(method, params);
|
|
1785
|
+
this._state.outbox.push(request);
|
|
1786
|
+
return result;
|
|
1787
|
+
}
|
|
1788
|
+
while (!options.bypassReconnectGate && this._state.kind === AgentHostClientState.Reconnecting) {
|
|
1789
|
+
const current = this._state;
|
|
1790
|
+
if (current.kind !== AgentHostClientState.Reconnecting) {
|
|
1791
|
+
break;
|
|
1792
|
+
}
|
|
1793
|
+
try {
|
|
1794
|
+
await current.reconnect.gate.p;
|
|
1795
|
+
} catch {}
|
|
1796
|
+
}
|
|
1797
|
+
const current = this._state;
|
|
1798
|
+
if (current.kind === AgentHostClientState.Closed || current.kind === AgentHostClientState.Incompatible) {
|
|
1799
|
+
throw current.error;
|
|
1800
|
+
}
|
|
1801
|
+
const {
|
|
1802
|
+
request,
|
|
1803
|
+
result
|
|
1804
|
+
} = this._createRequest(method, params);
|
|
1805
|
+
this._transport.send(request);
|
|
1806
|
+
return result;
|
|
1807
|
+
}
|
|
1808
|
+
_createRequest(method, params) {
|
|
1809
|
+
const id = this._nextRequestId++;
|
|
1810
|
+
const deferred = ( new DeferredPromise());
|
|
1811
|
+
this._pendingRequests.set(id, {
|
|
1812
|
+
deferred,
|
|
1813
|
+
suppressNotFoundWarning: isFileResourceRead(method, params),
|
|
1814
|
+
sentAt: Date.now()
|
|
1815
|
+
});
|
|
1816
|
+
return {
|
|
1817
|
+
request: {
|
|
1818
|
+
jsonrpc: "2.0",
|
|
1819
|
+
id,
|
|
1820
|
+
method,
|
|
1821
|
+
params
|
|
1822
|
+
},
|
|
1823
|
+
result: deferred.p
|
|
1824
|
+
};
|
|
1825
|
+
}
|
|
1826
|
+
_shouldLogFailedRequest(request, error) {
|
|
1827
|
+
if (error.code === AhpErrorCodes.NotFound && request.suppressNotFoundWarning) {
|
|
1828
|
+
return false;
|
|
1829
|
+
}
|
|
1830
|
+
return true;
|
|
1831
|
+
}
|
|
1832
|
+
_toProtocolError(error) {
|
|
1833
|
+
return ( new ProtocolError(error.code, error.message, error.data));
|
|
1834
|
+
}
|
|
1835
|
+
_rejectPendingRequests(error) {
|
|
1836
|
+
for (const pending of ( this._pendingRequests.values())) {
|
|
1837
|
+
pending.deferred.error(error);
|
|
1838
|
+
}
|
|
1839
|
+
this._pendingRequests.clear();
|
|
1840
|
+
}
|
|
1841
|
+
_resetLivenessTimers() {
|
|
1842
|
+
this._cancelLivenessTimers();
|
|
1843
|
+
if (this._state.kind === AgentHostClientState.Incompatible || this._state.kind === AgentHostClientState.Reconnecting || this._state.kind === AgentHostClientState.Closed) {
|
|
1844
|
+
return;
|
|
1845
|
+
}
|
|
1846
|
+
this._pingTimer.cancelAndSet(() => this._onPingTimer(), PING_INTERVAL_MS);
|
|
1847
|
+
this._closeTimer.cancelAndSet(() => this._onCloseTimer(), PING_INTERVAL_MS + LIVENESS_TIMEOUT_MS);
|
|
1848
|
+
}
|
|
1849
|
+
_cancelLivenessTimers() {
|
|
1850
|
+
this._pingTimer.cancel();
|
|
1851
|
+
this._closeTimer.cancel();
|
|
1852
|
+
this._livenessDeferred = false;
|
|
1853
|
+
this._livenessDeferredSince = undefined;
|
|
1854
|
+
}
|
|
1855
|
+
_onPingTimer() {
|
|
1856
|
+
if (this._state.kind === AgentHostClientState.Incompatible || this._state.kind === AgentHostClientState.Closed || this._state.kind === AgentHostClientState.Reconnecting) {
|
|
1857
|
+
return;
|
|
1858
|
+
}
|
|
1859
|
+
void this.ping().catch(() => undefined);
|
|
1860
|
+
}
|
|
1861
|
+
_onCloseTimer() {
|
|
1862
|
+
if (this._state.kind === AgentHostClientState.Incompatible || this._state.kind === AgentHostClientState.Closed || this._state.kind === AgentHostClientState.Reconnecting) {
|
|
1863
|
+
return;
|
|
1864
|
+
}
|
|
1865
|
+
if (this._transport.clientConnectionKind === AgentHostClientConnectionKind.Local) {
|
|
1866
|
+
return;
|
|
1867
|
+
}
|
|
1868
|
+
const pendingReverseRequests = this._pendingReverseRequests.get(this._transport) ?? 0;
|
|
1869
|
+
if (pendingReverseRequests > 0 || this._loadEstimator.hasHighLoad()) {
|
|
1870
|
+
this._deferLivenessCheck(pendingReverseRequests);
|
|
1871
|
+
return;
|
|
1872
|
+
}
|
|
1873
|
+
if (this._livenessDeferred) {
|
|
1874
|
+
this._livenessDeferred = false;
|
|
1875
|
+
this._livenessDeferredSince = undefined;
|
|
1876
|
+
this._pingTimer.cancelAndSet(() => this._onPingTimer(), PING_INTERVAL_MS);
|
|
1877
|
+
this._closeTimer.cancelAndSet(() => this._onCloseTimer(), PING_INTERVAL_MS + LIVENESS_TIMEOUT_MS);
|
|
1878
|
+
return;
|
|
1879
|
+
}
|
|
1880
|
+
const silence = Date.now() - this._lastReadTime;
|
|
1881
|
+
this._logService.info(
|
|
1882
|
+
`[RemoteAgentHostProtocol] Liveness: no message from ${this._address} for ${silence}ms; forcing close to trigger reconnect.`
|
|
1883
|
+
);
|
|
1884
|
+
this._transportListeners.clear();
|
|
1885
|
+
if (this._transportFactory) {
|
|
1886
|
+
this._rejectPendingRequests(connectionTimeoutError(this._address, silence));
|
|
1887
|
+
this._handleTransportClose();
|
|
1888
|
+
return;
|
|
1889
|
+
}
|
|
1890
|
+
this._handleClose(connectionTimeoutError(this._address, silence));
|
|
1891
|
+
}
|
|
1892
|
+
_deferLivenessCheck(pendingReverseRequests) {
|
|
1893
|
+
const now = Date.now();
|
|
1894
|
+
if (!this._livenessDeferred) {
|
|
1895
|
+
this._livenessDeferred = true;
|
|
1896
|
+
this._livenessDeferredSince = now;
|
|
1897
|
+
}
|
|
1898
|
+
const deferredSince = this._livenessDeferredSince ?? now;
|
|
1899
|
+
this._logService.trace(
|
|
1900
|
+
`[RemoteAgentHostProtocol] Liveness: deferring close for ${now - deferredSince}ms; ${pendingReverseRequests} reverse request(s) outstanding.`
|
|
1901
|
+
);
|
|
1902
|
+
this._pingTimer.cancelAndSet(() => this._onPingTimer(), PING_INTERVAL_MS);
|
|
1903
|
+
this._closeTimer.cancelAndSet(() => this._onCloseTimer(), PING_INTERVAL_MS);
|
|
1904
|
+
}
|
|
1905
|
+
nextClientSeq() {
|
|
1906
|
+
return this._nextClientSeq++;
|
|
1907
|
+
}
|
|
1908
|
+
};
|
|
1909
|
+
AgentHostProtocolClient = ( __decorate([( __param(3, ILogService)), ( __param(4, IAgentHostResourceService)), ( __param(5, IConfigurationService)), ( __param(6, ITelemetryService)), ( __param(7, IWorkspaceTrustEnablementService)), ( __param(8, IWorkspaceTrustManagementService)), ( __param(9, IWorkspaceTrustRequestService))], AgentHostProtocolClient));
|
|
1910
|
+
|
|
1911
|
+
export { AgentHostClientState, AgentHostProtocolClient, InitialAuthenticationError };
|