@codingame/monaco-vscode-chat-service-override 38.1.2 → 39.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/common.js +46 -10
- package/index.js +5 -1
- package/package.json +6 -5
- package/session.js +9 -2
- package/vscode/src/vs/editor/common/diff/documentDiffProvider.d.ts +6 -0
- package/vscode/src/vs/platform/agentHost/browser/agentHostClientProxy.d.ts +37 -0
- package/vscode/src/vs/platform/agentHost/browser/agentHostClientProxy.js +120 -0
- package/vscode/src/vs/platform/agentHost/browser/agentHostConnectionsService.d.ts +7 -0
- package/vscode/src/vs/platform/agentHost/browser/agentHostConnectionsService.js +52 -22
- package/vscode/src/vs/platform/agentHost/browser/agentHostIpcChannelTransport.d.ts +1 -1
- package/vscode/src/vs/platform/agentHost/browser/agentHostIpcChannelTransport.js +2 -1
- package/vscode/src/vs/platform/agentHost/browser/nullWslRemoteAgentHostService.d.ts +1 -0
- package/vscode/src/vs/platform/agentHost/browser/nullWslRemoteAgentHostService.js +3 -0
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.d.ts +6 -6
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.js +78 -41
- package/vscode/src/vs/platform/agentHost/browser/webSocketClientTransport.d.ts +2 -1
- package/vscode/src/vs/platform/agentHost/browser/webSocketClientTransport.js +5 -1
- package/vscode/src/vs/platform/agentHost/common/agentHostCustomizationConfig.d.ts +1 -8
- package/vscode/src/vs/platform/agentHost/common/agentHostCustomizationConfig.js +11 -19
- package/vscode/src/vs/platform/agentHost/common/agentHostMcpOAuthMetadataService.d.ts +16 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostMcpOAuthMetadataService.js +85 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostOperatingSystem.js +9 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostStarter.config.contribution.js +169 -106
- package/vscode/src/vs/platform/agentHost/common/agentModelCatalogStatus.d.ts +4 -0
- package/vscode/src/vs/platform/agentHost/common/agentModelCatalogStatus.js +15 -0
- package/vscode/src/vs/platform/agentHost/common/agentSessionMessage.d.ts +22 -0
- package/vscode/src/vs/platform/agentHost/common/agentSessionMessage.js +17 -0
- package/vscode/src/vs/platform/agentHost/common/artifactToolsConfiguration.d.ts +23 -0
- package/vscode/src/vs/platform/agentHost/common/artifactToolsConfiguration.js +33 -2
- package/vscode/src/vs/platform/agentHost/common/chatMoveConfiguration.d.ts +14 -0
- package/vscode/src/vs/platform/agentHost/common/chatMoveConfiguration.js +23 -0
- package/vscode/src/vs/platform/agentHost/common/codexAccountPlan.js +1 -0
- package/vscode/src/vs/platform/agentHost/common/copilotConfigSlashCommands.d.ts +3 -3
- package/vscode/src/vs/platform/agentHost/common/copilotConfigSlashCommands.js +8 -8
- package/vscode/src/vs/platform/agentHost/common/dynamicAutoTiersConfiguration.d.ts +12 -0
- package/vscode/src/vs/platform/agentHost/common/dynamicAutoTiersConfiguration.js +22 -0
- package/vscode/src/vs/platform/agentHost/common/imageGenerationConfiguration.d.ts +52 -0
- package/vscode/src/vs/platform/agentHost/common/imageGenerationConfiguration.js +67 -0
- package/vscode/src/vs/platform/agentHost/common/logRedaction.d.ts +45 -0
- package/vscode/src/vs/platform/agentHost/common/logRedaction.js +82 -0
- package/vscode/src/vs/platform/agentHost/common/meta/agentCompletionAttachmentMeta.d.ts +2 -0
- package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentCompletionAttachmentMeta.d.ts +121 -0
- package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentCompletionAttachmentMeta.js +88 -0
- package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentPermissionResponseMeta.d.ts +1 -0
- package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentPermissionResponseMeta.js +8 -2
- package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentSandboxDiagnostics.d.ts +5 -0
- package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentSandboxDiagnostics.js +5 -1
- package/vscode/src/vs/platform/agentHost/common/meta/vscode/customizationDiscoveryMeta.d.ts +12 -0
- package/vscode/src/vs/platform/agentHost/common/meta/vscode/customizationDiscoveryMeta.js +24 -0
- package/vscode/src/vs/platform/agentHost/common/permissionRules.d.ts +58 -0
- package/vscode/src/vs/platform/agentHost/common/permissionRules.js +109 -0
- package/vscode/src/vs/platform/agentHost/common/sandboxConfigSchema.d.ts +4 -1
- package/vscode/src/vs/platform/agentHost/common/sandboxConfigSchema.js +41 -26
- package/vscode/src/vs/platform/agentHost/common/sessionDataService.d.ts +114 -8
- package/vscode/src/vs/platform/agentHost/common/sessionDataService.service.d.ts +7 -0
- package/vscode/src/vs/platform/agentHost/common/terminalPermissionRules.d.ts +21 -0
- package/vscode/src/vs/platform/agentHost/common/terminalPermissionRules.js +57 -0
- package/vscode/src/vs/platform/agentHost/common/titleGenerationConfiguration.js +3 -3
- package/vscode/src/vs/platform/agentHost/common/vscodeSandboxPaths.d.ts +2 -1
- package/vscode/src/vs/platform/agentHost/common/vscodeSandboxPaths.js +1 -1
- package/vscode/src/vs/platform/agentHost/common/workspacelessScratchDir.d.ts +8 -0
- package/vscode/src/vs/platform/agentHost/common/workspacelessScratchDir.js +11 -0
- package/vscode/src/vs/platform/agentHost/common/wslRemoteAgentHost.d.ts +1 -1
- package/vscode/src/vs/platform/agentHost/common/wslRemoteAgentHost.js +1 -1
- package/vscode/src/vs/platform/artifactIntegrations/common/artifactIntegrationRegistry.d.ts +28 -0
- package/vscode/src/vs/platform/artifactIntegrations/common/artifactIntegrationRegistry.js +170 -0
- package/vscode/src/vs/platform/github/common/content/content.d.ts +136 -0
- package/vscode/src/vs/platform/github/common/content/content.js +12 -0
- package/vscode/src/vs/platform/networkFilter/common/networkFilterService.js +1 -1
- package/vscode/src/vs/platform/terminal/common/autoApprove/autoApproveEntryToRegex.d.ts +4 -0
- package/vscode/src/vs/platform/terminal/common/autoApprove/autoApproveEntryToRegex.js +41 -0
- package/vscode/src/vs/platform/terminal/common/autoApprove/autoApproveRuleKeyForm.d.ts +10 -0
- package/vscode/src/vs/platform/terminal/common/autoApprove/autoApproveRuleKeyForm.js +16 -0
- package/vscode/src/vs/platform/terminal/common/autoApprove/suggestAutoApproveRules.d.ts +5 -0
- package/vscode/src/vs/platform/terminal/common/autoApprove/suggestAutoApproveRules.js +64 -0
- package/vscode/src/vs/platform/url/common/urlApprovalPatterns.d.ts +36 -0
- package/vscode/src/vs/sessions/browser/parts/mobile/contributions/mobileDiffView.js +7 -7
- package/vscode/src/vs/sessions/browser/parts/mobile/contributions/mobileMultiDiffView.js +8 -8
- package/vscode/src/vs/sessions/contrib/chat/browser/aiCustomizationWorkspaceService.d.ts +19 -7
- package/vscode/src/vs/sessions/contrib/chat/browser/aiCustomizationWorkspaceService.js +83 -46
- package/vscode/src/vs/sessions/contrib/chat/browser/branchChatSessionAction.js +2 -2
- package/vscode/src/vs/sessions/contrib/chat/browser/chat.contribution.js +312 -127
- package/vscode/src/vs/sessions/contrib/chat/browser/chatBackgroundTint.js +2 -2
- package/vscode/src/vs/sessions/contrib/chat/browser/getThemeColorsTool.d.ts +21 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/getThemeColorsTool.js +138 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/modelPicker.d.ts +68 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/modelPicker.js +302 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/newSessionAction.d.ts +3 -6
- package/vscode/src/vs/sessions/contrib/chat/browser/newSessionAction.js +42 -9
- package/vscode/src/vs/sessions/contrib/chat/browser/newSessionFolderQuickPickAction.js +4 -4
- package/vscode/src/vs/sessions/contrib/chat/browser/newSessionPickerTryout.js +1 -1
- package/vscode/src/vs/sessions/contrib/chat/browser/openSessionLinkOpener.contribution.d.ts +3 -2
- package/vscode/src/vs/sessions/contrib/chat/browser/openSessionLinkOpener.contribution.js +29 -18
- package/vscode/src/vs/sessions/contrib/chat/browser/promptsService.d.ts +2 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/promptsService.js +11 -1
- package/vscode/src/vs/sessions/contrib/chat/browser/runScriptAction.js +91 -98
- package/vscode/src/vs/sessions/contrib/chat/browser/runScriptCustomTaskWidget.js +21 -21
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionTurnChanges.js +5 -5
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionsChatAccessibilityHelp.d.ts +2 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sessionsChatAccessibilityHelp.js +511 -211
- package/vscode/src/vs/sessions/contrib/chat/browser/sharedChatInputComposer.contribution.d.ts +9 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sharedChatInputComposer.contribution.js +146 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sideChatOrchestration.d.ts +13 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sideChatOrchestration.js +14 -0
- package/vscode/src/vs/sessions/contrib/chat/browser/sideChatProvider.contribution.d.ts +3 -8
- package/vscode/src/vs/sessions/contrib/chat/browser/sideChatProvider.contribution.js +10 -8
- package/vscode/src/vs/sessions/contrib/extensions/browser/agentsWindowExtensionAutoEnablementTelemetry.d.ts +30 -0
- package/vscode/src/vs/sessions/contrib/extensions/browser/agentsWindowExtensionAutoEnablementTelemetry.js +178 -0
- package/vscode/src/vs/sessions/contrib/extensions/browser/agentsWindowExtensionsAccessibilityHelp.d.ts +10 -0
- package/vscode/src/vs/sessions/contrib/extensions/browser/agentsWindowExtensionsAccessibilityHelp.js +61 -0
- package/vscode/src/vs/sessions/contrib/extensions/browser/agentsWindowExtensionsWidget.d.ts +100 -0
- package/vscode/src/vs/sessions/contrib/extensions/browser/agentsWindowExtensionsWidget.js +687 -0
- package/vscode/src/vs/sessions/contrib/extensions/browser/extensions.contribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/extensions/browser/extensions.contribution.js +88 -0
- package/vscode/src/vs/sessions/contrib/extensions/browser/media/agentsWindowExtensions.css +182 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostAgentPicker.d.ts +57 -6
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostAgentPicker.js +94 -108
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostPolicyContinuationPresenter.d.ts +12 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostPolicyContinuationPresenter.js +48 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostSettings.contribution.js +4 -4
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostSettingsFileSystemProvider.js +4 -4
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentHostSettingsShared.js +3 -1
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentSessionSettings.contribution.js +2 -2
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/agentSessionSettingsFileSystemProvider.js +7 -7
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/localAgentHostSessionsProvider.d.ts +107 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/localAgentHostSessionsProvider.js +447 -0
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/mobile/mobileChatPhoneInputPresenter.js +15 -10
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/openAgentHostStateFileAction.js +1 -1
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/openSubagentChat.d.ts +2 -1
- package/vscode/src/vs/sessions/contrib/providers/agentHost/browser/openSubagentChat.js +92 -34
- package/vscode/src/vs/sessions/contrib/providers/copilotChatSessions/browser/modePicker.js +12 -5
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/entryDrivenProviderContribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/entryDrivenProviderContribution.js +1 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/hostFilter.contribution.js +1 -1
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/hostFilterActionViewItem.js +15 -15
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/manageRemoteAgentHosts.js +9 -9
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/managedReconnectAgentHostContribution.js +5 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/missionControlAgentHostContribution.d.ts +1 -0
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/missionControlAgentHostContribution.js +39 -25
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/mobileHostFilterActionViewItem.js +13 -13
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHost.contribution.js +13 -13
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostActions.js +110 -145
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/tunnelAgentHost.contribution.js +2 -4
- package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/wslAgentHost.contribution.js +6 -2
- package/vscode/src/vs/sessions/contrib/sessionInputBanners/browser/media/sessionWorktreeCleanupEditor.css +118 -90
- package/vscode/src/vs/sessions/contrib/sessionInputBanners/browser/sessionWorktreeCleanupAccessibilityHelp.d.ts +1 -1
- package/vscode/src/vs/sessions/contrib/sessionInputBanners/browser/sessionWorktreeCleanupAccessibilityHelp.js +48 -13
- package/vscode/src/vs/sessions/contrib/sessionInputBanners/browser/sessionWorktreeCleanupEditor.d.ts +89 -10
- package/vscode/src/vs/sessions/contrib/sessionInputBanners/browser/sessionWorktreeCleanupEditor.js +1375 -182
- package/vscode/src/vs/sessions/contrib/sessionInputBanners/browser/sessionWorktreeCleanupEditorInput.js +1 -1
- package/vscode/src/vs/sessions/contrib/sessions/browser/mobile/mobileOverlayContribution.js +3 -3
- package/vscode/src/vs/sessions/services/agentHost/browser/agentHostCustomizationService.d.ts +3 -1
- package/vscode/src/vs/sessions/services/agentHost/browser/agentHostCustomizationService.js +30 -3
- package/vscode/src/vs/sessions/skills/all_/SKILL.md.js +4 -3
- package/vscode/src/vs/sessions/skills/generate-chat-background/SKILL.md +34 -0
- package/vscode/src/vs/sessions/skills/troubleshoot/SKILL.md +1 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadChatArtifactIntegrations.d.ts +30 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatArtifactIntegrations.js +484 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatDebug.d.ts +1 -0
- package/vscode/src/vs/workbench/api/browser/mainThreadChatDebug.js +7 -5
- package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.d.ts +1 -19
- package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.js +4 -80
- package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatPetJumpGameAccessibleView.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatPetJumpGameAccessibleView.js +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.js +30 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.js +23 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.d.ts +6 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +513 -171
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +133 -124
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +83 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +110 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFindActions.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatNewActions.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPromptNavigationActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQueueActions.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +18 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/createPluginAction.js +32 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/openAgentHostStateFileAction.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/agentHostCompletionAction.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentHostCompletionAction.js +73 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginCommands.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditor.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditor.js +11 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.d.ts +7 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.js +49 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationContentExpander.js +8 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationItemProvider.d.ts +10 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationItemProvider.js +235 -76
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHost.contribution.js +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatContribution.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatContribution.js +71 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatInputState.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatMoveEditors.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatMoveEditors.js +46 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostCopilotCliSettingsContribution.d.ts +9 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostCopilotCliSettingsContribution.js +125 -53
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostCustomizationMarketplaceInstallProvider.d.ts +26 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostCustomizationMarketplaceInstallProvider.js +493 -162
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostEditReview.d.ts +187 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostEditReview.js +1000 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostImportConversationStore.d.ts +3 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLocalModelSupport.d.ts +97 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLocalModelSupport.js +407 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpAppToolsService.d.ts +52 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpAppToolsService.js +361 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpServerMigrationProvider.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpServerMigrationProvider.js +72 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostModeSynchronizer.js +1 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPermissionMirror.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPermissionMirror.js +51 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPermissionUiContribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPolicyContinuation.d.ts +45 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPolicyContinuation.js +377 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPolicyContinuationEditor.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPolicyContinuationEditor.js +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPolicyUnavailableSession.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPolicyUnavailableSession.js +109 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPromptCacheNotification.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostRemoteByokNotification.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostResponseFileChanges.d.ts +24 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostResponseFileChanges.js +87 -51
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostRootConfigForwarder.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSandboxNotification.d.ts +48 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSandboxNotification.js +434 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSandboxNotifications.js +18 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSandboxPathGrant.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSandboxPathGrant.js +19 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.d.ts +134 -49
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.js +1627 -491
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionInputPills.d.ts +60 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionInputPills.js +572 -133
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListContribution.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListContribution.js +65 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListController.d.ts +15 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListController.js +114 -50
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListStore.d.ts +27 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListStore.js +105 -49
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionWorkingDirectoryResolver.d.ts +8 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionWorkingDirectoryResolver.js +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionWorkingDirectorySynchronizer.js +6 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSettings.contribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSettingsFileSystemProvider.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSignedOutCompatibilityContribution.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSignedOutCompatibilityContribution.js +54 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSignedOutModelsNotification.d.ts +2 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSignedOutModelsNotification.js +6 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSteeringMessageHandoff.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSteeringMessageHandoff.js +138 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSubagentProgress.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSubagentProgress.js +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostTerminalContribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostUntitledProvisionalSessionService.d.ts +7 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostUntitledProvisionalSessionService.js +70 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentSessionSettings.contribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentSessionSettingsFileSystemProvider.d.ts +13 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentSessionSettingsFileSystemProvider.js +96 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/applyAgentHostSubmitConfig.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/codexContinuation.contribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/codexContinuationGuide.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/localModel.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/localModel.contribution.js +60 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/localModelActions.d.ts +61 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/localModelActions.js +476 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/localModelReadyNotification.d.ts +70 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/localModelReadyNotification.js +422 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/localModelSetupProgress.d.ts +108 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/localModelSetupProgress.js +744 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/openSessionLinkOpener.contribution.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/openSessionLinkOpener.contribution.js +36 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution.js +21 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.js +112 -61
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjection.js +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.d.ts +31 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionsExperiments.contribution.js +15 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.js +28 -26
- 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/agentSessionsConfiguration.js +40 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.contribution.js +115 -61
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWorkspaceService.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWorkspaceService.js +7 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/copilotExtensionsService.d.ts +15 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/copilotExtensionsService.js +63 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.d.ts +10 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.js +39 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMarketplace.contribution.js +28 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMarketplaceInstallService.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMarketplaceInstallService.js +159 -86
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationAccessibility.js +23 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationServiceImpl.d.ts +20 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationServiceImpl.js +281 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationsTelemetryService.js +6 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpServerCustomizationMigration.d.ts +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpServerCustomizationMigration.js +390 -112
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpServerEnvironmentVariables.d.ts +56 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpServerEnvironmentVariables.js +298 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgetRegistry.d.ts +6 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgetRegistry.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatReferenceAttachmentWidget.contribution.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/btwSlashCommand.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/btwSlashCommand.js +84 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.shared.contribution.js +648 -652
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostChatDebugProvider.d.ts +14 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostChatDebugProvider.js +74 -57
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.js +32 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheExplorerView.js +124 -124
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheInsights.js +72 -72
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugDetailPanel.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.js +8 -2
- 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 +3 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEnablement.js +6 -5
- 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 +22 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHomeView.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHookContentRenderer.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.js +24 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugMessageContentRenderer.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugModelTurnContentRenderer.js +23 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.js +35 -35
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugToolCallContentRenderer.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugWireLogView.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugWireLogView.js +60 -50
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +88 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorAccessibility.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +43 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +13 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationModelManager.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationModelManager.js +18 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +9 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +20 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingTextModelChangeService.js +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatGoalSummaryService.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatGoalSummaryService.js +21 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/chatImageCarouselService.d.ts +15 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatImageCarouselService.js +35 -21
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatNetworkConfiguration.js +6 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +31 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievements.contribution.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievementsEditor.js +54 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievementsEditorInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetAchievementsWidget.js +34 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPetColorsWidget.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/chatProgressConfiguration.d.ts +69 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatProgressConfiguration.js +164 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/chatPromoNotification.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatQuotaNotification.js +25 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/chatRepoInfo.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionCommit.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionCommit.js +85 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionDescription.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.js +20 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupGrowthSession.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.js +25 -58
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSideChatProvider.d.ts +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSideChatProvider.js +114 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommands.js +78 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusPromo.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusPromo.js +13 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/codexStatusEntry.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipCatalog.js +20 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.d.ts +22 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.js +52 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWindowNotifier.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/claudePluginRecommendations.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/contextContrib/chatContext.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/defaultModelContribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/editorChatUsage.contribution.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/enablementStatusWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/feedbackSurvey/chatHarnessSwitchFeedbackSurveyService.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/githubRepoFetcher.d.ts +5 -55
- package/vscode/src/vs/workbench/contrib/chat/browser/githubRepoFetcher.js +40 -220
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelsConfigurationService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatPetAchievements.css +81 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/onboarding/chatInputSpotlightTour.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/onboarding/chatInputSpotlightTour.js +248 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/onboarding/chatOnboardingEligibility.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/onboarding/chatOnboardingEligibility.js +54 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/onboarding/modelPickerTryout.contribution.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorOverlay.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginGitCommandService.d.ts +6 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginGitCommandService.js +128 -118
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginGitHubAuthentication.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginGitHubAuthentication.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.js +39 -43
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.js +20 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginUrlHandler.d.ts +26 -42
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginUrlHandler.js +216 -165
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +7 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptFileActions.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptFileActions.js +12 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptFileContributions.js +16 -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.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +14 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/skillActions.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/skillActions.js +7 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimeline.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineCard.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineGutterRail.js +8 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineModel.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineModel.js +36 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineRulerRail.js +5 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptTimeline/promptTimelineStickyHeader.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptsDebugContribution.js +20 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxRepositoryPicker.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxRepositoryPicker.js +106 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionListController.d.ts +19 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/cloudSandboxSessionListController.js +165 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/editorCloudSandboxContribution.d.ts +57 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/editorCloudSandboxContribution.js +511 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/missionControlEnvironmentActions.js +16 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/remoteAgentHost.contribution.js +137 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/remoteAgentHostAuthenticationResolver.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/remoteAgentHostAuthenticationResolver.js +136 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/remoteAgentHostChatContribution.d.ts +8 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/remoteAgentHostChatContribution.js +155 -39
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/remoteAgentHostCustomizationHarness.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/remoteAgentHostCustomizationHarness.js +16 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/clientToolSetsContribution.js +32 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsConfirmationService.js +39 -39
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.js +78 -48
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/utilityModelContribution.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatFind/chatFindAccessibilityHelp.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatPetWidgetService.d.ts +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatPetWidgetService.js +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidgetService.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidgetService.js +9 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatQueuePickerActionItem.d.ts +2 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatQueuePickerActionItem.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCommandArgumentHint.d.ts +47 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCommandArgumentHint.js +139 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.d.ts +14 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +89 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorContrib.js +18 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorHover.js +11 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputPlaceholderDecoration.d.ts +11 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputPlaceholderDecoration.js +29 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputSessionLinkProvider.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputSessionLinkProvider.js +82 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/chatQuick.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditor.d.ts +17 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditor.js +134 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/media/chatEditor.css +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.d.ts +13 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.js +172 -131
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatOpenDiagnosticsService.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatOpenDiagnosticsService.js +103 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.d.ts +59 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.js +481 -271
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/remoteChatSessionRestorer.d.ts +148 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/remoteChatSessionRestorer.js +575 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatSideChatService.d.ts +13 -17
- package/vscode/src/vs/workbench/contrib/chat/common/chatSideChatService.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatThinkingTitleService.d.ts +34 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatThinkingTitleService.js +176 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatUtilityModelService.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatUtilityModelService.js +190 -0
- package/vscode/src/vs/workbench/contrib/chat/common/customizationMarketplaceInstallService.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/common/customizationMarketplaceInstallService.js +5 -1
- package/vscode/src/vs/workbench/contrib/chat/common/editing/chatSessionReviewPreferences.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/common/editing/chatSessionReviewPreferences.js +25 -0
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatModelStore.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionOperationLog.js +7 -1
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionStore.js +17 -18
- package/vscode/src/vs/workbench/contrib/chat/common/participants/chatSlashCommands.d.ts +27 -6
- package/vscode/src/vs/workbench/contrib/chat/common/participants/chatSlashCommands.js +21 -2
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.js +26 -13
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +80 -52
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptBodyAutocompletion.d.ts +6 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptBodyAutocompletion.js +57 -4
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.js +27 -15
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptDocumentSemanticTokensProvider.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptDocumentSemanticTokensProvider.js +27 -11
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.d.ts +10 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +383 -51
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.d.ts +10 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.js +211 -32
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptModelResolver.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptModelResolver.js +77 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptSkillResolver.d.ts +22 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptSkillResolver.js +87 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptToolResolver.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptToolResolver.js +53 -0
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.d.ts +26 -6
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +816 -195
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/customizationMigrationTelemetryService.d.ts +10 -11
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/customizationMigrationTelemetryService.js +135 -95
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/confirmationTool.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/manageTodoListTool.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/reviewPlanTool.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.d.ts +1 -10
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.js +13 -98
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactRulesTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactsTool.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +70 -73
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +1 -1
- package/vscode/src/vs/workbench/contrib/imageCarousel/browser/imageCarousel.contribution.js +10 -10
- package/vscode/src/vs/workbench/contrib/imageCarousel/browser/imageCarouselEditor.d.ts +15 -19
- package/vscode/src/vs/workbench/contrib/imageCarousel/browser/imageCarouselEditor.js +122 -202
- package/vscode/src/vs/workbench/contrib/imageCarousel/browser/imageCarouselEditorInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/imageCarousel/browser/imageCarouselTypes.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/imageCarousel/browser/media/imageCarousel.css +19 -50
- 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 +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatEditReviewSession.js +3 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +4 -4
- 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 +7 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.js +10 -10
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +16 -16
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +20 -20
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.d.ts +1 -12
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.js +2 -43
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.d.ts +6 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.js +14 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.js +15 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +42 -96
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.js +2 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +5 -4
- 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 +22 -13
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/killTerminalTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.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.js +76 -75
- 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/common/terminalSandboxService.js +4 -4
- package/vscode/src/vs/workbench/services/agentEditorComments/browser/agentEditorCommentsOverlayWidget.js +3 -3
- package/vscode/src/vs/workbench/services/agentHost/browser/editorRemoteAgentHostServiceClient.d.ts +20 -3
- package/vscode/src/vs/workbench/services/agentHost/browser/editorRemoteAgentHostServiceClient.js +56 -14
- package/vscode/src/vs/workbench/services/agentHost/browser/localModelService.d.ts +52 -0
- package/vscode/src/vs/workbench/services/agentHost/browser/localModelService.js +294 -0
- package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentCustomizationMeta.d.ts +0 -27
- package/vscode/src/vs/platform/agentHost/common/meta/vscode/agentCustomizationMeta.js +0 -14
- package/vscode/src/vs/platform/agentHost/common/meta/vscode/clientPluginCustomizationMeta.d.ts +0 -17
- package/vscode/src/vs/platform/agentHost/common/meta/vscode/clientPluginCustomizationMeta.js +0 -22
- package/vscode/src/vs/platform/agentHost/common/semanticSearchConstants.d.ts +0 -8
- package/vscode/src/vs/platform/agentHost/common/semanticSearchConstants.js +0 -8
- package/vscode/src/vs/platform/browserView/common/browserChatToolReferenceNames.d.ts +0 -23
- package/vscode/src/vs/platform/browserView/common/browserChatToolReferenceNames.js +0 -17
- package/vscode/src/vs/platform/customizationMarketplace/common/mcpGalleryMarketplaceProvider.d.ts +0 -22
- package/vscode/src/vs/platform/customizationMarketplace/common/mcpGalleryMarketplaceProvider.js +0 -158
- package/vscode/src/vs/sessions/contrib/chat/browser/btwSlashCommand.contribution.d.ts +0 -15
- package/vscode/src/vs/sessions/contrib/chat/browser/btwSlashCommand.contribution.js +0 -106
- package/vscode/src/vs/sessions/contrib/chat/browser/unifiedWorkspacePickerConfiguration.d.ts +0 -3
- package/vscode/src/vs/sessions/contrib/chat/browser/unifiedWorkspacePickerConfiguration.js +0 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationSyncProvider.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationSyncProvider.js +0 -55
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.d.ts +0 -65
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.js +0 -441
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostAllowSignedOutWhenUsableContribution.d.ts +0 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostAllowSignedOutWhenUsableContribution.js +0 -46
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLocalCustomizations.d.ts +0 -97
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLocalCustomizations.js +0 -241
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpServerSupport.d.ts +0 -141
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpServerSupport.js +0 -731
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpServerSupportScope.d.ts +0 -46
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpServerSupportScope.js +0 -313
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostToolUtils.d.ts +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostToolUtils.js +0 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/applyAgentHostSessionConfig.d.ts +0 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/applyAgentHostSessionConfig.js +0 -58
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/syncedCustomizationBundler.d.ts +0 -140
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/syncedCustomizationBundler.js +0 -358
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/copilotConnectorsService.d.ts +0 -139
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/copilotConnectorsService.js +0 -944
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMarketplaceWorkbenchService.d.ts +0 -50
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMarketplaceWorkbenchService.js +0 -213
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/githubMcpRegistryIcons.d.ts +0 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/githubMcpRegistryIcons.js +0 -605
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditing.d.ts +0 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditing.js +0 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/remoteAgentHostConnectionCustomization.d.ts +0 -43
- package/vscode/src/vs/workbench/contrib/chat/browser/remoteAgentHost/remoteAgentHostConnectionCustomization.js +0 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.d.ts +0 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.js +0 -261
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.d.ts +0 -59
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.js +0 -72
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolHelpers.d.ts +0 -5
- package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolHelpers.js +0 -12
- package/vscode/src/vs/workbench/contrib/chat/common/workingDirectory.d.ts +0 -35
- package/vscode/src/vs/workbench/contrib/chat/common/workingDirectory.js +0 -36
- package/vscode/src/vs/workbench/services/agentHost/common/editorRemoteAgentHostTransport.d.ts +0 -47
- package/vscode/src/vs/workbench/services/agentHost/common/editorRemoteAgentHostTransport.js +0 -362
|
@@ -7,31 +7,39 @@ import { status } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/a
|
|
|
7
7
|
import { Delayer, raceCancellation, disposableTimeout, raceCancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
8
8
|
import { decodeBase64, VSBuffer, encodeBase64 } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
|
|
9
9
|
import { CancellationTokenSource, CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
|
|
10
|
-
import { CancellationError, isCancellationError, getErrorCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
10
|
+
import { CancellationError, isCancellationError, getErrorCode, getErrorMessage } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
11
11
|
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
12
12
|
import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
13
13
|
import { getCopilotPlanFromEntitlement, getChatErrorDetailsFromMeta } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatErrorMessages';
|
|
14
14
|
import { DisposableStore, Disposable, MutableDisposable, DisposableMap, toDisposable, DisposableResourceMap, DisposableSet } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
15
|
-
import { ResourceMap, ResourceSet } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
15
|
+
import { ResourceMap, ResourceSet, LRUCache } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
16
16
|
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
17
17
|
import { equals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
|
|
18
18
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
19
19
|
import { isEqual, extUriBiasedIgnorePathCase } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
20
20
|
import { StopWatch } from '@codingame/monaco-vscode-api/vscode/vs/base/common/stopwatch';
|
|
21
21
|
import { AgentHostFirstResponseTiming, nextRendererRootInvocationOrdinal } from './agentHostFirstResponseTelemetry.js';
|
|
22
|
+
import { AgentHostSteeringMessageHandoff } from './agentHostSteeringMessageHandoff.js';
|
|
22
23
|
import { MicrotaskDelay } from '@codingame/monaco-vscode-api/vscode/vs/base/common/symbols';
|
|
23
24
|
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
24
25
|
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
26
|
+
import { getOlderHostSubagentChatUri } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/browser/agentHostOlderHostCompatibility';
|
|
27
|
+
import { AccessibilitySignal } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService';
|
|
28
|
+
import { IAccessibilitySignalService } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService.service';
|
|
29
|
+
import { IAccessibilityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/common/accessibility.service';
|
|
30
|
+
import { getAgentHostSessionResource, CHAT_SUBAGENT_RESOURCE_QUERY_PARAM, newAgentHostSessionUri, newAgentHostChatUri } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostSessionIdentity';
|
|
31
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/hash';
|
|
32
|
+
import { getAgentHostChatId, isChatReadOnly, getErrorResponsePart, getTurnError, StateComponents, getSessionChatResource, mergeSessionWithDefaultChat, readSessionWorkspaceless, readSessionScratchFolders } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/sessionState';
|
|
33
|
+
import { getTelemetryChatId } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentTelemetryCorrelation';
|
|
27
34
|
import { IAgentHostConnectionsService } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostConnectionsService.service';
|
|
28
35
|
import { isLocation } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages';
|
|
29
36
|
import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service';
|
|
30
37
|
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
31
|
-
import { AgentHostMcpToolRoutingEnabledSettingId
|
|
32
|
-
import { AgentHostCanvasCollection } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/canvases/common/agentHostCanvas';
|
|
38
|
+
import { AgentHostMcpToolRoutingEnabledSettingId } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentService';
|
|
39
|
+
import { getAgentHostCanvasDefinitionsChangedEvent, AgentHostCanvasCollection } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/canvases/common/agentHostCanvas';
|
|
33
40
|
import { isCanvasOwner } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/canvases/common/canvas';
|
|
34
41
|
import { fromAgentHostUri, agentHostAuthority, LOCAL_AGENT_HOST_AUTHORITY } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostUri';
|
|
42
|
+
import { getPendingSteeringMessages } from '../../../../../../platform/agentHost/common/agentSessionMessage.js';
|
|
35
43
|
import { isCopilotAgentHostSessionType, isCopilotAgentHostProvider } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostSessionType';
|
|
36
44
|
import { isCustomizationEnabled } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/customizationEnablement';
|
|
37
45
|
import { findDeepestContainingWorkingDirectory } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostWorkingDirectories';
|
|
@@ -39,45 +47,53 @@ import { getElementAttachmentCorrelationId, toElementAttachmentMeta, AgentHostEl
|
|
|
39
47
|
import { AgentFeedbackAttachmentDisplayKind, AgentFeedbackAttachmentMetadataKey } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/meta/vscode/agentFeedbackAttachments';
|
|
40
48
|
import { BrowserViewAttachmentMetadataKey, BrowserViewAttachmentDisplayKind } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/meta/vscode/browserViewAttachments';
|
|
41
49
|
import { readToolCallMeta, readAgentToolOutputDelta } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/meta/agentToolCallMeta';
|
|
50
|
+
import { readMcpServerConnectorName, readMcpRoutingServers } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/meta/vscode/mcpCustomizationMeta';
|
|
42
51
|
import { filterSessionConfigValues } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/sessionConfigProperties';
|
|
43
52
|
import { readAttachmentDetail, withAttachmentDetail } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/meta/attachmentMeta';
|
|
44
53
|
import { toAgentPermissionResponseMeta, readAgentPermissionResponseMeta } from '../../../../../../platform/agentHost/common/meta/vscode/agentPermissionResponseMeta.js';
|
|
45
|
-
import {
|
|
54
|
+
import { readArtifactIntegrationRequest } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/meta/agentHostArtifactIntegrationMeta';
|
|
55
|
+
import { readCompletionAttachmentMeta } from '../../../../../../platform/agentHost/common/meta/vscode/agentCompletionAttachmentMeta.js';
|
|
46
56
|
import { readSlashCommandResource } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/meta/vscode/agentSlashCommandOutputMeta';
|
|
47
57
|
import { IRemoteAgentHostService } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/remoteAgentHostService.service';
|
|
48
58
|
import { agentHostClientConnectionKindValidator, AgentHostClientConnectionKind } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostTelemetry';
|
|
49
59
|
import { SessionConfigKey } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/sessionConfigKeys';
|
|
50
60
|
import { mergeChatSensitiveEditLocations, getChatSensitiveEditLocations, ChatHookFilesLocationsSettingId, ChatAgentFilesLocationsSettingId } from '@codingame/monaco-vscode-api/vscode/vs/platform/chat/common/chatSettings';
|
|
51
61
|
import { resolveAgentHostSessionTrustFolders } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentHostWorkspaceTrust';
|
|
52
|
-
import { SEMANTIC_SEARCH_TOOL_NAME, CLIENT_SEMANTIC_SEARCH_TOOL_ID } from '
|
|
62
|
+
import { SEMANTIC_SEARCH_TOOL_NAME, CLIENT_SEMANTIC_SEARCH_TOOL_ID } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/semanticSearchConstants';
|
|
53
63
|
import { RUNTIME_TOOL_SEARCH_TOOL_NAME, CLIENT_TOOL_SEARCH_REFERENCE_NAME } from '../../../../../../platform/agentHost/common/toolSearchConstants.js';
|
|
64
|
+
import { readAgentPlanReview } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/meta/agentPlanReview';
|
|
65
|
+
import { readComputerUseSetupCard, readComputerUseActivationCard, getComputerUseActivationAnswers, isComputerUseActivationAccepted } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/meta/vscode/computerUse';
|
|
54
66
|
import { observableFromSubscription } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/agentSubscription';
|
|
55
|
-
import { ContentEncoding } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/common/commands';
|
|
67
|
+
import { AuthenticateTargetKind, ContentEncoding } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/common/commands';
|
|
56
68
|
import { CompletionItemKind } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-session/commands';
|
|
57
69
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-chat/commands';
|
|
58
70
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-changeset/commands';
|
|
71
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/common/state';
|
|
59
72
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-root/state';
|
|
60
|
-
import { CustomizationType, SessionInputRequestKind, McpServerStatus, SessionStatus } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-session/state';
|
|
61
|
-
import { MessageKind, ToolCallConfirmationReason, ToolCallStatus, ChatInputAnswerValueKind, ChatInputAnswerState, ChatInputQuestionKind,
|
|
73
|
+
import { CustomizationType, SessionInputRequestKind, McpServerStatus, SessionStatus, SessionLifecycle } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-session/state';
|
|
74
|
+
import { MessageKind, ToolCallConfirmationReason, ToolCallStatus, ChatInputAnswerValueKind, ChatInputAnswerState, ChatInputQuestionKind, BackgroundWorkKind, ChatOriginKind, MessageAttachmentKind, TurnState, PendingMessageKind, ResponsePartKind, ToolCallContributorKind, ConfirmationOptionKind, ToolCallCancellationReason, ChatInputResponseKind, ToolResultContentType } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-chat/state';
|
|
62
75
|
import { TerminalClaimKind } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-terminal/state';
|
|
63
|
-
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-changeset/state';
|
|
76
|
+
import { ChangesetStatus } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-changeset/state';
|
|
64
77
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-resource-watch/state';
|
|
65
78
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-automation/state';
|
|
66
79
|
import '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/channels-automation-run/state';
|
|
67
80
|
import { compareProtocolVersions } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/version/registry';
|
|
68
81
|
import { isChatAction } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/sessionActions';
|
|
69
82
|
import { ProtocolError, AHP_NOT_FOUND, AHP_AUTH_REQUIRED } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/sessionProtocol';
|
|
70
|
-
import { parseChatUri, buildSubagentChatUri, isDefaultChatUri, isChatReadOnly, isSubagentChatUri, getErrorResponsePart, getTurnError, StateComponents, buildChatUri, buildDefaultChatUri, mergeSessionWithDefaultChat, readSessionWorkspaceless } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/sessionState';
|
|
71
83
|
import { ExtensionIdentifier } from '@codingame/monaco-vscode-api/vscode/vs/platform/extensions/common/extensions';
|
|
72
84
|
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
73
85
|
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
86
|
+
import { parsePermissionGrantOptionId, PermissionGrantScope } from '../../../../../../platform/agentHost/common/permissionRules.js';
|
|
87
|
+
import { mirrorAgentHostGrants } from './agentHostPermissionMirror.js';
|
|
88
|
+
import { SAVE_SANDBOX_PATH } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/sandboxPathGrant';
|
|
89
|
+
import { saveSandboxPathGrant } from './agentHostSandboxPathGrant.js';
|
|
90
|
+
import '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification';
|
|
91
|
+
import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
|
|
74
92
|
import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
|
|
75
93
|
import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
|
|
76
94
|
import { packErrorForTelemetry } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/errorTelemetry';
|
|
77
95
|
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
78
|
-
import { logSettingExperimentTrigger } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/experimentTrigger';
|
|
79
96
|
import { IWorkbenchAssignmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/assignment/common/assignmentService.service';
|
|
80
|
-
import '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService';
|
|
81
97
|
import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
82
98
|
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
83
99
|
import { IWorkspaceTrustRequestService, IWorkspaceTrustManagementService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspaceTrust.service';
|
|
@@ -85,8 +101,11 @@ import { IAgentHostTerminalService } from '@codingame/monaco-vscode-api/vscode/v
|
|
|
85
101
|
import { ITerminalChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
|
|
86
102
|
import { CellUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
87
103
|
import { isImageVariableEntry, isAgentFeedbackVariableEntry, isBrowserViewVariableEntry, isChatTranscriptContextVariableEntry, toChatTranscriptContextAttachmentMeta, ChatTranscriptContextAttachmentDisplayKind, getAgentHostCompletionReferenceKind, AgentHostCompletionReferenceKind, isChatReferenceVariableEntry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/attachments/chatVariableEntries';
|
|
88
|
-
import '@codingame/monaco-vscode-api/vscode/vs/base/common/
|
|
104
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/charCode';
|
|
89
105
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
106
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
107
|
+
import '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
|
|
108
|
+
import 'marked';
|
|
90
109
|
import '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatViewModel';
|
|
91
110
|
import { ChatInputStateOrigin, reviveSerializableInputState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatModel';
|
|
92
111
|
import { ToolConfirmKind, ChatErrorLevel, ChatRequestQueueKind, IChatToolInvocation, ElicitationState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService';
|
|
@@ -95,13 +114,16 @@ import { coerceImageBuffer } from '@codingame/monaco-vscode-api/vscode/vs/workbe
|
|
|
95
114
|
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
|
|
96
115
|
import { isInConversationModelChoice } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/modelSelection';
|
|
97
116
|
import { readAgentRuntimeModelConfiguration } from '../../../../../../platform/agentHost/common/meta/vscode/agentModelConfigurationMeta.js';
|
|
98
|
-
import {
|
|
117
|
+
import { readAgentModelConfigurationReport } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agentModelConfiguration';
|
|
118
|
+
import { isTerminalCommandPrompt, ChatSessionForkError, getChatSessionInitialMessageVariables } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatSessionsService';
|
|
99
119
|
import { IChatEntitlementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService.service';
|
|
100
120
|
import { IWorkingCopyService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyService.service';
|
|
101
121
|
import { ChatMode } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatModes';
|
|
102
|
-
import {
|
|
122
|
+
import { ChatConfiguration, ChatModeKind, ChatAgentLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
|
|
123
|
+
import { readAgentCustomizationMeta } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/meta/vscode/agentCustomizationMeta';
|
|
103
124
|
import { normalizeAgentHostApprovalConfig } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/agentHostConfigPolicy';
|
|
104
125
|
import { IChatEditingService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/editing/chatEditingService.service';
|
|
126
|
+
import { IChatSessionReviewPreferencesService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/editing/chatSessionReviewPreferences.service';
|
|
105
127
|
import { HIDE_AUTO_EXPLAINABILITY_TREATMENT } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatAutoModeExplainability';
|
|
106
128
|
import { AUTO_RAW_MODEL_ID, getLanguageModelDisplayNameWithProvider } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels';
|
|
107
129
|
import { ILanguageModelsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/languageModels.service';
|
|
@@ -112,8 +134,14 @@ import { isUntitledChatSession, getChatSessionType } from '@codingame/monaco-vsc
|
|
|
112
134
|
import { IChatAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/participants/chatAgents.service';
|
|
113
135
|
import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService.service';
|
|
114
136
|
import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
|
|
137
|
+
import { AgentHostLocalModelSupport } from './agentHostLocalModelSupport.js';
|
|
138
|
+
import { resolveAgentHostToolResultImage } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostToolResultImages';
|
|
139
|
+
import { getComputerUseSetupCardText, getComputerUseActivationCardText } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/computerUseSetup';
|
|
140
|
+
import { IComputerUseSetupService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/computerUseSetup.service';
|
|
115
141
|
import { getAgentSessionProviderIcon } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessions';
|
|
142
|
+
import { composeSessionActiveClient } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService';
|
|
116
143
|
import { IAgentHostActiveClientService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.service';
|
|
144
|
+
import { IAgentHostMcpAppToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpAppToolsService.service';
|
|
117
145
|
import { getMcpServerDisplayLabel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostCustomizationService';
|
|
118
146
|
import { IAgentHostCustomizationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostCustomizationService.service';
|
|
119
147
|
import { IAgentHostSessionWorkingDirectoryResolver } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionWorkingDirectoryResolver.service';
|
|
@@ -121,33 +149,41 @@ import { IAgentHostSessionWorkingDirectorySynchronizer } from '@codingame/monaco
|
|
|
121
149
|
import { IAgentHostShellInitSynchronizer } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostShellInitSynchronizer.service';
|
|
122
150
|
import { computeWorkingDirectories } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostNewSessionFolderService';
|
|
123
151
|
import { IAgentHostNewSessionFolderService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostNewSessionFolderService.service';
|
|
152
|
+
import { AgentHostEditReview } from './agentHostEditReview.js';
|
|
153
|
+
import { ITextFileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/textfile/common/textfiles.service';
|
|
154
|
+
import { observableConfigValue } from '@codingame/monaco-vscode-api/vscode/vs/platform/observable/common/platformObservableUtils';
|
|
124
155
|
import { AgentHostSnapshotController } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSnapshotController';
|
|
125
|
-
import { AgentHostResponseFileChangesProvider } from './agentHostResponseFileChanges.js';
|
|
156
|
+
import { AgentHostResponseFileChangesProvider, resolveTurnChangesetUri } from './agentHostResponseFileChanges.js';
|
|
126
157
|
import { AgentHostChatInputState, codexWriterLockMessage } from './agentHostChatInputState.js';
|
|
127
158
|
import { readChatInputState } from '../../../../../../platform/agentHost/common/meta/vscode/agentHostChatInputState.js';
|
|
128
159
|
import { AgentHostSandboxNotification } from './agentHostSandboxNotification.js';
|
|
129
160
|
import { IChatResponseFileChangesService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chatResponseFileChangesService.service';
|
|
130
161
|
import { toSessionReferenceModelRepresentation, toSessionReferenceAttachmentMeta, AgentHostSessionReferenceAttachmentDisplayKind, AgentHostSessionReferenceTrajectoryAttachmentDisplayKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionReferenceAttachment';
|
|
131
162
|
import { buildHostLocalEventsPath } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/copilotCliEventsUri';
|
|
163
|
+
import '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/copilotHomeService';
|
|
132
164
|
import { IAgentHostUntitledProvisionalSessionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostUntitledProvisionalSessionService.service';
|
|
133
165
|
import { IAgentHostImportConversationStore } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostImportConversationStore.service';
|
|
134
|
-
import { BOOLEAN_TRUE_OPTION_ID, parseAhpTerminalToolSessionId, turnsToHistory, messageToRequestOrigin, messageToRequestSource, messageToVariableData, turnToResponseDetails, activeTurnToProgress, systemNotificationToChatPart, getAgentHostActivityProgressId, usageInfoToChatUsage, usageInfoToQuotas, shouldObserveSubagentChat, toolCallStateToInvocation, toolCallStateToStreamingInvocation, appendToolOutput, updateStreamingToolInvocation,
|
|
135
|
-
import { COPILOT_HYDRA_FUSION_MODEL_NAMES,
|
|
136
|
-
import {
|
|
166
|
+
import { BOOLEAN_TRUE_OPTION_ID, parseAhpTerminalToolSessionId, turnsToHistory, messageToRequestOrigin, messageToRequestSource, messageToVariableData, turnToResponseDetails, activeTurnToProgress, turnToResultMetadata, chatUsageToSessionCost, toolCallStateToPreparedInvocation, systemNotificationToChatPart, getAgentHostActivityProgressId, usageInfoToChatUsage, usageInfoToQuotas, reasoningPartToThinking, shouldObserveSubagentChat, toolCallStateToInvocation, toolCallStateToStreamingInvocation, appendToolOutput, updateStreamingToolInvocation, toolCallAuthenticationServer, stringOrMarkdownToString, updateRunningToolSpecificData, canOwnSubagentChat, isSubagentTool, createInputRequestCarousel, convertProtocolAnswers, containsAutomaticReplyAnswer, createInputRequestPlanReview, getUrlInputRequestPresentation, getTerminalContent, makeAhpTerminalToolSessionId, finalizeToolInvocation, completedToolCallToEditParts, completedToolCallToSerialized, messageAttachmentsToVariableData, usageInfoToAutoModeResolution, formatTurnResponseDetails, rewriteAgentHostLinkTarget } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/stateToProgressAdapter';
|
|
167
|
+
import { COPILOT_HYDRA_FUSION_MODEL_NAMES, isCopilotHydraFusionModelId } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/copilotCliConfig';
|
|
168
|
+
import { getFusionTierLabel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/widget/input/modelPicker/modelPickerPresentation';
|
|
137
169
|
import { agentHostMcpServerId, autoAuthenticateMcpServer, modelRequiresAgentAuthentication } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostAuth';
|
|
138
170
|
import { isUnstartedSubagent, AgentHostSubagentProgress } from './agentHostSubagentProgress.js';
|
|
139
171
|
import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
|
|
140
|
-
import { COPILOT_CLI_AGENT_PROVIDER_ID, AgentSession, CODEX_AGENT_PROVIDER_ID } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agent';
|
|
141
|
-
import { ActionType } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/common/actions';
|
|
142
172
|
import { derived, derivedOpts } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/derived';
|
|
143
173
|
import { autorun, autorunPerKeyedItem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
|
|
144
|
-
import {
|
|
174
|
+
import { COPILOT_CLI_AGENT_PROVIDER_ID, CODEX_AGENT_PROVIDER_ID, AgentSession } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/agent';
|
|
175
|
+
import { ActionType } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/common/actions';
|
|
176
|
+
import { readMessageReplacedTurn, withMessageHiddenFromTranscript } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/meta/vscode/agentMessageMeta';
|
|
145
177
|
import { constObservable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/constObservable';
|
|
146
178
|
import { transaction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/transaction';
|
|
147
179
|
import { observableSignalFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableSignalFromEvent';
|
|
180
|
+
import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
|
|
148
181
|
import { waitForState } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/utils/utilsCancellation';
|
|
149
|
-
import {
|
|
182
|
+
import { observableFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableFromEvent';
|
|
183
|
+
import { ICopilotHomeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/environment/common/copilotHome.service';
|
|
150
184
|
import { getInlineToolInput } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/partialToolInput';
|
|
185
|
+
import { AhpErrorCodes, JsonRpcErrorCodes } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/state/protocol/common/errors';
|
|
186
|
+
import { readChatUsage } from '@codingame/monaco-vscode-api/vscode/vs/platform/agentHost/common/meta/vscode/agentUsageMeta';
|
|
151
187
|
|
|
152
188
|
var AgentHostSessionHandler_1;
|
|
153
189
|
const MAX_INLINED_UNSAVED_EDITOR_BYTES = 1024 * 1024;
|
|
@@ -161,9 +197,10 @@ class SubagentChatObservation extends DisposableStore {
|
|
|
161
197
|
super();
|
|
162
198
|
this.chatResource = chatResource;
|
|
163
199
|
this.isChatAvailable = false;
|
|
200
|
+
this.hasActiveTurn = observableValue(this, true);
|
|
164
201
|
}
|
|
165
202
|
}
|
|
166
|
-
function getMcpAuthenticationRequiredServers(sessionResource, state) {
|
|
203
|
+
function getMcpAuthenticationRequiredServers(sessionResource, backendSession, state) {
|
|
167
204
|
const servers = state?.customizations?.flatMap(
|
|
168
205
|
c => c.type === CustomizationType.McpServer ? [c] : c.children?.filter(c => c.type === CustomizationType.McpServer) ?? []
|
|
169
206
|
) ?? [];
|
|
@@ -178,7 +215,13 @@ function getMcpAuthenticationRequiredServers(sessionResource, state) {
|
|
|
178
215
|
const state = server.state;
|
|
179
216
|
return {
|
|
180
217
|
id: sessionResource.authority + "/" + server.id,
|
|
218
|
+
target: {
|
|
219
|
+
kind: AuthenticateTargetKind.McpServer,
|
|
220
|
+
session: ( backendSession.toString()),
|
|
221
|
+
customizationId: server.id
|
|
222
|
+
},
|
|
181
223
|
name: server.name,
|
|
224
|
+
connectorName: readMcpServerConnectorName(server),
|
|
182
225
|
resource: state.resource.resource,
|
|
183
226
|
oauthClient: state.oauthClient,
|
|
184
227
|
authorizationServers: state.resource.authorization_servers,
|
|
@@ -236,18 +279,6 @@ function unwrapSessionLoadErrorMessage(err) {
|
|
|
236
279
|
}
|
|
237
280
|
return message.replace(/^Failed to restore session .+?: /, "");
|
|
238
281
|
}
|
|
239
|
-
function resolveRestoredSubagentChatResource(parentSession, toolCallId, catalogResource, persistedResource) {
|
|
240
|
-
if (catalogResource) {
|
|
241
|
-
return catalogResource;
|
|
242
|
-
}
|
|
243
|
-
if (persistedResource) {
|
|
244
|
-
const parsed = parseChatUri(persistedResource);
|
|
245
|
-
if (parsed?.session === parentSession && parsed.chatId === `subagent/${toolCallId}`) {
|
|
246
|
-
return persistedResource;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
return buildSubagentChatUri(parentSession, toolCallId);
|
|
250
|
-
}
|
|
251
282
|
function lastTurnModelSelection(state) {
|
|
252
283
|
return lastTurnMessage(state)?.model;
|
|
253
284
|
}
|
|
@@ -432,85 +463,24 @@ function convertCarouselAnswers(raw, questions = []) {
|
|
|
432
463
|
}
|
|
433
464
|
return answers;
|
|
434
465
|
}
|
|
435
|
-
function getPlanReviewAction(planReview, actionId, actionLabel) {
|
|
436
|
-
if (actionId) {
|
|
437
|
-
const action = planReview.actions.find(a => a.id === actionId);
|
|
438
|
-
if (action) {
|
|
439
|
-
return action;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
if (actionLabel) {
|
|
443
|
-
return planReview.actions.find(a => a.label === actionLabel);
|
|
444
|
-
}
|
|
445
|
-
return undefined;
|
|
446
|
-
}
|
|
447
|
-
function submittedTextAnswer(value) {
|
|
448
|
-
return {
|
|
449
|
-
state: ChatInputAnswerState.Submitted,
|
|
450
|
-
value: {
|
|
451
|
-
kind: ChatInputAnswerValueKind.Text,
|
|
452
|
-
value
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
function submittedSelectedAnswer(value, feedback) {
|
|
457
|
-
return {
|
|
458
|
-
state: ChatInputAnswerState.Submitted,
|
|
459
|
-
value: {
|
|
460
|
-
kind: ChatInputAnswerValueKind.Selected,
|
|
461
|
-
value,
|
|
462
|
-
...(feedback ? {
|
|
463
|
-
freeformValues: [feedback]
|
|
464
|
-
} : {})
|
|
465
|
-
}
|
|
466
|
-
};
|
|
467
|
-
}
|
|
468
|
-
function convertPlanReviewResult(planReview, result) {
|
|
469
|
-
const feedback = result.feedback?.trim();
|
|
470
|
-
if (feedback) {
|
|
471
|
-
const action = getPlanReviewAction(planReview, result.actionId, result.action);
|
|
472
|
-
return {
|
|
473
|
-
response: ChatInputResponseKind.Accept,
|
|
474
|
-
answers: {
|
|
475
|
-
[planReview.answerQuestionId]: action ? submittedSelectedAnswer(action.id, feedback) : submittedTextAnswer(feedback)
|
|
476
|
-
}
|
|
477
|
-
};
|
|
478
|
-
}
|
|
479
|
-
if (result.rejected) {
|
|
480
|
-
return {
|
|
481
|
-
response: ChatInputResponseKind.Decline
|
|
482
|
-
};
|
|
483
|
-
}
|
|
484
|
-
const action = getPlanReviewAction(planReview, result.actionId, result.action);
|
|
485
|
-
if (!action) {
|
|
486
|
-
return {
|
|
487
|
-
response: ChatInputResponseKind.Decline
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
return {
|
|
491
|
-
response: ChatInputResponseKind.Accept,
|
|
492
|
-
answers: {
|
|
493
|
-
[planReview.answerQuestionId]: submittedSelectedAnswer(action.id)
|
|
494
|
-
}
|
|
495
|
-
};
|
|
496
|
-
}
|
|
497
466
|
function inputRequestResponsePartKey(part) {
|
|
498
467
|
return `ir:${part.request.id}:${JSON.stringify({
|
|
499
468
|
...part.request,
|
|
500
469
|
answers: undefined
|
|
501
470
|
})}`;
|
|
502
471
|
}
|
|
503
|
-
function getChatTitle(state, chatURI) {
|
|
472
|
+
function getChatTitle(state, chatURI, defaultChat) {
|
|
504
473
|
const chat = state.chats.find(chat => chat.resource === chatURI);
|
|
505
474
|
if (!chat) {
|
|
506
475
|
return undefined;
|
|
507
476
|
}
|
|
508
|
-
return chat.title || (
|
|
477
|
+
return chat.title || (chatURI === defaultChat ? state.title : undefined);
|
|
509
478
|
}
|
|
510
479
|
function snapshotInvocationToAdopt(opts, toolCallId) {
|
|
511
480
|
const emitted = opts.snapshotToolCalls?.get(toolCallId);
|
|
512
481
|
return emitted instanceof ChatToolInvocation ? emitted : undefined;
|
|
513
482
|
}
|
|
483
|
+
const emptyCanvasReferences = [];
|
|
514
484
|
let AgentHostChatSession = class AgentHostChatSession extends Disposable {
|
|
515
485
|
get history() {
|
|
516
486
|
return this._history;
|
|
@@ -519,14 +489,22 @@ let AgentHostChatSession = class AgentHostChatSession extends Disposable {
|
|
|
519
489
|
this._history = history;
|
|
520
490
|
this._onDidChangeHistory.fire(history);
|
|
521
491
|
}
|
|
492
|
+
get forkSession() {
|
|
493
|
+
return this._supportsFork() ? this._forkSessionIfWritable : undefined;
|
|
494
|
+
}
|
|
495
|
+
get createSideChat() {
|
|
496
|
+
return this._supportsSideChat() ? this._createSideChatIfWritable : undefined;
|
|
497
|
+
}
|
|
522
498
|
constructor(
|
|
523
499
|
sessionResource,
|
|
524
500
|
_history,
|
|
501
|
+
historyLoadError,
|
|
525
502
|
title,
|
|
526
503
|
backendSession,
|
|
504
|
+
toLanguageModelId,
|
|
527
505
|
sessionSubscription,
|
|
528
506
|
chatSubscription,
|
|
529
|
-
|
|
507
|
+
canvases,
|
|
530
508
|
_promptCacheNotification,
|
|
531
509
|
refreshChat,
|
|
532
510
|
_forkSession,
|
|
@@ -536,16 +514,23 @@ let AgentHostChatSession = class AgentHostChatSession extends Disposable {
|
|
|
536
514
|
historySubagentObservations,
|
|
537
515
|
onDispose,
|
|
538
516
|
interruptActiveResponse,
|
|
517
|
+
_supportsFork,
|
|
518
|
+
_createSideChat,
|
|
519
|
+
_supportsSideChat,
|
|
539
520
|
_logService,
|
|
540
521
|
_instantiationService
|
|
541
522
|
) {
|
|
542
523
|
super();
|
|
543
524
|
this.sessionResource = sessionResource;
|
|
544
525
|
this._history = _history;
|
|
526
|
+
this.historyLoadError = historyLoadError;
|
|
545
527
|
this.title = title;
|
|
546
528
|
this._promptCacheNotification = _promptCacheNotification;
|
|
547
529
|
this._forkSession = _forkSession;
|
|
548
530
|
this._renameSession = _renameSession;
|
|
531
|
+
this._supportsFork = _supportsFork;
|
|
532
|
+
this._createSideChat = _createSideChat;
|
|
533
|
+
this._supportsSideChat = _supportsSideChat;
|
|
549
534
|
this._logService = _logService;
|
|
550
535
|
this._instantiationService = _instantiationService;
|
|
551
536
|
this.progressObs = observableValue("agentHostProgress", []);
|
|
@@ -556,7 +541,31 @@ let AgentHostChatSession = class AgentHostChatSession extends Disposable {
|
|
|
556
541
|
this,
|
|
557
542
|
reader => this._chatState.read(reader).read(reader)?.backgroundWork?.filter(work => work.kind === BackgroundWorkKind.Shell).length
|
|
558
543
|
);
|
|
559
|
-
this.
|
|
544
|
+
this.sideChatOrigin = derived(this, reader => {
|
|
545
|
+
if (this._disposed.read(reader)) {
|
|
546
|
+
return undefined;
|
|
547
|
+
}
|
|
548
|
+
const session = this._sessionState.read(reader).read(reader);
|
|
549
|
+
const chat = this._chatState.read(reader).read(reader);
|
|
550
|
+
const origin = session?.chats.find(summary => summary.resource === chat?.resource)?.origin;
|
|
551
|
+
if (!session || origin?.kind !== ChatOriginKind.SideChat) {
|
|
552
|
+
return undefined;
|
|
553
|
+
}
|
|
554
|
+
const sourceChat = session.chats.find(summary => summary.resource === origin.chat);
|
|
555
|
+
return {
|
|
556
|
+
sourceSessionResource: getAgentHostSessionResource(this.sessionResource).with({
|
|
557
|
+
fragment: origin.chat === session.defaultChat ? "" : getAgentHostChatId(origin.chat)
|
|
558
|
+
}),
|
|
559
|
+
sourceTurnId: origin.turnId,
|
|
560
|
+
sourceTitle: sourceChat?.title,
|
|
561
|
+
selection: origin.selection ? {
|
|
562
|
+
text: origin.selection.text
|
|
563
|
+
} : undefined
|
|
564
|
+
};
|
|
565
|
+
});
|
|
566
|
+
this._disposed = observableValue(this, false);
|
|
567
|
+
this._onDidChangeCanvasDefinitions = this._register(( new Emitter()));
|
|
568
|
+
this._canvasDefinitionsTracking = this._register(( new MutableDisposable()));
|
|
560
569
|
this._promptCacheTracking = this._register(( new MutableDisposable()));
|
|
561
570
|
this._sandboxNotification = this._register(( new MutableDisposable()));
|
|
562
571
|
this._subagentTurnStores = this._register(( new DisposableMap()));
|
|
@@ -566,6 +575,28 @@ let AgentHostChatSession = class AgentHostChatSession extends Disposable {
|
|
|
566
575
|
this.onDidStartServerRequest = this._onDidStartServerRequest.event;
|
|
567
576
|
this._onDidChangeHistory = this._register(( new Emitter()));
|
|
568
577
|
this.onDidChangeHistory = this._onDidChangeHistory.event;
|
|
578
|
+
this.modelConfigurationState = derived(this, reader => {
|
|
579
|
+
const session = this._sessionState.read(reader).read(reader);
|
|
580
|
+
const chat = this._chatState.read(reader).read(reader);
|
|
581
|
+
const report = chat ? readAgentModelConfigurationReport(session?.config?.values, chat.resource) : undefined;
|
|
582
|
+
if (!report || this._disposed.read(reader)) {
|
|
583
|
+
return undefined;
|
|
584
|
+
}
|
|
585
|
+
const models = Object.fromEntries(Object.entries(report.models).flatMap(([rawId, options]) => {
|
|
586
|
+
const id = toLanguageModelId(rawId);
|
|
587
|
+
return id ? [[id, options]] : [];
|
|
588
|
+
}));
|
|
589
|
+
const id = report.current ? toLanguageModelId(report.current.id) : undefined;
|
|
590
|
+
return {
|
|
591
|
+
models,
|
|
592
|
+
...(id && report.current ? {
|
|
593
|
+
current: {
|
|
594
|
+
...report.current,
|
|
595
|
+
id
|
|
596
|
+
}
|
|
597
|
+
} : {})
|
|
598
|
+
};
|
|
599
|
+
});
|
|
569
600
|
const providerInputState = derived(this, reader => {
|
|
570
601
|
const session = this._sessionState.read(reader).read(reader);
|
|
571
602
|
const chat = this._chatState.read(reader).read(reader);
|
|
@@ -577,6 +608,9 @@ let AgentHostChatSession = class AgentHostChatSession extends Disposable {
|
|
|
577
608
|
this.isInputBlocked = this._inputState?.isInputBlocked ?? constObservable(false);
|
|
578
609
|
this.retryInput = this._inputState ? () => this._inputState.retry() : undefined;
|
|
579
610
|
this.isReadOnly = derived(this, reader => {
|
|
611
|
+
if (this._disposed.read(reader)) {
|
|
612
|
+
return true;
|
|
613
|
+
}
|
|
580
614
|
const sessionArchived = Boolean(
|
|
581
615
|
(this._sessionState.read(reader).read(reader)?.status ?? 0) & SessionStatus.IsArchived
|
|
582
616
|
);
|
|
@@ -584,14 +618,14 @@ let AgentHostChatSession = class AgentHostChatSession extends Disposable {
|
|
|
584
618
|
return (!chat && ( ( new URLSearchParams(this.sessionResource.query)).has(CHAT_SUBAGENT_RESOURCE_QUERY_PARAM))) || isChatReadOnly(chat?.interactivity, sessionArchived);
|
|
585
619
|
});
|
|
586
620
|
this.setStateSubscriptions(sessionSubscription, chatSubscription);
|
|
587
|
-
if (
|
|
621
|
+
if (canvases) {
|
|
588
622
|
const presentationChat = derived(
|
|
589
623
|
this,
|
|
590
|
-
reader => this.
|
|
624
|
+
reader => this._disposed.read(reader) ? undefined : this._chatState.read(reader).read(reader)
|
|
591
625
|
);
|
|
592
626
|
const references = derived(this, reader => {
|
|
593
627
|
const chat = presentationChat.read(reader);
|
|
594
|
-
return chat?.canvases ?? (chat ?
|
|
628
|
+
return chat?.canvases ?? (chat ? emptyCanvasReferences : undefined);
|
|
595
629
|
});
|
|
596
630
|
const owner = derivedOpts({
|
|
597
631
|
owner: this,
|
|
@@ -599,15 +633,20 @@ let AgentHostChatSession = class AgentHostChatSession extends Disposable {
|
|
|
599
633
|
}, reader => {
|
|
600
634
|
const session = this._sessionState.read(reader).read(reader);
|
|
601
635
|
const chat = this._chatState.read(reader).read(reader);
|
|
602
|
-
return !this.
|
|
603
|
-
providerId:
|
|
636
|
+
return !this._disposed.read(reader) && canvases.available.read(reader) && session?.lifecycle === SessionLifecycle.Ready && chat ? {
|
|
637
|
+
providerId: canvases.provider.providerId,
|
|
604
638
|
session: backendSession,
|
|
605
639
|
chat: ( URI.parse(chat.resource, true))
|
|
606
640
|
} : undefined;
|
|
607
641
|
});
|
|
608
642
|
this.canvasContext = derived(this, reader => {
|
|
609
643
|
const reference = owner.read(reader);
|
|
610
|
-
return reference ?
|
|
644
|
+
return reference ? canvases.provider.createContext(
|
|
645
|
+
reference,
|
|
646
|
+
references,
|
|
647
|
+
presentationChat,
|
|
648
|
+
this._onDidChangeCanvasDefinitions.event
|
|
649
|
+
) : undefined;
|
|
611
650
|
});
|
|
612
651
|
}
|
|
613
652
|
const hasActiveTurn = initialProgress !== undefined;
|
|
@@ -621,11 +660,28 @@ let AgentHostChatSession = class AgentHostChatSession extends Disposable {
|
|
|
621
660
|
}
|
|
622
661
|
this._register(historySubagentObservations);
|
|
623
662
|
this._register(toDisposable(onDispose));
|
|
624
|
-
this.interruptActiveResponseCallback = async () => interruptActiveResponse();
|
|
625
|
-
this.
|
|
626
|
-
|
|
663
|
+
this.interruptActiveResponseCallback = async () => !this._disposed.get() && interruptActiveResponse();
|
|
664
|
+
this._forkSessionIfWritable = (request, token, options) => {
|
|
665
|
+
if (this.isReadOnly.get()) {
|
|
666
|
+
throw ( new Error("Session is read-only"));
|
|
667
|
+
}
|
|
668
|
+
return this._forkSession(request, token, options);
|
|
669
|
+
};
|
|
670
|
+
this._createSideChatIfWritable = (turnId, token, selection) => {
|
|
671
|
+
if (this.isReadOnly.get()) {
|
|
672
|
+
throw ( new Error("Session is read-only"));
|
|
673
|
+
}
|
|
674
|
+
return this._createSideChat(turnId, token, selection);
|
|
675
|
+
};
|
|
676
|
+
this.renameSession = (title, token) => {
|
|
677
|
+
if (this.isReadOnly.get()) {
|
|
678
|
+
throw ( new Error("Session is read-only"));
|
|
679
|
+
}
|
|
680
|
+
return this._renameSession(title, token);
|
|
681
|
+
};
|
|
627
682
|
}
|
|
628
683
|
setStateSubscriptions(sessionSubscription, chatSubscription) {
|
|
684
|
+
this._canvasDefinitionsTracking.value = chatSubscription ? getAgentHostCanvasDefinitionsChangedEvent(chatSubscription)(() => this._onDidChangeCanvasDefinitions.fire()) : undefined;
|
|
629
685
|
this._promptCacheTracking.clear();
|
|
630
686
|
this._promptCacheTracking.value = sessionSubscription ? this._promptCacheNotification?.trackSession(this.sessionResource, sessionSubscription) : undefined;
|
|
631
687
|
this._sandboxNotification.clear();
|
|
@@ -645,7 +701,7 @@ let AgentHostChatSession = class AgentHostChatSession extends Disposable {
|
|
|
645
701
|
}
|
|
646
702
|
dispose() {
|
|
647
703
|
if (!this._store.isDisposed) {
|
|
648
|
-
this.
|
|
704
|
+
this._disposed.set(true, undefined);
|
|
649
705
|
this.complete();
|
|
650
706
|
this._onWillDispose.fire();
|
|
651
707
|
}
|
|
@@ -690,17 +746,23 @@ let AgentHostChatSession = class AgentHostChatSession extends Disposable {
|
|
|
690
746
|
} : {}),
|
|
691
747
|
isSystemInitiated: options?.isSystemInitiated,
|
|
692
748
|
requestSource: options?.requestSource,
|
|
749
|
+
...(options?.artifactRequest ? {
|
|
750
|
+
artifactRequest: options.artifactRequest
|
|
751
|
+
} : {}),
|
|
693
752
|
systemInitiatedLabel: options?.systemInitiatedLabel,
|
|
694
753
|
isHidden: options?.isHidden,
|
|
695
754
|
isRequestHidden: options?.isRequestHidden,
|
|
696
755
|
timestamp: options?.timestamp,
|
|
697
756
|
isTerminalRequest: options?.isTerminalRequest,
|
|
698
757
|
resume: options?.resume,
|
|
758
|
+
...(options?.replacesRequestId ? {
|
|
759
|
+
replacesRequestId: options.replacesRequestId
|
|
760
|
+
} : {}),
|
|
699
761
|
origin: options?.origin
|
|
700
762
|
});
|
|
701
763
|
}
|
|
702
764
|
};
|
|
703
|
-
AgentHostChatSession = ( __decorate([( __param(
|
|
765
|
+
AgentHostChatSession = ( __decorate([( __param(21, ILogService)), ( __param(22, IInstantiationService))], AgentHostChatSession));
|
|
704
766
|
function offsetToPosition(text, offset) {
|
|
705
767
|
let lineNumber = 1;
|
|
706
768
|
let column = 1;
|
|
@@ -718,8 +780,34 @@ function offsetToPosition(text, offset) {
|
|
|
718
780
|
column
|
|
719
781
|
};
|
|
720
782
|
}
|
|
783
|
+
function equalsActiveClientState(one, other) {
|
|
784
|
+
if (one === other) {
|
|
785
|
+
return true;
|
|
786
|
+
}
|
|
787
|
+
if (Array.isArray(one) || Array.isArray(other)) {
|
|
788
|
+
return Array.isArray(one) && Array.isArray(other) && one.length === other.length && one.every((value, index) => equalsActiveClientState(value, other[index]));
|
|
789
|
+
}
|
|
790
|
+
if (!one || !other || typeof one !== "object" || typeof other !== "object") {
|
|
791
|
+
return false;
|
|
792
|
+
}
|
|
793
|
+
const oneObject = one;
|
|
794
|
+
const otherObject = other;
|
|
795
|
+
const oneKeys = ( Object.keys(oneObject)).filter(key => oneObject[key] !== undefined);
|
|
796
|
+
const otherKeys = ( Object.keys(otherObject)).filter(key => otherObject[key] !== undefined);
|
|
797
|
+
return oneKeys.length === otherKeys.length && oneKeys.every(
|
|
798
|
+
key => Object.hasOwn(otherObject, key) && equalsActiveClientState(oneObject[key], otherObject[key])
|
|
799
|
+
);
|
|
800
|
+
}
|
|
721
801
|
class ActiveClientEntry extends Disposable {
|
|
722
|
-
constructor(
|
|
802
|
+
constructor(
|
|
803
|
+
_scope,
|
|
804
|
+
sessionTools,
|
|
805
|
+
appTools,
|
|
806
|
+
connection,
|
|
807
|
+
debounceDelay,
|
|
808
|
+
_getSessionState,
|
|
809
|
+
_dispatch
|
|
810
|
+
) {
|
|
723
811
|
super();
|
|
724
812
|
this._scope = _scope;
|
|
725
813
|
this._getSessionState = _getSessionState;
|
|
@@ -729,9 +817,19 @@ class ActiveClientEntry extends Disposable {
|
|
|
729
817
|
this._reconcileSignal = observableValue(this, 0);
|
|
730
818
|
this._stateSubscription = this._register(( new MutableDisposable()));
|
|
731
819
|
this._claimRequested = false;
|
|
732
|
-
|
|
820
|
+
const scopedActiveClient = _scope.activeClient(connection.clientId, connection.resourceUris);
|
|
821
|
+
this._baseToolNames = derived(this, reader => ( new Set([
|
|
822
|
+
...scopedActiveClient.read(reader).tools,
|
|
823
|
+
...sessionTools.object.read(reader)
|
|
824
|
+
].map(tool => tool.name))));
|
|
825
|
+
this._activeClient = derived(this, reader => composeSessionActiveClient(
|
|
826
|
+
scopedActiveClient.read(reader),
|
|
827
|
+
sessionTools.object.read(reader),
|
|
828
|
+
appTools.read(reader)
|
|
829
|
+
));
|
|
733
830
|
this._publishDelayer = this._register(( new Delayer(debounceDelay)));
|
|
734
831
|
this._register(_scope);
|
|
832
|
+
this._register(sessionTools);
|
|
735
833
|
this._register(toDisposable(() => this._cancellation.dispose(true)));
|
|
736
834
|
this._register(autorun(reader => {
|
|
737
835
|
if (!this._scope.isResolved.read(reader)) {
|
|
@@ -745,6 +843,9 @@ class ActiveClientEntry extends Disposable {
|
|
|
745
843
|
getActiveClient() {
|
|
746
844
|
return this._activeClient.get();
|
|
747
845
|
}
|
|
846
|
+
hasBaseOrSessionTool(name) {
|
|
847
|
+
return ( this._baseToolNames.get().has(name));
|
|
848
|
+
}
|
|
748
849
|
async whenSettled() {
|
|
749
850
|
await waitForState(this._state, state => !state, undefined, this._cancellation.token);
|
|
750
851
|
}
|
|
@@ -795,11 +896,11 @@ class ActiveClientEntry extends Disposable {
|
|
|
795
896
|
if (!existing && !this._claimRequested) {
|
|
796
897
|
return;
|
|
797
898
|
}
|
|
798
|
-
if (
|
|
899
|
+
if (equalsActiveClientState(existing, activeClient)) {
|
|
799
900
|
this._lastPublished = undefined;
|
|
800
901
|
return;
|
|
801
902
|
}
|
|
802
|
-
if (
|
|
903
|
+
if (equalsActiveClientState(this._lastPublished, activeClient)) {
|
|
803
904
|
return;
|
|
804
905
|
}
|
|
805
906
|
this._dispatch(backendSession, {
|
|
@@ -815,6 +916,28 @@ class ActiveClientEntry extends Disposable {
|
|
|
815
916
|
}, delay).catch(() => {});
|
|
816
917
|
}
|
|
817
918
|
}
|
|
919
|
+
function isSettledSubagentChat(status) {
|
|
920
|
+
return (status & (SessionStatus.Idle | SessionStatus.Error)) !== 0 && (status & SessionStatus.InProgress) === 0;
|
|
921
|
+
}
|
|
922
|
+
function getSubagentChatDescendants(chats, chatResource) {
|
|
923
|
+
const descendants = ( new Set());
|
|
924
|
+
if (chatResource !== undefined) {
|
|
925
|
+
descendants.add(chatResource);
|
|
926
|
+
for (const resource of descendants) {
|
|
927
|
+
for (const chat of chats) {
|
|
928
|
+
if (chat.parentChat === resource) {
|
|
929
|
+
descendants.add(chat.resource);
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
return descendants;
|
|
935
|
+
}
|
|
936
|
+
function markSettledSubagentOpenable(data) {
|
|
937
|
+
data.isChatAvailable = true;
|
|
938
|
+
data.isActive = false;
|
|
939
|
+
delete data.hasStarted;
|
|
940
|
+
}
|
|
818
941
|
let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
819
942
|
static {
|
|
820
943
|
AgentHostSessionHandler_1 = this;
|
|
@@ -847,6 +970,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
847
970
|
_openerService,
|
|
848
971
|
_editorService,
|
|
849
972
|
_activeClientService,
|
|
973
|
+
_mcpAppToolsService,
|
|
850
974
|
_chatEntitlementService,
|
|
851
975
|
_workspaceTrustRequestService,
|
|
852
976
|
_workspaceTrustManagementService,
|
|
@@ -854,12 +978,18 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
854
978
|
_workingCopyService,
|
|
855
979
|
_configurationService,
|
|
856
980
|
_chatResponseFileChangesService,
|
|
857
|
-
|
|
981
|
+
_copilotHomeService,
|
|
858
982
|
_remoteAgentHostService,
|
|
859
983
|
_customizationService,
|
|
860
984
|
_telemetryService,
|
|
861
985
|
assignmentService,
|
|
862
|
-
_connectionsService
|
|
986
|
+
_connectionsService,
|
|
987
|
+
_notificationService,
|
|
988
|
+
_accessibilitySignalService,
|
|
989
|
+
_accessibilityService,
|
|
990
|
+
textFileService,
|
|
991
|
+
_computerUseSetupService,
|
|
992
|
+
reviewPreferences
|
|
863
993
|
) {
|
|
864
994
|
super();
|
|
865
995
|
this._chatAgentService = _chatAgentService;
|
|
@@ -882,6 +1012,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
882
1012
|
this._openerService = _openerService;
|
|
883
1013
|
this._editorService = _editorService;
|
|
884
1014
|
this._activeClientService = _activeClientService;
|
|
1015
|
+
this._mcpAppToolsService = _mcpAppToolsService;
|
|
885
1016
|
this._chatEntitlementService = _chatEntitlementService;
|
|
886
1017
|
this._workspaceTrustRequestService = _workspaceTrustRequestService;
|
|
887
1018
|
this._workspaceTrustManagementService = _workspaceTrustManagementService;
|
|
@@ -889,18 +1020,25 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
889
1020
|
this._workingCopyService = _workingCopyService;
|
|
890
1021
|
this._configurationService = _configurationService;
|
|
891
1022
|
this._chatResponseFileChangesService = _chatResponseFileChangesService;
|
|
892
|
-
this.
|
|
1023
|
+
this._copilotHomeService = _copilotHomeService;
|
|
893
1024
|
this._remoteAgentHostService = _remoteAgentHostService;
|
|
894
1025
|
this._customizationService = _customizationService;
|
|
895
1026
|
this._telemetryService = _telemetryService;
|
|
896
1027
|
this._connectionsService = _connectionsService;
|
|
1028
|
+
this._notificationService = _notificationService;
|
|
1029
|
+
this._accessibilitySignalService = _accessibilitySignalService;
|
|
1030
|
+
this._accessibilityService = _accessibilityService;
|
|
1031
|
+
this._computerUseSetupService = _computerUseSetupService;
|
|
897
1032
|
this._activeSessions = ( new ResourceMap());
|
|
898
1033
|
this._chatURIsBySessionResource = ( new ResourceMap());
|
|
899
1034
|
this._pendingMessageSubscriptions = this._register(( new DisposableResourceMap()));
|
|
900
1035
|
this._remotePendingMessageProjections = ( new ResourceSet());
|
|
1036
|
+
this._steeringMessageHandoffs = ( new Map());
|
|
1037
|
+
this._localSteeringSubmissions = ( new ResourceMap());
|
|
901
1038
|
this._draftSyncSubscriptions = this._register(( new DisposableResourceMap()));
|
|
902
1039
|
this._serverTurnWatchers = this._register(( new DisposableResourceMap()));
|
|
903
1040
|
this._mcpAuthWatchers = this._register(( new DisposableResourceMap()));
|
|
1041
|
+
this._retainedOutputTerminals = this._register(( new DisposableResourceMap()));
|
|
904
1042
|
this._inputNeededWatchers = ( new Map());
|
|
905
1043
|
this._inputNeededWatcherBackends = ( new ResourceMap());
|
|
906
1044
|
this._activeClientEntries = ( new ResourceMap());
|
|
@@ -910,6 +1048,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
910
1048
|
this._clientToolInvocations = ( new Map());
|
|
911
1049
|
this._clientToolRetainCounts = ( new Map());
|
|
912
1050
|
this._surfacedMcpAuthServers = ( new ResourceMap());
|
|
1051
|
+
this._mcpAuthNotifications = this._register(( new DisposableResourceMap()));
|
|
913
1052
|
this._pendingMcpAutoAuthentication = ( new Map());
|
|
914
1053
|
this._clientDispatchedTurnIds = ( new Set());
|
|
915
1054
|
this._turnObservations = this._register(( new DisposableSet()));
|
|
@@ -920,17 +1059,40 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
920
1059
|
this._shellInitRegistrations = this._register(( new DisposableMap()));
|
|
921
1060
|
this._defaultChatSubscriptions = ( new Map());
|
|
922
1061
|
this._additionalChatSubscriptions = ( new Map());
|
|
1062
|
+
this._subagentChatSubscriptionHolds = ( new Map());
|
|
1063
|
+
this._subagentObservationsByChat = ( new Map());
|
|
1064
|
+
this._subagentPresentation = ( new LRUCache(1000));
|
|
923
1065
|
this._terminalChatURIs = ( new Map());
|
|
924
1066
|
this._hydratingChatSessions = ( new Map());
|
|
925
1067
|
this._hideAutoExplainability = observableValue("hideAutoExplainability", undefined);
|
|
926
1068
|
this._config = config;
|
|
1069
|
+
const workingSetEnabled = observableConfigValue(
|
|
1070
|
+
ChatConfiguration.EditorWorkingSetEnabled,
|
|
1071
|
+
false,
|
|
1072
|
+
this._configurationService
|
|
1073
|
+
);
|
|
1074
|
+
const reviewEnabled = derived(
|
|
1075
|
+
reader => workingSetEnabled.read(reader) && reviewPreferences.keepUndoEnabled.read(reader)
|
|
1076
|
+
);
|
|
1077
|
+
this._register(autorun(reader => {
|
|
1078
|
+
if (reviewEnabled.read(reader)) {
|
|
1079
|
+
reader.store.add(textFileService.files.retainResolvedContent());
|
|
1080
|
+
}
|
|
1081
|
+
}));
|
|
927
1082
|
if (config.supportsCanvasPresentation && config.provider === COPILOT_CLI_AGENT_PROVIDER_ID) {
|
|
928
|
-
|
|
1083
|
+
const provider = this._register(this._instantiationService.createInstance(
|
|
929
1084
|
AgentHostCanvasCollection,
|
|
930
1085
|
`${config.connectionAuthority}/${config.provider}`,
|
|
931
1086
|
config.connection
|
|
932
1087
|
));
|
|
1088
|
+
this._canvases = {
|
|
1089
|
+
provider,
|
|
1090
|
+
available: config.supportsCanvasPresentation
|
|
1091
|
+
};
|
|
933
1092
|
}
|
|
1093
|
+
this._localModels = this._register(
|
|
1094
|
+
this._instantiationService.createInstance(AgentHostLocalModelSupport, config.connection, config.sessionType)
|
|
1095
|
+
);
|
|
934
1096
|
const readHideAutoExplainability = () => assignmentService.getTreatment(HIDE_AUTO_EXPLAINABILITY_TREATMENT).then(hidden => this._hideAutoExplainability.set(hidden === true, undefined)).catch(err => {
|
|
935
1097
|
this._logService.warn(`[AgentHost] Failed to resolve ${HIDE_AUTO_EXPLAINABILITY_TREATMENT}`, err);
|
|
936
1098
|
this._hideAutoExplainability.set(false, undefined);
|
|
@@ -986,12 +1148,24 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
986
1148
|
);
|
|
987
1149
|
this._register(
|
|
988
1150
|
this._chatEditingService.registerEditingSessionProvider(config.sessionType, {
|
|
989
|
-
createEditingSession: chatSessionResource => {
|
|
990
|
-
|
|
1151
|
+
createEditingSession: (chatSessionResource, isGlobalEditingSession) => {
|
|
1152
|
+
const controller = this._instantiationService.createInstance(
|
|
991
1153
|
AgentHostSnapshotController,
|
|
992
1154
|
chatSessionResource,
|
|
993
|
-
config.connectionAuthority
|
|
1155
|
+
config.connectionAuthority,
|
|
1156
|
+
config.provider === CODEX_AGENT_PROVIDER_ID ? {
|
|
1157
|
+
getChanges: requestId => this._chatResponseFileChangesService.getChangesForRequest(chatSessionResource, requestId),
|
|
1158
|
+
resolve: requestId => this._resolveTurnFileEdits(chatSessionResource, requestId)
|
|
1159
|
+
} : undefined
|
|
994
1160
|
);
|
|
1161
|
+
if (isGlobalEditingSession && this._shouldReviewEdits(chatSessionResource)) {
|
|
1162
|
+
const instantiationService = this._instantiationService;
|
|
1163
|
+
controller.attachReview(
|
|
1164
|
+
reviewEnabled,
|
|
1165
|
+
() => instantiationService.createInstance(AgentHostEditReview, chatSessionResource)
|
|
1166
|
+
);
|
|
1167
|
+
}
|
|
1168
|
+
return controller;
|
|
995
1169
|
}
|
|
996
1170
|
})
|
|
997
1171
|
);
|
|
@@ -1000,9 +1174,10 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1000
1174
|
config.connection,
|
|
1001
1175
|
config.connectionAuthority,
|
|
1002
1176
|
sessionResource => this._resolveSessionUri(sessionResource),
|
|
1003
|
-
sessionResource => {
|
|
1177
|
+
(sessionResource, sessionState) => {
|
|
1004
1178
|
const backendSession = this._resolveSessionUri(sessionResource);
|
|
1005
|
-
|
|
1179
|
+
const chat = backendSession ? this._getChatURIOrDefault(sessionResource, backendSession, sessionState) : undefined;
|
|
1180
|
+
return chat !== undefined ? ( URI.parse(chat)) : undefined;
|
|
1006
1181
|
},
|
|
1007
1182
|
this._logService
|
|
1008
1183
|
))))
|
|
@@ -1116,7 +1291,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1116
1291
|
}
|
|
1117
1292
|
case MessageAttachmentKind.Resource:
|
|
1118
1293
|
{
|
|
1119
|
-
const uri = typeof attachment.uri === "string" ? ( URI.parse(attachment.uri)) : ( URI.from(attachment.uri));
|
|
1294
|
+
const uri = this._config.connection.resourceUris.fromAgentHost(typeof attachment.uri === "string" ? ( URI.parse(attachment.uri)) : ( URI.from(attachment.uri)));
|
|
1120
1295
|
return this._createCompletionItem(raw, text, {
|
|
1121
1296
|
kind: "resource",
|
|
1122
1297
|
uri,
|
|
@@ -1176,6 +1351,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1176
1351
|
}
|
|
1177
1352
|
this._logService.trace(`[AgentHost] provideChatSessionContent start: ${( resolvedSession.toString())} (isNewSession=${isNewSession})`);
|
|
1178
1353
|
const history = [];
|
|
1354
|
+
let historyLoadError;
|
|
1179
1355
|
let initialProgress;
|
|
1180
1356
|
let initialResponsePartCount = 0;
|
|
1181
1357
|
let activeTurnId;
|
|
@@ -1218,7 +1394,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1218
1394
|
);
|
|
1219
1395
|
const sessionState = this._getSessionState(( resolvedSession.toString()), chatURI);
|
|
1220
1396
|
if (sessionState) {
|
|
1221
|
-
chatTitle =
|
|
1397
|
+
chatTitle = this._getHostChatTitle(sessionResource, sessionState, chatURI);
|
|
1222
1398
|
const draft = sessionState.draft ?? emptyDraftFromLastTurn(sessionState);
|
|
1223
1399
|
draftInputState = this._draftToInputState(sessionResource, draft);
|
|
1224
1400
|
if (!sessionState.draft && draft) {
|
|
@@ -1241,7 +1417,8 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1241
1417
|
this._config.connection.initializeResult.get()?.terminalCommandPrefix,
|
|
1242
1418
|
this._config.connection.resourceUris,
|
|
1243
1419
|
turn => this._getTurnErrorDetails(turn, allowTurnResume),
|
|
1244
|
-
readAgentContextUsage(sessionState, sessionState.turns.at(-1)?.usage)
|
|
1420
|
+
readAgentContextUsage(sessionState, sessionState.turns.at(-1)?.usage),
|
|
1421
|
+
this._managedPluginRetryTarget(resolvedSession, chatURI)
|
|
1245
1422
|
));
|
|
1246
1423
|
this._logService.trace(
|
|
1247
1424
|
`[AgentHost] provideChatSessionContent: converted ${sessionState.turns.length} turn(s) into ${history.length} history item(s) for ${( resolvedSession.toString())}`
|
|
@@ -1272,7 +1449,11 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1272
1449
|
modelConfiguration: sessionState.activeTurn.message.model.config
|
|
1273
1450
|
} : {}),
|
|
1274
1451
|
timestamp: parseTimestamp(sessionState.activeTurn.startedAt),
|
|
1275
|
-
variableData: messageToVariableData(
|
|
1452
|
+
variableData: messageToVariableData(
|
|
1453
|
+
sessionState.activeTurn.message,
|
|
1454
|
+
this._config.connectionAuthority,
|
|
1455
|
+
this._config.connection.resourceUris
|
|
1456
|
+
),
|
|
1276
1457
|
...(isMessageHiddenFromTranscript(sessionState.activeTurn.message) ? {
|
|
1277
1458
|
isHidden: true
|
|
1278
1459
|
} : {}),
|
|
@@ -1281,6 +1462,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1281
1462
|
} : {}),
|
|
1282
1463
|
isSystemInitiated: sessionState.activeTurn.message.origin.kind === MessageKind.SystemNotification,
|
|
1283
1464
|
requestSource: messageToRequestSource(sessionState.activeTurn.message),
|
|
1465
|
+
artifactRequest: readArtifactIntegrationRequest(sessionState.activeTurn.message),
|
|
1284
1466
|
origin: messageToRequestOrigin(
|
|
1285
1467
|
resolvedSession,
|
|
1286
1468
|
sessionState.activeTurn.message,
|
|
@@ -1304,7 +1486,8 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1304
1486
|
this._config.connection.resourceUris,
|
|
1305
1487
|
( new Set(sessionState.chats.flatMap(
|
|
1306
1488
|
chat => chat.origin?.kind === ChatOriginKind.Tool && chat.origin.chat === chatURI ? [chat.origin.toolCallId] : []
|
|
1307
|
-
)))
|
|
1489
|
+
))),
|
|
1490
|
+
this._managedPluginRetryTarget(resolvedSession, chatURI)
|
|
1308
1491
|
);
|
|
1309
1492
|
initialResponsePartCount = sessionState.activeTurn.responseParts.length;
|
|
1310
1493
|
const actualModelId = lookup.toActualModelId(sessionState.activeTurn.usage?.model);
|
|
@@ -1322,20 +1505,24 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1322
1505
|
}
|
|
1323
1506
|
} catch (err) {
|
|
1324
1507
|
this._logService.warn(`[AgentHost] Failed to subscribe to existing session: ${( resolvedSession.toString())}`, err);
|
|
1508
|
+
historyLoadError = {
|
|
1509
|
+
message: unwrapSessionLoadErrorMessage(err) ?? ( localize(11485, "This session couldn't be loaded.")),
|
|
1510
|
+
canInitializeSession: !chatURI && !sessionResource.fragment && !( ( new URLSearchParams(sessionResource.query)).has(CHAT_SUBAGENT_RESOURCE_QUERY_PARAM)) && isNotFoundError(err)
|
|
1511
|
+
};
|
|
1325
1512
|
if (history.length === 0 && (sessionResource.fragment || ( ( new URLSearchParams(sessionResource.query)).has(CHAT_SUBAGENT_RESOURCE_QUERY_PARAM)) || !isNotFoundError(err))) {
|
|
1326
1513
|
history.push({
|
|
1327
1514
|
type: "request",
|
|
1328
1515
|
prompt: "",
|
|
1329
1516
|
participant: this._config.agentId,
|
|
1330
1517
|
isSystemInitiated: true,
|
|
1331
|
-
systemInitiatedLabel: ( localize(
|
|
1518
|
+
systemInitiatedLabel: ( localize(11486, "Couldn't open session"))
|
|
1332
1519
|
});
|
|
1333
1520
|
history.push({
|
|
1334
1521
|
type: "response",
|
|
1335
1522
|
parts: [],
|
|
1336
1523
|
participant: this._config.agentId,
|
|
1337
1524
|
errorDetails: {
|
|
1338
|
-
message:
|
|
1525
|
+
message: historyLoadError.message
|
|
1339
1526
|
}
|
|
1340
1527
|
});
|
|
1341
1528
|
}
|
|
@@ -1355,21 +1542,31 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1355
1542
|
AgentHostChatSession,
|
|
1356
1543
|
sessionResource,
|
|
1357
1544
|
history,
|
|
1545
|
+
historyLoadError,
|
|
1358
1546
|
chatTitle,
|
|
1359
1547
|
resolvedSession,
|
|
1548
|
+
rawModelId => this._toLanguageModelId(sessionResource, rawModelId),
|
|
1360
1549
|
sessionSubscription,
|
|
1361
1550
|
chatSubscription,
|
|
1362
|
-
this.
|
|
1551
|
+
this._canvases,
|
|
1363
1552
|
this._config.promptCacheNotification,
|
|
1364
|
-
this._config.connection.refreshSubscription ? () =>
|
|
1365
|
-
|
|
1553
|
+
this._config.connection.refreshSubscription ? () => {
|
|
1554
|
+
const chat = this._getChatURIOrDefault(sessionResource, resolvedSession);
|
|
1555
|
+
return chat !== undefined ? this._config.connection.refreshSubscription(( URI.parse(chat))) : Promise.resolve();
|
|
1556
|
+
} : undefined,
|
|
1557
|
+
(request, token, options) => {
|
|
1366
1558
|
if (!this._getSessionState(( resolvedSession.toString()))) {
|
|
1367
1559
|
throw ( new Error("Cannot fork session before the initial request"));
|
|
1368
1560
|
}
|
|
1369
|
-
return this._forkSession(sessionResource, resolvedSession, request, token);
|
|
1561
|
+
return this._forkSession(sessionResource, resolvedSession, request, token, options);
|
|
1370
1562
|
},
|
|
1371
1563
|
(title, _token) => {
|
|
1372
|
-
this.
|
|
1564
|
+
const chat = this._getChatURIOrDefault(sessionResource, resolvedSession);
|
|
1565
|
+
if (chat === undefined) {
|
|
1566
|
+
return Promise.reject(( new Error(`No chat to rename for ${( sessionResource.toString())}`)));
|
|
1567
|
+
}
|
|
1568
|
+
const channel = this._config.useSessionTitleForDefaultChat && chat === this._getRawSessionState(( resolvedSession.toString()))?.defaultChat ? ( resolvedSession.toString()) : chat;
|
|
1569
|
+
this._config.connection.dispatch(channel, {
|
|
1373
1570
|
type: ActionType.SessionTitleChanged,
|
|
1374
1571
|
title
|
|
1375
1572
|
});
|
|
@@ -1388,14 +1585,14 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1388
1585
|
this._draftSyncSubscriptions.deleteAndDispose(sessionResource);
|
|
1389
1586
|
this._serverTurnWatchers.deleteAndDispose(sessionResource);
|
|
1390
1587
|
this._mcpAuthWatchers.deleteAndDispose(sessionResource);
|
|
1588
|
+
this._mcpAuthNotifications.deleteAndDispose(sessionResource);
|
|
1589
|
+
this._retainedOutputTerminals.deleteAndDispose(sessionResource);
|
|
1391
1590
|
this._releaseSessionInputNeeded(sessionResource);
|
|
1392
1591
|
this._pendingHistoryTurns.delete(sessionResource);
|
|
1393
1592
|
this._surfacedMcpAuthServers.delete(sessionResource);
|
|
1394
1593
|
const chatURI = this._chatURIsBySessionResource.get(sessionResource);
|
|
1395
1594
|
this._chatURIsBySessionResource.delete(sessionResource);
|
|
1396
|
-
|
|
1397
|
-
this._releaseChatSessionSubscriptions(( resolvedSession.toString()), chatURI);
|
|
1398
|
-
}
|
|
1595
|
+
this._releaseChatSessionSubscriptions(( resolvedSession.toString()), chatURI);
|
|
1399
1596
|
},
|
|
1400
1597
|
() => {
|
|
1401
1598
|
const sessionKey = ( resolvedSession.toString());
|
|
@@ -1403,6 +1600,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1403
1600
|
if (!chatURI) {
|
|
1404
1601
|
return true;
|
|
1405
1602
|
}
|
|
1603
|
+
this._steeringMessageHandoffs.get(chatURI)?.clear();
|
|
1406
1604
|
const turnId = this._getSessionState(sessionKey, chatURI)?.activeTurn?.id;
|
|
1407
1605
|
if (!turnId) {
|
|
1408
1606
|
return true;
|
|
@@ -1410,12 +1608,21 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1410
1608
|
this._logService.info(
|
|
1411
1609
|
`[AgentHost] Cancellation requested for ${sessionKey}, dispatching turnCancelled`
|
|
1412
1610
|
);
|
|
1413
|
-
this.
|
|
1611
|
+
this._dispatchAction(resolvedSession, {
|
|
1414
1612
|
type: ActionType.ChatTurnCancelled,
|
|
1415
1613
|
turnId,
|
|
1416
1614
|
duration: this._turnDuration(chatURI, turnId)
|
|
1417
|
-
});
|
|
1615
|
+
}, chatURI);
|
|
1418
1616
|
return true;
|
|
1617
|
+
},
|
|
1618
|
+
() => {
|
|
1619
|
+
const agent = this._getRootState()?.agents.find(agent => agent.provider === this._config.provider);
|
|
1620
|
+
return agent?.capabilities?.multipleChats?.fork === true;
|
|
1621
|
+
},
|
|
1622
|
+
(turnId, token, selection) => this._createSideChat(sessionResource, resolvedSession, turnId, token, selection),
|
|
1623
|
+
() => {
|
|
1624
|
+
const agent = this._getRootState()?.agents.find(agent => agent.provider === this._config.provider);
|
|
1625
|
+
return agent?.capabilities?.multipleChats?.sideChat === true;
|
|
1419
1626
|
}
|
|
1420
1627
|
);
|
|
1421
1628
|
} catch (err) {
|
|
@@ -1487,7 +1694,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1487
1694
|
},
|
|
1488
1695
|
slashCommands: [],
|
|
1489
1696
|
locations: [ChatAgentLocation.Chat],
|
|
1490
|
-
modes: [ChatModeKind.Agent],
|
|
1697
|
+
modes: [ChatModeKind.Agent, ChatModeKind.Ask],
|
|
1491
1698
|
disambiguation: []
|
|
1492
1699
|
};
|
|
1493
1700
|
const agentImpl = {
|
|
@@ -1512,7 +1719,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1512
1719
|
try {
|
|
1513
1720
|
this._logService.info(`[AgentHost] _invokeAgent called for resource: ${( request.sessionResource.toString())}`);
|
|
1514
1721
|
const invocationChat = this._getChatURIOrDefault(request.sessionResource, this._resolveSessionUri(request.sessionResource));
|
|
1515
|
-
if (!
|
|
1722
|
+
if (!this._isSubagentChat(( this._resolveSessionUri(request.sessionResource).toString()), invocationChat)) {
|
|
1516
1723
|
rendererRootInvocationOrdinal = nextRendererRootInvocationOrdinal();
|
|
1517
1724
|
}
|
|
1518
1725
|
if (this._config.requiresWorkspaceTrust !== false) {
|
|
@@ -1548,13 +1755,16 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1548
1755
|
return {};
|
|
1549
1756
|
}
|
|
1550
1757
|
const sensitiveEditLocationsConfig = this._getSensitiveEditLocationsConfig(request.sessionResource, existingState);
|
|
1758
|
+
if (!this._isSubagentChat(( this._resolveSessionUri(request.sessionResource).toString()), invocationChat) && !request.acceptedConfirmationData?.length && !request.rejectedConfirmationData?.length && !(await this._localModels.checkBeforeSend(request, this._extractRawModelId(request.userSelectedModelId)))) {
|
|
1759
|
+
return {};
|
|
1760
|
+
}
|
|
1551
1761
|
if (!existingState) {
|
|
1552
1762
|
const imported = this._importConversationStore.take(request.sessionResource);
|
|
1553
1763
|
if (imported) {
|
|
1554
1764
|
preparingStatus.value = disposableTimeout(() => {
|
|
1555
1765
|
progress([{
|
|
1556
1766
|
kind: "progressMessage",
|
|
1557
|
-
content: ( new MarkdownString(( localize(
|
|
1767
|
+
content: ( new MarkdownString(( localize(11487, "Preparing session…")))),
|
|
1558
1768
|
shimmer: true
|
|
1559
1769
|
}]);
|
|
1560
1770
|
}, 500);
|
|
@@ -1563,12 +1773,10 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1563
1773
|
const initialConfig = {
|
|
1564
1774
|
...this._provisionalService.getInitialSessionConfig(),
|
|
1565
1775
|
...sensitiveEditLocationsConfig,
|
|
1776
|
+
...this._config.resolveInitialSessionConfig?.(request.sessionResource),
|
|
1566
1777
|
...request.agentHostSessionConfig
|
|
1567
1778
|
};
|
|
1568
|
-
await this._createAndSubscribe(request.sessionResource, model, ( Object.keys(initialConfig)).length > 0 ? initialConfig : undefined, imported
|
|
1569
|
-
turns: imported.turns,
|
|
1570
|
-
model: imported.model
|
|
1571
|
-
} : undefined, stage => failureStage = stage, cancellationToken);
|
|
1779
|
+
await this._createAndSubscribe(request.sessionResource, model, ( Object.keys(initialConfig)).length > 0 ? initialConfig : undefined, imported, stage => failureStage = stage, cancellationToken);
|
|
1572
1780
|
} else {
|
|
1573
1781
|
failureStage = "authentication";
|
|
1574
1782
|
await this._ensureRequiredAuthentication(
|
|
@@ -1588,6 +1796,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1588
1796
|
this._watchForServerInitiatedTurns(resolvedSession, request.sessionResource);
|
|
1589
1797
|
const sessionConfig = {
|
|
1590
1798
|
...sensitiveEditLocationsConfig,
|
|
1799
|
+
...this._config.resolveInitialSessionConfig?.(request.sessionResource),
|
|
1591
1800
|
...request.agentHostSessionConfig
|
|
1592
1801
|
};
|
|
1593
1802
|
if (( Object.keys(sessionConfig)).length > 0) {
|
|
@@ -1599,9 +1808,9 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1599
1808
|
}
|
|
1600
1809
|
chatId = this._getChatURI(request.sessionResource);
|
|
1601
1810
|
const state = this._getSessionState(sessionKey, chatId);
|
|
1602
|
-
sessionTurnKind = state &&
|
|
1811
|
+
sessionTurnKind = state && chatId === state.defaultChat ? (state.turns.length > 0 ? "later" : "first") : "unknown";
|
|
1603
1812
|
const isExistingTurn = state?.activeTurn?.id === request.requestId || state?.turns.some(turn => turn.id === request.requestId) || request.acceptedConfirmationData?.some(isResumeTurnConfirmationData);
|
|
1604
|
-
invocationKind =
|
|
1813
|
+
invocationKind = this._isSubagentChat(sessionKey, chatId) ? "subagent" : isExistingTurn ? "existingTurn" : "newTurn";
|
|
1605
1814
|
const stopWatch = StopWatch.create(false);
|
|
1606
1815
|
let firstProgress;
|
|
1607
1816
|
const measuredProgress = parts => {
|
|
@@ -1627,9 +1836,11 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1627
1836
|
stage => failureStage = stage,
|
|
1628
1837
|
invocationKind === "newTurn" ? text => firstResponse.observeText(text) : undefined
|
|
1629
1838
|
);
|
|
1839
|
+
this._localModels.noteCompletedTurn(request.sessionResource, completedTurn?.usage);
|
|
1630
1840
|
outcome = completedTurn?.state === TurnState.Error ? "error" : completedTurn?.state === TurnState.Cancelled || cancellationToken.isCancellationRequested ? "cancelled" : completedTurn ? "success" : "notDispatched";
|
|
1631
1841
|
const details = this._getTurnResponseDetails(request.sessionResource, resolvedSession, completedTurn);
|
|
1632
1842
|
const errorDetails = this._getTurnErrorDetails(completedTurn);
|
|
1843
|
+
const metadata = turnToResultMetadata(completedTurn);
|
|
1633
1844
|
return {
|
|
1634
1845
|
timings: {
|
|
1635
1846
|
firstProgress,
|
|
@@ -1640,6 +1851,9 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1640
1851
|
} : {}),
|
|
1641
1852
|
...(errorDetails ? {
|
|
1642
1853
|
errorDetails
|
|
1854
|
+
} : {}),
|
|
1855
|
+
...(metadata ? {
|
|
1856
|
+
metadata
|
|
1643
1857
|
} : {})
|
|
1644
1858
|
};
|
|
1645
1859
|
} catch (error) {
|
|
@@ -1647,6 +1861,11 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1647
1861
|
if (!isCancellationError(error)) {
|
|
1648
1862
|
this._reportInvocationFailure(request, failureStage, error);
|
|
1649
1863
|
}
|
|
1864
|
+
if (getErrorCode(error) === "policyResolutionFailed" && !this._isInvocationAbandoned(cancellationToken)) {
|
|
1865
|
+
return {
|
|
1866
|
+
errorDetails: this._getPolicyErrorDetails(getErrorMessage(error))
|
|
1867
|
+
};
|
|
1868
|
+
}
|
|
1650
1869
|
throw error;
|
|
1651
1870
|
} finally {
|
|
1652
1871
|
preparingStatus.dispose();
|
|
@@ -1671,7 +1890,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1671
1890
|
void this._config.connection.reportFirstResponse?.({
|
|
1672
1891
|
...timing,
|
|
1673
1892
|
agentSessionId: sessionId ? AgentSession.id(sessionId) : undefined,
|
|
1674
|
-
chatId: chatId ?
|
|
1893
|
+
chatId: chatId && sessionId ? getTelemetryChatId(chatId) : undefined
|
|
1675
1894
|
}).catch(
|
|
1676
1895
|
() => this._logService.debug("[AgentHostFirstResponse] OTel diagnostic could not be delivered")
|
|
1677
1896
|
);
|
|
@@ -1692,16 +1911,32 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1692
1911
|
callstack: packed.callstack
|
|
1693
1912
|
});
|
|
1694
1913
|
}
|
|
1914
|
+
_getPolicyErrorDetails(message, allowRetry = true) {
|
|
1915
|
+
return {
|
|
1916
|
+
message,
|
|
1917
|
+
isExpectedError: true,
|
|
1918
|
+
...(allowRetry ? {
|
|
1919
|
+
confirmationButtons: [{
|
|
1920
|
+
label: ( localize(11488, "Retry")),
|
|
1921
|
+
data: undefined,
|
|
1922
|
+
resend: true
|
|
1923
|
+
}]
|
|
1924
|
+
} : {})
|
|
1925
|
+
};
|
|
1926
|
+
}
|
|
1695
1927
|
_getTurnErrorDetails(turn, allowResume = true) {
|
|
1696
1928
|
const errorPart = getErrorResponsePart(turn);
|
|
1697
1929
|
const error = getTurnError(turn);
|
|
1698
1930
|
if (!error) {
|
|
1699
1931
|
return undefined;
|
|
1700
1932
|
}
|
|
1933
|
+
if (error.errorType === "policyResolutionFailed") {
|
|
1934
|
+
return this._getPolicyErrorDetails(error.message, allowResume);
|
|
1935
|
+
}
|
|
1701
1936
|
if (error.errorType === "CodexThreadInUse") {
|
|
1702
1937
|
return {
|
|
1703
1938
|
message: ( localize(
|
|
1704
|
-
|
|
1939
|
+
11489,
|
|
1705
1940
|
"{0} Then send your message again in VS Code. Your message has not been sent.",
|
|
1706
1941
|
codexWriterLockMessage()
|
|
1707
1942
|
)),
|
|
@@ -1716,7 +1951,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1716
1951
|
isExpectedError: true,
|
|
1717
1952
|
level: ChatErrorLevel.Warning
|
|
1718
1953
|
} : forwardedDetails ?? {
|
|
1719
|
-
message: ( localize(
|
|
1954
|
+
message: ( localize(11490, "Error: ({0}) {1}", error.errorType, error.message))
|
|
1720
1955
|
};
|
|
1721
1956
|
if (!allowResume || errorPart?.resumable !== true || details.responseIsFiltered) {
|
|
1722
1957
|
return details;
|
|
@@ -1727,7 +1962,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1727
1962
|
data: {
|
|
1728
1963
|
agentHostResumeTurn: true
|
|
1729
1964
|
},
|
|
1730
|
-
label: isExecutionInterrupted ? ( localize(
|
|
1965
|
+
label: isExecutionInterrupted ? ( localize(11491, "Keep Going")) : ( localize(11492, "Try Again")),
|
|
1731
1966
|
resend: true,
|
|
1732
1967
|
preserveRequestId: true
|
|
1733
1968
|
}]
|
|
@@ -1762,6 +1997,9 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1762
1997
|
pinRef.dispose();
|
|
1763
1998
|
}
|
|
1764
1999
|
}
|
|
2000
|
+
_toHostAgentUri(modeInstructions) {
|
|
2001
|
+
return modeInstructions?.uri ? ( this._config.connection.resourceUris.toAgentHost(fromAgentHostUri(modeInstructions.uri)).toString()) : undefined;
|
|
2002
|
+
}
|
|
1765
2003
|
_syncPendingMessages(sessionResource, backendSession) {
|
|
1766
2004
|
if (( this._remotePendingMessageProjections.has(sessionResource))) {
|
|
1767
2005
|
return;
|
|
@@ -1774,14 +2012,17 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1774
2012
|
const chatURI = this._getChatURI(sessionResource);
|
|
1775
2013
|
const pending = chatModel.getPendingRequests();
|
|
1776
2014
|
const protocolState = this._getSessionState(session, chatURI);
|
|
1777
|
-
const
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
const
|
|
2015
|
+
const previous = [
|
|
2016
|
+
...(protocolState ? getPendingSteeringMessages(protocolState).map(message => ({
|
|
2017
|
+
...message,
|
|
2018
|
+
kind: PendingMessageKind.Steering
|
|
2019
|
+
})) : []),
|
|
2020
|
+
...(protocolState?.queuedMessages?.filter(message => message.kind !== PendingMessageKind.Steering) ?? [])
|
|
2021
|
+
];
|
|
2022
|
+
const previousMessages = ( new Map(previous.map(p => [p.id, p.message])));
|
|
2023
|
+
const localSteering = this._localSteeringSubmissions.get(sessionResource) ?? ( new Map());
|
|
2024
|
+
this._localSteeringSubmissions.set(sessionResource, localSteering);
|
|
2025
|
+
const current = [];
|
|
1785
2026
|
for (const p of pending) {
|
|
1786
2027
|
const variables = p.request.variableData?.variables ?? [];
|
|
1787
2028
|
const messageAttachments = this._variableEntriesToAttachments(variables, sessionResource, p.request.message.text);
|
|
@@ -1794,8 +2035,11 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1794
2035
|
const isSystemInitiated = p.request.isSystemInitiated ?? p.sendOptions.isSystemInitiated;
|
|
1795
2036
|
const metadata = p.sendOptions.metadata ?? previousMessage?._meta;
|
|
1796
2037
|
const roundTripMetadata = previousMessage && previousMessage.text !== p.request.message.text ? withoutAgentMessageDelegationMeta(metadata) : metadata;
|
|
2038
|
+
const modeInfo = p.request.modeInfo ?? p.sendOptions.modeInfo;
|
|
2039
|
+
const agentUri = modeInfo ? this._toHostAgentUri(modeInfo.modeInstructions) : previousMessage?.agent?.uri;
|
|
1797
2040
|
const snapshot = {
|
|
1798
2041
|
id: p.request.id,
|
|
2042
|
+
kind: p.kind === ChatRequestQueueKind.Steering ? PendingMessageKind.Steering : PendingMessageKind.Queued,
|
|
1799
2043
|
message: {
|
|
1800
2044
|
...requestMessage(
|
|
1801
2045
|
p.request.message.text,
|
|
@@ -1806,67 +2050,71 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1806
2050
|
),
|
|
1807
2051
|
...(model ? {
|
|
1808
2052
|
model
|
|
2053
|
+
} : {}),
|
|
2054
|
+
...(agentUri ? {
|
|
2055
|
+
agent: {
|
|
2056
|
+
uri: agentUri
|
|
2057
|
+
}
|
|
1809
2058
|
} : {})
|
|
1810
2059
|
}
|
|
1811
2060
|
};
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
2061
|
+
current.push(snapshot);
|
|
2062
|
+
if (snapshot.kind === PendingMessageKind.Steering) {
|
|
2063
|
+
if (!( previousMessages.has(snapshot.id)) && !( localSteering.has(snapshot.id))) {
|
|
2064
|
+
localSteering.set(snapshot.id, false);
|
|
2065
|
+
}
|
|
1816
2066
|
}
|
|
1817
2067
|
}
|
|
1818
|
-
|
|
1819
|
-
if (
|
|
1820
|
-
|
|
1821
|
-
type: ActionType.ChatPendingMessageSet,
|
|
1822
|
-
kind: PendingMessageKind.Steering,
|
|
1823
|
-
id: currentSteering.id,
|
|
1824
|
-
message: currentSteering.message
|
|
1825
|
-
}, chatURI);
|
|
2068
|
+
for (const id of ( localSteering.keys())) {
|
|
2069
|
+
if (!( current.some(message => message.id === id))) {
|
|
2070
|
+
localSteering.delete(id);
|
|
1826
2071
|
}
|
|
1827
|
-
} else if (prevSteering) {
|
|
1828
|
-
this._dispatchAction(backendSession, {
|
|
1829
|
-
type: ActionType.ChatPendingMessageRemoved,
|
|
1830
|
-
kind: PendingMessageKind.Steering,
|
|
1831
|
-
id: prevSteering.id
|
|
1832
|
-
}, chatURI);
|
|
1833
2072
|
}
|
|
1834
|
-
const
|
|
1835
|
-
for (const prev of
|
|
1836
|
-
if (!(
|
|
2073
|
+
const currentIds = ( new Set(current.map(message => message.id)));
|
|
2074
|
+
for (const prev of previous) {
|
|
2075
|
+
if (!( currentIds.has(prev.id))) {
|
|
1837
2076
|
this._dispatchAction(backendSession, {
|
|
1838
2077
|
type: ActionType.ChatPendingMessageRemoved,
|
|
1839
|
-
kind: PendingMessageKind.Queued,
|
|
2078
|
+
kind: prev.kind ?? PendingMessageKind.Queued,
|
|
1840
2079
|
id: prev.id
|
|
1841
2080
|
}, chatURI);
|
|
1842
2081
|
}
|
|
1843
2082
|
}
|
|
1844
|
-
const
|
|
1845
|
-
for (const
|
|
1846
|
-
const prev =
|
|
1847
|
-
if (!prev
|
|
2083
|
+
const previousById = ( new Map(previous.map(message => [message.id, message])));
|
|
2084
|
+
for (const message of current) {
|
|
2085
|
+
const prev = previousById.get(message.id);
|
|
2086
|
+
if (!prev && localSteering.get(message.id) === true) {
|
|
2087
|
+
continue;
|
|
2088
|
+
}
|
|
2089
|
+
if (!prev || message.kind !== (prev.kind ?? PendingMessageKind.Queued) || !equals(message.message, prev.message)) {
|
|
2090
|
+
if (!prev && message.kind === PendingMessageKind.Steering) {
|
|
2091
|
+
localSteering.set(message.id, true);
|
|
2092
|
+
}
|
|
1848
2093
|
this._dispatchAction(backendSession, {
|
|
1849
2094
|
type: ActionType.ChatPendingMessageSet,
|
|
1850
|
-
|
|
1851
|
-
id: q.id,
|
|
1852
|
-
message: q.message
|
|
2095
|
+
...message
|
|
1853
2096
|
}, chatURI);
|
|
1854
2097
|
}
|
|
1855
2098
|
}
|
|
1856
2099
|
const updatedProtocol = this._getSessionState(session, chatURI);
|
|
1857
2100
|
const updatedQueued = updatedProtocol?.queuedMessages ?? [];
|
|
1858
|
-
if (updatedQueued.length > 1 &&
|
|
1859
|
-
const
|
|
2101
|
+
if (updatedQueued.length > 1 && current.length === updatedQueued.length) {
|
|
2102
|
+
const displayed = [
|
|
2103
|
+
...updatedQueued.filter(message => message.kind === PendingMessageKind.Steering),
|
|
2104
|
+
...updatedQueued.filter(message => message.kind !== PendingMessageKind.Steering)
|
|
2105
|
+
];
|
|
2106
|
+
const needsReorder = ( current.some((message, i) => message.id !== displayed[i].id));
|
|
1860
2107
|
if (needsReorder) {
|
|
1861
2108
|
this._dispatchAction(backendSession, {
|
|
1862
2109
|
type: ActionType.ChatQueuedMessagesReordered,
|
|
1863
|
-
order:
|
|
2110
|
+
order: current.map(message => message.id)
|
|
1864
2111
|
}, chatURI);
|
|
1865
2112
|
}
|
|
1866
2113
|
}
|
|
1867
2114
|
}
|
|
1868
2115
|
_applyRemotePendingMessages(sessionResource, backendSession) {
|
|
1869
|
-
|
|
2116
|
+
const model = this._chatService.getSession(sessionResource);
|
|
2117
|
+
if (!model) {
|
|
1870
2118
|
return;
|
|
1871
2119
|
}
|
|
1872
2120
|
const chatURI = this._chatURIsBySessionResource.get(sessionResource);
|
|
@@ -1881,20 +2129,49 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1881
2129
|
id: pending.id,
|
|
1882
2130
|
kind,
|
|
1883
2131
|
message: pending.message.text,
|
|
1884
|
-
variableData: messageToVariableData(
|
|
2132
|
+
variableData: messageToVariableData(
|
|
2133
|
+
pending.message,
|
|
2134
|
+
this._config.connectionAuthority,
|
|
2135
|
+
this._config.connection.resourceUris
|
|
2136
|
+
),
|
|
1885
2137
|
modelId: this._toLanguageModelId(sessionResource, pending.message.model?.id),
|
|
1886
2138
|
modelConfiguration: pending.message.model?.config,
|
|
1887
2139
|
agentHostMessageOrigin: pending.message.origin,
|
|
1888
2140
|
metadata: pending.message._meta,
|
|
1889
2141
|
isSystemInitiated: pending.message.origin.kind === MessageKind.SystemNotification,
|
|
2142
|
+
requestSource: messageToRequestSource(pending.message),
|
|
2143
|
+
artifactRequest: readArtifactIntegrationRequest(pending.message),
|
|
1890
2144
|
systemInitiatedLabel: readMessageSystemInitiatedLabel(pending.message)
|
|
1891
2145
|
});
|
|
1892
2146
|
const remote = [];
|
|
1893
|
-
|
|
1894
|
-
remote.push(toRemote(
|
|
2147
|
+
for (const message of getPendingSteeringMessages(state)) {
|
|
2148
|
+
remote.push(toRemote(message, ChatRequestQueueKind.Steering));
|
|
2149
|
+
}
|
|
2150
|
+
const localSteering = this._localSteeringSubmissions.get(sessionResource);
|
|
2151
|
+
for (const message of remote) {
|
|
2152
|
+
localSteering?.delete(message.id);
|
|
2153
|
+
}
|
|
2154
|
+
for (const pending of model.getPendingRequests()) {
|
|
2155
|
+
if (pending.kind !== ChatRequestQueueKind.Steering || !localSteering?.has(pending.request.id)) {
|
|
2156
|
+
continue;
|
|
2157
|
+
}
|
|
2158
|
+
remote.push({
|
|
2159
|
+
id: pending.request.id,
|
|
2160
|
+
kind: pending.kind,
|
|
2161
|
+
message: pending.request.message.text,
|
|
2162
|
+
variableData: pending.request.variableData,
|
|
2163
|
+
modelId: pending.request.modelId ?? pending.sendOptions.userSelectedModelId,
|
|
2164
|
+
modelConfiguration: pending.request.modelConfiguration ?? pending.sendOptions.userSelectedModelConfiguration,
|
|
2165
|
+
metadata: pending.sendOptions.metadata,
|
|
2166
|
+
agentHostMessageOrigin: pending.sendOptions.agentHostMessageOrigin,
|
|
2167
|
+
isSystemInitiated: pending.request.isSystemInitiated ?? pending.sendOptions.isSystemInitiated,
|
|
2168
|
+
systemInitiatedLabel: pending.request.systemInitiatedLabel ?? pending.sendOptions.systemInitiatedLabel
|
|
2169
|
+
});
|
|
1895
2170
|
}
|
|
1896
2171
|
for (const queued of state.queuedMessages ?? []) {
|
|
1897
|
-
|
|
2172
|
+
if (queued.kind !== PendingMessageKind.Steering) {
|
|
2173
|
+
remote.push(toRemote(queued, ChatRequestQueueKind.Queued));
|
|
2174
|
+
}
|
|
1898
2175
|
}
|
|
1899
2176
|
this._remotePendingMessageProjections.add(sessionResource);
|
|
1900
2177
|
try {
|
|
@@ -1902,16 +2179,25 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1902
2179
|
} finally {
|
|
1903
2180
|
this._remotePendingMessageProjections.delete(sessionResource);
|
|
1904
2181
|
}
|
|
2182
|
+
if (localSteering && ( [...( localSteering.values())].some(submitted => !submitted))) {
|
|
2183
|
+
this._syncPendingMessages(sessionResource, backendSession);
|
|
2184
|
+
}
|
|
1905
2185
|
}
|
|
1906
2186
|
_dispatchAction(channel, action, chatURI) {
|
|
2187
|
+
if (this._store.isDisposed) {
|
|
2188
|
+
return;
|
|
2189
|
+
}
|
|
1907
2190
|
const target = isChatAction(action) ? this._requireChatURI(chatURI, action.type) : ( channel.toString());
|
|
2191
|
+
if (action.type === ActionType.ChatTurnCancelled || action.type === ActionType.ChatTruncated) {
|
|
2192
|
+
this._steeringMessageHandoffs.get(target)?.clear();
|
|
2193
|
+
}
|
|
1908
2194
|
if (action.type === ActionType.ChatToolCallConfirmed && action._meta) {
|
|
1909
2195
|
const {
|
|
1910
2196
|
turnId,
|
|
1911
2197
|
toolCallId
|
|
1912
2198
|
} = action;
|
|
1913
|
-
const
|
|
1914
|
-
const state =
|
|
2199
|
+
const owner = this._findChatOwner(target);
|
|
2200
|
+
const state = owner ? this._getSessionState(owner, target) : undefined;
|
|
1915
2201
|
const turn = state?.activeTurn?.id === turnId ? state.activeTurn : state?.turns.find(turn => turn.id === turnId);
|
|
1916
2202
|
const part = turn?.responseParts.find(
|
|
1917
2203
|
part => part.kind === ResponsePartKind.ToolCall && part.toolCall.toolCallId === toolCallId
|
|
@@ -1935,6 +2221,13 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1935
2221
|
}
|
|
1936
2222
|
return chatURI;
|
|
1937
2223
|
}
|
|
2224
|
+
_managedPluginRetryTarget(backendSession, chatURI) {
|
|
2225
|
+
return this._config.supportsManagedPluginRetry ? {
|
|
2226
|
+
provider: this._config.provider,
|
|
2227
|
+
session: ( backendSession.toString()),
|
|
2228
|
+
chat: chatURI
|
|
2229
|
+
} : undefined;
|
|
2230
|
+
}
|
|
1938
2231
|
_resolveChatUriFromState(sessionResource, state) {
|
|
1939
2232
|
const explicitChatUri = ( new URLSearchParams(sessionResource.query)).get(CHAT_SUBAGENT_RESOURCE_QUERY_PARAM);
|
|
1940
2233
|
if (explicitChatUri) {
|
|
@@ -1966,7 +2259,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1966
2259
|
}
|
|
1967
2260
|
return chatURI;
|
|
1968
2261
|
}
|
|
1969
|
-
_getChatURIOrDefault(sessionResource, session) {
|
|
2262
|
+
_getChatURIOrDefault(sessionResource, session, sessionState) {
|
|
1970
2263
|
const mapped = this._chatURIsBySessionResource.get(sessionResource);
|
|
1971
2264
|
if (mapped) {
|
|
1972
2265
|
return mapped;
|
|
@@ -1975,7 +2268,11 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
1975
2268
|
if (explicitChat) {
|
|
1976
2269
|
return explicitChat;
|
|
1977
2270
|
}
|
|
1978
|
-
|
|
2271
|
+
const state = sessionState ?? this._getRawSessionState(( session.toString()));
|
|
2272
|
+
return sessionResource.fragment ? state && getSessionChatResource(state, sessionResource.fragment, state.defaultChat) : state?.defaultChat;
|
|
2273
|
+
}
|
|
2274
|
+
_isSubagentChat(session, chat) {
|
|
2275
|
+
return chat !== undefined && this._getRawSessionState(session)?.chats.find(summary => summary.resource === chat)?.origin?.kind === ChatOriginKind.Tool;
|
|
1979
2276
|
}
|
|
1980
2277
|
_getCurrentActiveClient(sessionResource) {
|
|
1981
2278
|
const entry = this._activeClientEntries.get(sessionResource);
|
|
@@ -2002,6 +2299,9 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2002
2299
|
};
|
|
2003
2300
|
}
|
|
2004
2301
|
async _ensureActiveClient(sessionResource, backendSession, cancellationToken) {
|
|
2302
|
+
if (this._isInvocationAbandoned(cancellationToken)) {
|
|
2303
|
+
throw ( new CancellationError());
|
|
2304
|
+
}
|
|
2005
2305
|
const entry = this._ensureActiveClientEntry(sessionResource);
|
|
2006
2306
|
await entry.claim(backendSession, cancellationToken);
|
|
2007
2307
|
}
|
|
@@ -2016,7 +2316,9 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2016
2316
|
);
|
|
2017
2317
|
const entry = ( new ActiveClientEntry(
|
|
2018
2318
|
scope,
|
|
2019
|
-
this.
|
|
2319
|
+
this._activeClientService.acquireSessionTools(sessionResource),
|
|
2320
|
+
this._mcpAppToolsService.getToolDefinitions(sessionResource),
|
|
2321
|
+
this._config.connection,
|
|
2020
2322
|
AgentHostSessionHandler_1.ACTIVE_CLIENT_RECONCILIATION_DEBOUNCE_MS,
|
|
2021
2323
|
backendSession => this._getSessionState(( backendSession.toString())),
|
|
2022
2324
|
(backendSession, action) => this._dispatchAction(backendSession, action.type === ActionType.SessionActiveClientSet ? {
|
|
@@ -2038,6 +2340,10 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2038
2340
|
entry.dispose();
|
|
2039
2341
|
}
|
|
2040
2342
|
}
|
|
2343
|
+
_getHostChatTitle(sessionResource, state, chatURI) {
|
|
2344
|
+
const title = this._config.useSessionTitleForDefaultChat && chatURI === state.defaultChat ? state.title : getChatTitle(state, chatURI, state.defaultChat);
|
|
2345
|
+
return title !== undefined && this._config.isSessionTitlePlaceholder?.(title, sessionResource) ? undefined : title;
|
|
2346
|
+
}
|
|
2041
2347
|
_watchForServerInitiatedTurns(backendSession, sessionResource) {
|
|
2042
2348
|
const sessionStr = ( backendSession.toString());
|
|
2043
2349
|
const chatURI = this._getChatURI(sessionResource);
|
|
@@ -2046,14 +2352,34 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2046
2352
|
const currentState = this._getSessionState(sessionStr, chatURI);
|
|
2047
2353
|
let lastSeenTurnId = currentState?.activeTurn?.id;
|
|
2048
2354
|
let previousQueuedIds;
|
|
2049
|
-
let
|
|
2050
|
-
|
|
2355
|
+
let previousSteeringIds = ( new Set(
|
|
2356
|
+
currentState ? getPendingSteeringMessages(currentState).map(message => message.id) : []
|
|
2357
|
+
));
|
|
2358
|
+
let previousTitle = currentState ? this._getHostChatTitle(sessionResource, currentState, chatURI) : undefined;
|
|
2051
2359
|
let previousTurnIds = ( new Set(currentState?.turns.map(turn => turn.id) ?? []));
|
|
2052
2360
|
const disposables = ( new DisposableStore());
|
|
2053
2361
|
const turnProgressDisposable = ( new MutableDisposable());
|
|
2054
2362
|
disposables.add(turnProgressDisposable);
|
|
2055
2363
|
const sessionSub = this._ensureSessionSubscription(sessionStr);
|
|
2056
2364
|
const chatSub = this._ensureChatSubscription(sessionStr, chatURI);
|
|
2365
|
+
void this._acquireOrWaitForSession(sessionResource, disposables).then(model => {
|
|
2366
|
+
if (!model || disposables.isDisposed) {
|
|
2367
|
+
return;
|
|
2368
|
+
}
|
|
2369
|
+
let previousUsage;
|
|
2370
|
+
const updateSessionCost = () => {
|
|
2371
|
+
const state = sessionSub.value;
|
|
2372
|
+
const usage = state && !(state instanceof Error) ? readChatUsage(state, chatURI) : undefined;
|
|
2373
|
+
if (usage && !equals(previousUsage, usage)) {
|
|
2374
|
+
previousUsage = usage;
|
|
2375
|
+
model.setSessionCost(chatUsageToSessionCost(usage));
|
|
2376
|
+
}
|
|
2377
|
+
};
|
|
2378
|
+
disposables.add(sessionSub.onDidChange(updateSessionCost));
|
|
2379
|
+
updateSessionCost();
|
|
2380
|
+
}).catch(
|
|
2381
|
+
error => this._logService.error("[AgentHost] Failed to observe chat billing", error)
|
|
2382
|
+
);
|
|
2057
2383
|
let historyRefreshPending = false;
|
|
2058
2384
|
const refreshHistory = () => {
|
|
2059
2385
|
const state = this._getSessionState(sessionStr, chatURI);
|
|
@@ -2074,7 +2400,8 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2074
2400
|
this._config.connection.initializeResult.get()?.terminalCommandPrefix,
|
|
2075
2401
|
this._config.connection.resourceUris,
|
|
2076
2402
|
turn => this._getTurnErrorDetails(turn, allowTurnResume),
|
|
2077
|
-
readAgentContextUsage(state, state.turns.at(-1)?.usage)
|
|
2403
|
+
readAgentContextUsage(state, state.turns.at(-1)?.usage),
|
|
2404
|
+
this._managedPluginRetryTarget(backendSession, chatURI)
|
|
2078
2405
|
));
|
|
2079
2406
|
};
|
|
2080
2407
|
let previousContextUsage = currentState ? readAgentContextUsage(currentState, currentState.turns.at(-1)?.usage) : undefined;
|
|
@@ -2105,13 +2432,16 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2105
2432
|
const e = {
|
|
2106
2433
|
state
|
|
2107
2434
|
};
|
|
2108
|
-
const currentQueuedIds = ( new Set(
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2435
|
+
const currentQueuedIds = ( new Set(
|
|
2436
|
+
e.state.queuedMessages?.filter(message => message.kind !== PendingMessageKind.Steering).map(message => message.id)
|
|
2437
|
+
));
|
|
2438
|
+
const currentSteeringIds = ( new Set(getPendingSteeringMessages(e.state).map(message => message.id)));
|
|
2439
|
+
const removedSteeringIds = [...previousSteeringIds].filter(id => !( currentSteeringIds.has(id)));
|
|
2440
|
+
previousSteeringIds = currentSteeringIds;
|
|
2441
|
+
for (const id of removedSteeringIds) {
|
|
2442
|
+
this._chatService.removePendingRequest(sessionResource, id);
|
|
2112
2443
|
}
|
|
2113
|
-
|
|
2114
|
-
const currentTitle = getChatTitle(e.state, chatURI);
|
|
2444
|
+
const currentTitle = this._getHostChatTitle(sessionResource, e.state, chatURI);
|
|
2115
2445
|
if (currentTitle && currentTitle !== previousTitle) {
|
|
2116
2446
|
this._chatService.setChatSessionTitle(sessionResource, currentTitle);
|
|
2117
2447
|
}
|
|
@@ -2152,36 +2482,39 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2152
2482
|
}
|
|
2153
2483
|
previousQueuedIds = currentQueuedIds;
|
|
2154
2484
|
previousTurnIds = currentTurnIds;
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
activeTurn.message
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2485
|
+
const replacedTurnId = readMessageReplacedTurn(activeTurn.message);
|
|
2486
|
+
chatSession.startServerRequest(activeTurn.id, activeTurn.message.text, messageToVariableData(
|
|
2487
|
+
activeTurn.message,
|
|
2488
|
+
this._config.connectionAuthority,
|
|
2489
|
+
this._config.connection.resourceUris
|
|
2490
|
+
), {
|
|
2491
|
+
modelId: this._toLanguageModelId(sessionResource, activeTurn.message.model?.id),
|
|
2492
|
+
metadata: readAgentMessageRoundTripMetadata(activeTurn.message),
|
|
2493
|
+
modelConfiguration: activeTurn.message.model?.config,
|
|
2494
|
+
isSystemInitiated: activeTurn.message.origin.kind === MessageKind.SystemNotification,
|
|
2495
|
+
requestSource: messageToRequestSource(activeTurn.message),
|
|
2496
|
+
artifactRequest: readArtifactIntegrationRequest(activeTurn.message),
|
|
2497
|
+
systemInitiatedLabel: readMessageSystemInitiatedLabel(activeTurn.message),
|
|
2498
|
+
isHidden: isMessageHiddenFromTranscript(activeTurn.message),
|
|
2499
|
+
isRequestHidden: isMessageRequestHiddenFromTranscript(activeTurn.message),
|
|
2500
|
+
timestamp: parseTimestamp(activeTurn.startedAt),
|
|
2501
|
+
isTerminalRequest: isTerminalCommandPrompt(
|
|
2502
|
+
activeTurn.message.text,
|
|
2503
|
+
this._config.connection.initializeResult.get()?.terminalCommandPrefix
|
|
2504
|
+
),
|
|
2505
|
+
resume: resumedTurn,
|
|
2506
|
+
replacesRequestId: replacedTurnId !== undefined && !( currentTurnIds.has(replacedTurnId)) ? replacedTurnId : undefined,
|
|
2507
|
+
origin: messageToRequestOrigin(
|
|
2508
|
+
backendSession,
|
|
2509
|
+
activeTurn.message,
|
|
2510
|
+
this._config.agentId,
|
|
2511
|
+
this._config.connectionAuthority
|
|
2512
|
+
)
|
|
2513
|
+
});
|
|
2182
2514
|
const turnStore = ( new DisposableStore());
|
|
2183
2515
|
turnProgressDisposable.value = turnStore;
|
|
2184
2516
|
this._trackServerTurnProgress(backendSession, activeTurn.id, chatSession, turnStore);
|
|
2517
|
+
this._ensureSnapshotController(sessionResource)?.ensureRequestCheckpoint(activeTurn.id);
|
|
2185
2518
|
};
|
|
2186
2519
|
disposables.add(sessionSub.onDidChange(onChange));
|
|
2187
2520
|
disposables.add(chatSub.onDidChange(onChange));
|
|
@@ -2191,7 +2524,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2191
2524
|
const sessionSub = this._ensureSessionSubscription(( backendSession.toString()));
|
|
2192
2525
|
let previousServers;
|
|
2193
2526
|
const reconcile = () => {
|
|
2194
|
-
const servers = getMcpAuthenticationRequiredServers(sessionResource, this._getSessionState(( backendSession.toString()), chatURI));
|
|
2527
|
+
const servers = getMcpAuthenticationRequiredServers(sessionResource, backendSession, this._getSessionState(( backendSession.toString()), chatURI));
|
|
2195
2528
|
if (equals(previousServers, servers)) {
|
|
2196
2529
|
return;
|
|
2197
2530
|
}
|
|
@@ -2335,6 +2668,8 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2335
2668
|
execution.activeAttempts++;
|
|
2336
2669
|
void this._executeClientTool(
|
|
2337
2670
|
request,
|
|
2671
|
+
backendSession,
|
|
2672
|
+
sessionResource,
|
|
2338
2673
|
contextSessionResource,
|
|
2339
2674
|
execution.source.token,
|
|
2340
2675
|
() => requestGeneration === generation && (invocationStarted || equals(request$.read(undefined), request)),
|
|
@@ -2356,7 +2691,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2356
2691
|
};
|
|
2357
2692
|
if (claimant) {
|
|
2358
2693
|
execute(claimant);
|
|
2359
|
-
} else if (!this._clientToolRequiresConfirmation(request.toolCall)) {
|
|
2694
|
+
} else if (!this._clientToolRequiresConfirmation(request.toolCall, backendSession, sessionResource)) {
|
|
2360
2695
|
execute(undefined);
|
|
2361
2696
|
} else if (!unobservedTimer.value) {
|
|
2362
2697
|
const requestGeneration = generation;
|
|
@@ -2406,7 +2741,14 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2406
2741
|
this._clientToolInvocations.delete(key);
|
|
2407
2742
|
});
|
|
2408
2743
|
}
|
|
2409
|
-
_ensureClientToolInvocation(
|
|
2744
|
+
_ensureClientToolInvocation(
|
|
2745
|
+
chatURI,
|
|
2746
|
+
turnId,
|
|
2747
|
+
toolCallId,
|
|
2748
|
+
toolId,
|
|
2749
|
+
toolSessionResource,
|
|
2750
|
+
subagentInvocationId
|
|
2751
|
+
) {
|
|
2410
2752
|
const key = this._toolCallKey(chatURI, turnId, toolCallId);
|
|
2411
2753
|
const existing = this._clientToolInvocations.get(key);
|
|
2412
2754
|
if (existing) {
|
|
@@ -2415,6 +2757,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2415
2757
|
const invocation = this._toolsService.beginToolCall({
|
|
2416
2758
|
toolCallId,
|
|
2417
2759
|
toolId,
|
|
2760
|
+
toolSessionResource,
|
|
2418
2761
|
subagentInvocationId,
|
|
2419
2762
|
sessionResource: undefined,
|
|
2420
2763
|
force: true
|
|
@@ -2424,29 +2767,68 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2424
2767
|
}
|
|
2425
2768
|
return invocation;
|
|
2426
2769
|
}
|
|
2427
|
-
|
|
2770
|
+
_getClientToolOwner(backendSession, sessionResource) {
|
|
2771
|
+
const references = this._inputNeededWatchers.get(( backendSession.toString()))?.refs;
|
|
2772
|
+
const owner = references ? [...references].map(resource => ( URI.parse(resource))).find(resource => ( this._activeClientEntries.has(resource))) ?? sessionResource : sessionResource;
|
|
2773
|
+
return {
|
|
2774
|
+
sessionResource: owner,
|
|
2775
|
+
toolSessionResource: this._mcpAppToolsService.getToolSessionResource(owner)
|
|
2776
|
+
};
|
|
2777
|
+
}
|
|
2778
|
+
_resolveClientTool(toolName, backendSession, sessionResource) {
|
|
2779
|
+
const owner = this._getClientToolOwner(backendSession, sessionResource);
|
|
2780
|
+
const appTool = this._mcpAppToolsService.getTool(owner.toolSessionResource, toolName);
|
|
2781
|
+
if (appTool && !this._activeClientEntries.get(owner.sessionResource)?.hasBaseOrSessionTool(toolName)) {
|
|
2782
|
+
return appTool;
|
|
2783
|
+
}
|
|
2428
2784
|
const isCopilotSession = isCopilotAgentHostSessionType(this._config.sessionType);
|
|
2429
2785
|
if (isCopilotSession && toolName === SEMANTIC_SEARCH_TOOL_NAME) {
|
|
2430
|
-
|
|
2786
|
+
const tool = this._toolsService.getTool(CLIENT_SEMANTIC_SEARCH_TOOL_ID);
|
|
2787
|
+
if (tool) {
|
|
2788
|
+
return tool;
|
|
2789
|
+
}
|
|
2431
2790
|
}
|
|
2432
2791
|
const clientToolName = toolName === RUNTIME_TOOL_SEARCH_TOOL_NAME ? CLIENT_TOOL_SEARCH_REFERENCE_NAME : toolName;
|
|
2433
|
-
|
|
2792
|
+
for (const tool of this._toolsService.getAllToolsIncludingDisabled()) {
|
|
2793
|
+
if (tool.source.type !== "mcp" && tool.toolReferenceName === clientToolName) {
|
|
2794
|
+
return tool;
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2797
|
+
return appTool;
|
|
2434
2798
|
}
|
|
2435
|
-
_clientToolRequiresConfirmation(toolCall) {
|
|
2436
|
-
return this._resolveClientTool(toolCall.toolName)?.canRequestPreApproval === true;
|
|
2799
|
+
_clientToolRequiresConfirmation(toolCall, backendSession, sessionResource) {
|
|
2800
|
+
return this._resolveClientTool(toolCall.toolName, backendSession, sessionResource)?.canRequestPreApproval === true;
|
|
2437
2801
|
}
|
|
2438
|
-
async _executeClientTool(
|
|
2802
|
+
async _executeClientTool(
|
|
2803
|
+
request,
|
|
2804
|
+
backendSession,
|
|
2805
|
+
sessionResource,
|
|
2806
|
+
contextSessionResource,
|
|
2807
|
+
token,
|
|
2808
|
+
isCurrent,
|
|
2809
|
+
markInvocationStarted
|
|
2810
|
+
) {
|
|
2439
2811
|
const chatURI = ( request.chat.toString());
|
|
2440
2812
|
const toolCall = request.toolCall;
|
|
2441
2813
|
const toolName = toolCall.toolName;
|
|
2442
2814
|
const isToolSearch = toolName === RUNTIME_TOOL_SEARCH_TOOL_NAME;
|
|
2443
|
-
const toolData = this._resolveClientTool(toolName);
|
|
2815
|
+
const toolData = this._resolveClientTool(toolName, backendSession, sessionResource);
|
|
2816
|
+
const {
|
|
2817
|
+
toolSessionResource
|
|
2818
|
+
} = this._getClientToolOwner(backendSession, sessionResource);
|
|
2444
2819
|
const completionMeta = isToolSearch ? {
|
|
2445
2820
|
_meta: metaWithoutToolSearchCandidates(toolCall)
|
|
2446
2821
|
} : {};
|
|
2447
|
-
const invocation = toolData ? this._ensureClientToolInvocation(
|
|
2822
|
+
const invocation = toolData ? this._ensureClientToolInvocation(
|
|
2823
|
+
chatURI,
|
|
2824
|
+
request.turnId,
|
|
2825
|
+
toolCall.toolCallId,
|
|
2826
|
+
toolData.id,
|
|
2827
|
+
toolSessionResource,
|
|
2828
|
+
undefined
|
|
2829
|
+
) : undefined;
|
|
2448
2830
|
const fail = (message, code) => {
|
|
2449
|
-
const pastTenseMessage = ( localize(
|
|
2831
|
+
const pastTenseMessage = ( localize(11493, "Couldn't run {0}", toolCall.displayName));
|
|
2450
2832
|
const result = {
|
|
2451
2833
|
content: [],
|
|
2452
2834
|
toolResultError: message,
|
|
@@ -2469,11 +2851,11 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2469
2851
|
});
|
|
2470
2852
|
};
|
|
2471
2853
|
if (!toolData) {
|
|
2472
|
-
fail(( localize(
|
|
2854
|
+
fail(( localize(11494, "Tool \"{0}\" is not available on this client.", toolName)), "toolUnavailable");
|
|
2473
2855
|
return;
|
|
2474
2856
|
}
|
|
2475
2857
|
if (!invocation) {
|
|
2476
|
-
fail(( localize(
|
|
2858
|
+
fail(( localize(11495, "Could not create invocation for client tool \"{0}\".", toolName)), "invocationFailed");
|
|
2477
2859
|
return;
|
|
2478
2860
|
}
|
|
2479
2861
|
const toolInput = "toolInput" in toolCall ? toolCall.toolInput : undefined;
|
|
@@ -2501,7 +2883,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2501
2883
|
parameters = parsed;
|
|
2502
2884
|
} catch {
|
|
2503
2885
|
fail(( localize(
|
|
2504
|
-
|
|
2886
|
+
11496,
|
|
2505
2887
|
"Invalid tool input for \"{0}\": expected JSON object parameters.",
|
|
2506
2888
|
toolName
|
|
2507
2889
|
)), "invalidInput");
|
|
@@ -2524,6 +2906,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2524
2906
|
result = await this._toolsService.invokeTool({
|
|
2525
2907
|
callId: toolCall.toolCallId,
|
|
2526
2908
|
toolId: toolData.id,
|
|
2909
|
+
toolSessionResource,
|
|
2527
2910
|
parameters,
|
|
2528
2911
|
context: contextSessionResource ? {
|
|
2529
2912
|
sessionResource: contextSessionResource,
|
|
@@ -2568,10 +2951,10 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2568
2951
|
toolCallId: toolCall.toolCallId,
|
|
2569
2952
|
result: {
|
|
2570
2953
|
success: false,
|
|
2571
|
-
pastTenseMessage: ( localize(
|
|
2954
|
+
pastTenseMessage: ( localize(11497, "Couldn't run {0}", toolCall.displayName)),
|
|
2572
2955
|
error: {
|
|
2573
2956
|
message: ( localize(
|
|
2574
|
-
|
|
2957
|
+
11498,
|
|
2575
2958
|
"{0} needs confirmation but no session was available to answer it.",
|
|
2576
2959
|
toolCall.displayName
|
|
2577
2960
|
)),
|
|
@@ -2594,12 +2977,28 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2594
2977
|
cancellationToken: cts.token,
|
|
2595
2978
|
suppressErrorMarkdown: true,
|
|
2596
2979
|
onTurnEnded: lastTurn => {
|
|
2980
|
+
const details = lastTurn ? turnToResponseDetails(
|
|
2981
|
+
lastTurn,
|
|
2982
|
+
this._createTurnModelLookup(chatSession.sessionResource, lastTurn.message.model?.id)
|
|
2983
|
+
) : undefined;
|
|
2597
2984
|
const errorDetails = this._getTurnErrorDetails(lastTurn, !this._isChatReadOnly(( backendSession.toString()), chatURI));
|
|
2598
|
-
|
|
2985
|
+
const metadata = turnToResultMetadata(lastTurn);
|
|
2986
|
+
if (details || errorDetails || metadata) {
|
|
2599
2987
|
const response = this._chatService.getSession(chatSession.sessionResource)?.getRequests().find(request => request.id === turnId)?.response;
|
|
2600
2988
|
response?.setResult({
|
|
2601
2989
|
...response.result,
|
|
2602
|
-
|
|
2990
|
+
...(details ? {
|
|
2991
|
+
details
|
|
2992
|
+
} : {}),
|
|
2993
|
+
...(errorDetails ? {
|
|
2994
|
+
errorDetails
|
|
2995
|
+
} : {}),
|
|
2996
|
+
...(metadata ? {
|
|
2997
|
+
metadata: {
|
|
2998
|
+
...response.result?.metadata,
|
|
2999
|
+
...metadata
|
|
3000
|
+
}
|
|
3001
|
+
} : {})
|
|
2603
3002
|
});
|
|
2604
3003
|
}
|
|
2605
3004
|
this._completeSessionTurn(backendSession, chatSession.sessionResource, turnId, chatSession);
|
|
@@ -2671,7 +3070,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2671
3070
|
const turnId = request.requestId;
|
|
2672
3071
|
const chatURI = this._getChatURI(request.sessionResource);
|
|
2673
3072
|
const turnChannel = chatURI;
|
|
2674
|
-
const messageAttachments =
|
|
3073
|
+
const messageAttachments = this._convertVariablesToAttachments(request.variables.variables, request.sessionResource, request.message);
|
|
2675
3074
|
if (this._isInvocationAbandoned(cancellationToken)) {
|
|
2676
3075
|
return;
|
|
2677
3076
|
}
|
|
@@ -2679,9 +3078,18 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2679
3078
|
if (this._isInvocationAbandoned(cancellationToken)) {
|
|
2680
3079
|
return;
|
|
2681
3080
|
}
|
|
2682
|
-
this._clientDispatchedTurnIds.add(turnId);
|
|
2683
3081
|
const selectedModel = this._createModelSelection(request.userSelectedModelId, request.modelConfiguration);
|
|
2684
|
-
const requestedAgentUri =
|
|
3082
|
+
const requestedAgentUri = this._toHostAgentUri(request.modeInstructions);
|
|
3083
|
+
if (this._configurationService.getValue(ChatConfiguration.AgentEnabled) === false) {
|
|
3084
|
+
const agent = this._customizationService.getCustomAgents(request.sessionResource).find(agent => ( ( URI.parse(agent.uri)).toString()) === requestedAgentUri);
|
|
3085
|
+
if (!agent || readAgentCustomizationMeta(agent)["vscode.chatMode"] !== "ask") {
|
|
3086
|
+
throw ( new Error(( localize(
|
|
3087
|
+
11499,
|
|
3088
|
+
"Agent mode is disabled and this host does not provide the selected read-only Ask agent."
|
|
3089
|
+
))));
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
3092
|
+
this._clientDispatchedTurnIds.add(turnId);
|
|
2685
3093
|
const chatModel = this._chatService.getSession(request.sessionResource);
|
|
2686
3094
|
const protocolState = this._getSessionState(( session.toString()), chatURI);
|
|
2687
3095
|
if (chatModel && protocolState?.turns.length) {
|
|
@@ -2691,7 +3099,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2691
3099
|
const truncateAction = {
|
|
2692
3100
|
type: ActionType.ChatTruncated
|
|
2693
3101
|
};
|
|
2694
|
-
this.
|
|
3102
|
+
this._dispatchAction(session, truncateAction, turnChannel);
|
|
2695
3103
|
} else {
|
|
2696
3104
|
const seenAtIndex = protocolState.turns.findIndex(t => t.id === previousRequest.id);
|
|
2697
3105
|
if (seenAtIndex !== -1 && seenAtIndex < protocolState.turns.length - 1) {
|
|
@@ -2699,7 +3107,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2699
3107
|
type: ActionType.ChatTruncated,
|
|
2700
3108
|
turnId: previousRequest.id
|
|
2701
3109
|
};
|
|
2702
|
-
this.
|
|
3110
|
+
this._dispatchAction(session, truncateAction, turnChannel);
|
|
2703
3111
|
}
|
|
2704
3112
|
}
|
|
2705
3113
|
}
|
|
@@ -2726,10 +3134,6 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2726
3134
|
}, request.hideFromTranscript)
|
|
2727
3135
|
};
|
|
2728
3136
|
this._ensureTurnStopWatch(turnChannel, turnId);
|
|
2729
|
-
onFailureStage("dispatchTurn");
|
|
2730
|
-
this._config.connection.dispatch(turnChannel, turnAction);
|
|
2731
|
-
this._ensureSnapshotController(request.sessionResource)?.ensureRequestCheckpoint(request.requestId);
|
|
2732
|
-
onFailureStage("observeTurn");
|
|
2733
3137
|
const resourceOpens = [];
|
|
2734
3138
|
let resourceOpenError;
|
|
2735
3139
|
const openResponseResource = async (
|
|
@@ -2751,57 +3155,81 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2751
3155
|
}
|
|
2752
3156
|
});
|
|
2753
3157
|
if (!editor) {
|
|
2754
|
-
throw ( new Error(( localize(
|
|
3158
|
+
throw ( new Error(( localize(11500, "Could not open the sandbox policy in the editor."))));
|
|
2755
3159
|
}
|
|
2756
3160
|
if (!this._isInvocationAbandoned(cancellationToken)) {
|
|
2757
3161
|
progress([{
|
|
2758
3162
|
kind: "markdownContent",
|
|
2759
|
-
content: ( new MarkdownString(( localize(
|
|
3163
|
+
content: ( new MarkdownString(( localize(11501, "Opened the sandbox policy in the editor."))))
|
|
2760
3164
|
}]);
|
|
2761
3165
|
}
|
|
2762
3166
|
};
|
|
2763
|
-
return (
|
|
3167
|
+
return (new Promise((resolve, reject) => {
|
|
2764
3168
|
const store = this._createTurnObservation(resolve);
|
|
3169
|
+
const finish = () => {
|
|
3170
|
+
this._turnObservations.deleteAndDispose(store);
|
|
3171
|
+
this._clientDispatchedTurnIds.delete(turnId);
|
|
3172
|
+
this._completeSessionTurn(session, request.sessionResource, turnId);
|
|
3173
|
+
};
|
|
3174
|
+
store.add(this._config.connection.onDidAction(envelope => {
|
|
3175
|
+
if (envelope.channel !== turnChannel || envelope.action.type !== ActionType.ChatTurnStarted || envelope.action.turnId !== turnId || envelope.origin?.clientId !== this._config.connection.clientId || !envelope.rejectionReason) {
|
|
3176
|
+
return;
|
|
3177
|
+
}
|
|
3178
|
+
reject(( new Error(( localize(11502, "Your message could not be sent: {0}", envelope.rejectionReason)))));
|
|
3179
|
+
this._clearTurnStopWatch(turnChannel, turnId);
|
|
3180
|
+
finish();
|
|
3181
|
+
}));
|
|
2765
3182
|
const cancelSub = store.add(cancellationToken.onCancellationRequested(() => {
|
|
2766
3183
|
cancelSub.dispose();
|
|
2767
3184
|
this._logService.info(`[AgentHost] Cancellation requested for ${( session.toString())}, dispatching turnCancelled`);
|
|
2768
|
-
this.
|
|
3185
|
+
this._dispatchAction(session, {
|
|
2769
3186
|
type: ActionType.ChatTurnCancelled,
|
|
2770
3187
|
turnId,
|
|
2771
3188
|
duration: this._turnDuration(turnChannel, turnId)
|
|
2772
|
-
});
|
|
3189
|
+
}, turnChannel);
|
|
2773
3190
|
}));
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
3191
|
+
try {
|
|
3192
|
+
onFailureStage("dispatchTurn");
|
|
3193
|
+
this._config.connection.dispatch(turnChannel, turnAction);
|
|
3194
|
+
if (store.isDisposed) {
|
|
3195
|
+
return;
|
|
3196
|
+
}
|
|
3197
|
+
this._ensureSnapshotController(request.sessionResource)?.ensureRequestCheckpoint(request.requestId);
|
|
3198
|
+
onFailureStage("observeTurn");
|
|
3199
|
+
store.add(this._observeTurn({
|
|
3200
|
+
backendSession: session,
|
|
3201
|
+
sessionResource: request.sessionResource,
|
|
3202
|
+
chatURI,
|
|
3203
|
+
turnId,
|
|
3204
|
+
sink: progress,
|
|
3205
|
+
cancellationToken,
|
|
3206
|
+
suppressErrorMarkdown: true,
|
|
3207
|
+
onResponseText,
|
|
3208
|
+
onOpenResponseResource: request.message.trimStart().startsWith("/") ? resource => {
|
|
3209
|
+
resourceOpens.push(openResponseResource(resource).catch(error => {
|
|
3210
|
+
resourceOpenError = error instanceof Error ? error : ( new Error(String(error)));
|
|
3211
|
+
this._logService.error("[AgentHost] Failed to open slash command resource", resourceOpenError);
|
|
3212
|
+
}));
|
|
3213
|
+
} : undefined,
|
|
3214
|
+
onTurnEnded: async lastTurn => {
|
|
3215
|
+
try {
|
|
3216
|
+
await raceCancellation(Promise.all(resourceOpens), cancellationToken);
|
|
3217
|
+
if (resourceOpenError) {
|
|
3218
|
+
throw resourceOpenError;
|
|
3219
|
+
}
|
|
3220
|
+
resolve(lastTurn);
|
|
3221
|
+
} catch (error) {
|
|
3222
|
+
reject(error);
|
|
3223
|
+
} finally {
|
|
3224
|
+
finish();
|
|
2794
3225
|
}
|
|
2795
|
-
resolve(lastTurn);
|
|
2796
|
-
} catch (error) {
|
|
2797
|
-
reject(error);
|
|
2798
|
-
} finally {
|
|
2799
|
-
this._turnObservations.deleteAndDispose(store);
|
|
2800
|
-
this._clientDispatchedTurnIds.delete(turnId);
|
|
2801
|
-
this._completeSessionTurn(session, request.sessionResource, turnId);
|
|
2802
3226
|
}
|
|
2803
|
-
}
|
|
2804
|
-
})
|
|
3227
|
+
}));
|
|
3228
|
+
} catch (error) {
|
|
3229
|
+
reject(error);
|
|
3230
|
+
this._clearTurnStopWatch(turnChannel, turnId);
|
|
3231
|
+
finish();
|
|
3232
|
+
}
|
|
2805
3233
|
}));
|
|
2806
3234
|
}
|
|
2807
3235
|
async _handleResumedTurn(session, request, progress, cancellationToken) {
|
|
@@ -2821,7 +3249,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2821
3249
|
const completedResumedTurn = latestTurn?.id === turnId && latestTurn.state !== TurnState.Error ? latestTurn : undefined;
|
|
2822
3250
|
const turn = activeTurn ?? resumableTurn ?? completedResumedTurn;
|
|
2823
3251
|
if (!turn) {
|
|
2824
|
-
throw ( new Error(( localize(
|
|
3252
|
+
throw ( new Error(( localize(11503, "This failed request can no longer be resumed."))));
|
|
2825
3253
|
}
|
|
2826
3254
|
const shouldDispatchResume = resumableTurn !== undefined;
|
|
2827
3255
|
this._clientDispatchedTurnIds.add(turnId);
|
|
@@ -2842,7 +3270,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2842
3270
|
return;
|
|
2843
3271
|
}
|
|
2844
3272
|
reject(( new Error(( localize(
|
|
2845
|
-
|
|
3273
|
+
11504,
|
|
2846
3274
|
"This failed request could not be resumed: {0}",
|
|
2847
3275
|
envelope.rejectionReason
|
|
2848
3276
|
)))));
|
|
@@ -2852,11 +3280,11 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2852
3280
|
}
|
|
2853
3281
|
const cancelSub = store.add(cancellationToken.onCancellationRequested(() => {
|
|
2854
3282
|
cancelSub.dispose();
|
|
2855
|
-
this.
|
|
3283
|
+
this._dispatchAction(session, {
|
|
2856
3284
|
type: ActionType.ChatTurnCancelled,
|
|
2857
3285
|
turnId,
|
|
2858
3286
|
duration: 0
|
|
2859
|
-
});
|
|
3287
|
+
}, chatURI);
|
|
2860
3288
|
}));
|
|
2861
3289
|
store.add(this._observeTurn({
|
|
2862
3290
|
backendSession: session,
|
|
@@ -2888,18 +3316,71 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2888
3316
|
session,
|
|
2889
3317
|
turnId,
|
|
2890
3318
|
cancellationToken,
|
|
2891
|
-
|
|
3319
|
+
getPendingCall,
|
|
2892
3320
|
chatURI
|
|
2893
3321
|
) {
|
|
2894
|
-
IChatToolInvocation.awaitConfirmation(invocation, cancellationToken).then(reason => {
|
|
3322
|
+
IChatToolInvocation.awaitConfirmation(invocation, cancellationToken).then(async reason => {
|
|
2895
3323
|
let selectedOption;
|
|
2896
|
-
const
|
|
3324
|
+
const pendingCall = getPendingCall();
|
|
3325
|
+
if (!pendingCall) {
|
|
3326
|
+
this._logService.trace(
|
|
3327
|
+
`[AgentHost] Ignoring confirmation for an unobserved or settled tool: ${toolCallId}`
|
|
3328
|
+
);
|
|
3329
|
+
return;
|
|
3330
|
+
}
|
|
3331
|
+
const protocolOptions = pendingCall?.options;
|
|
2897
3332
|
if (reason.type === ToolConfirmKind.UserAction && reason.selectedButton && protocolOptions) {
|
|
2898
3333
|
selectedOption = protocolOptions.find(o => o.id === reason.selectedButton);
|
|
2899
3334
|
}
|
|
2900
3335
|
const approved = selectedOption ? selectedOption.kind === ConfirmationOptionKind.Approve : reason.type !== ToolConfirmKind.Denied && reason.type !== ToolConfirmKind.Skipped;
|
|
3336
|
+
let sandboxPathGrantSaved;
|
|
3337
|
+
if (approved && selectedOption?.id === SAVE_SANDBOX_PATH && pendingCall && reason.type === ToolConfirmKind.UserAction) {
|
|
3338
|
+
const isCurrent = () => !cancellationToken.isCancellationRequested && !IChatToolInvocation.isComplete(invocation) && getPendingCall() === pendingCall;
|
|
3339
|
+
try {
|
|
3340
|
+
const grant = readToolCallMeta(pendingCall)["vscode.sandboxPathGrant"];
|
|
3341
|
+
if (!grant) {
|
|
3342
|
+
throw ( new Error(( localize(
|
|
3343
|
+
11505,
|
|
3344
|
+
"This permission request does not contain a valid sandbox path grant."
|
|
3345
|
+
))));
|
|
3346
|
+
}
|
|
3347
|
+
await saveSandboxPathGrant(this._configurationService, grant, isCurrent);
|
|
3348
|
+
} catch (error) {
|
|
3349
|
+
this._logService.error("Failed to save sandbox path grant", error);
|
|
3350
|
+
this._notificationService.error(( localize(
|
|
3351
|
+
11506,
|
|
3352
|
+
"Could not save the path to sandbox settings. {0}",
|
|
3353
|
+
error instanceof Error ? error.message : String(error)
|
|
3354
|
+
)));
|
|
3355
|
+
if (isCurrent()) {
|
|
3356
|
+
invocation.requestConfirmation(toolCallStateToPreparedInvocation(
|
|
3357
|
+
pendingCall,
|
|
3358
|
+
session,
|
|
3359
|
+
this._config.connectionAuthority,
|
|
3360
|
+
undefined,
|
|
3361
|
+
undefined,
|
|
3362
|
+
this._config.connection.resourceUris
|
|
3363
|
+
));
|
|
3364
|
+
this._awaitToolConfirmation(
|
|
3365
|
+
invocation,
|
|
3366
|
+
toolCallId,
|
|
3367
|
+
session,
|
|
3368
|
+
turnId,
|
|
3369
|
+
cancellationToken,
|
|
3370
|
+
getPendingCall,
|
|
3371
|
+
chatURI
|
|
3372
|
+
);
|
|
3373
|
+
}
|
|
3374
|
+
return;
|
|
3375
|
+
}
|
|
3376
|
+
if (!isCurrent()) {
|
|
3377
|
+
return;
|
|
3378
|
+
}
|
|
3379
|
+
sandboxPathGrantSaved = true;
|
|
3380
|
+
}
|
|
2901
3381
|
const responseMeta = toAgentPermissionResponseMeta({
|
|
2902
|
-
decisionSource: confirmedReasonToDecisionSource(reason, cancellationToken)
|
|
3382
|
+
decisionSource: confirmedReasonToDecisionSource(reason, cancellationToken),
|
|
3383
|
+
sandboxPathGrantSaved
|
|
2903
3384
|
});
|
|
2904
3385
|
this._logService.info(
|
|
2905
3386
|
`[AgentHost] Tool confirmation: toolCallId=${toolCallId}, approved=${approved}, selectedOptionId=${selectedOption?.id}`
|
|
@@ -2926,10 +3407,22 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2926
3407
|
selectedOptionId: selectedOption.id
|
|
2927
3408
|
} : {})
|
|
2928
3409
|
});
|
|
3410
|
+
const permissionGrant = approved && selectedOption && this._config.mirrorsPermissionGrants ? parsePermissionGrantOptionId(selectedOption.id) : undefined;
|
|
3411
|
+
if (permissionGrant?.scope === PermissionGrantScope.Host) {
|
|
3412
|
+
mirrorAgentHostGrants(this._configurationService, permissionGrant.rules).catch(error => {
|
|
3413
|
+
this._logService.error("[AgentHost] Failed to mirror permission grant into settings", error);
|
|
3414
|
+
});
|
|
3415
|
+
}
|
|
2929
3416
|
}).catch(err => {
|
|
2930
3417
|
this._logService.warn(`[AgentHost] Tool confirmation failed for toolCallId=${toolCallId}`, err);
|
|
2931
3418
|
});
|
|
2932
3419
|
}
|
|
3420
|
+
_signalToolConfirmation() {
|
|
3421
|
+
this._accessibilitySignalService.playSignal(AccessibilitySignal.chatUserActionRequired, {
|
|
3422
|
+
allowManyInParallel: true,
|
|
3423
|
+
userGesture: true
|
|
3424
|
+
});
|
|
3425
|
+
}
|
|
2933
3426
|
_observeTurn(options) {
|
|
2934
3427
|
const store = ( new DisposableStore());
|
|
2935
3428
|
const chatSession = this._activeSessions.get(options.sessionResource);
|
|
@@ -2984,8 +3477,11 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
2984
3477
|
const mcpAuthRequired$ = derivedOpts({
|
|
2985
3478
|
equalsFn: equals
|
|
2986
3479
|
}, reader => {
|
|
2987
|
-
return getMcpAuthenticationRequiredServers(opts.sessionResource, mergedState$.read(reader));
|
|
3480
|
+
return getMcpAuthenticationRequiredServers(opts.sessionResource, opts.backendSession, mergedState$.read(reader));
|
|
2988
3481
|
});
|
|
3482
|
+
const mcpRoutingServers$ = derivedOpts({
|
|
3483
|
+
equalsFn: equals
|
|
3484
|
+
}, reader => readMcpRoutingServers(mergedState$.read(reader), ( opts.chatURI.toString())));
|
|
2989
3485
|
const mcpStarting$ = derivedOpts({
|
|
2990
3486
|
equalsFn: equals
|
|
2991
3487
|
}, reader => {
|
|
@@ -3012,7 +3508,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3012
3508
|
};
|
|
3013
3509
|
});
|
|
3014
3510
|
});
|
|
3015
|
-
const subagentContext = this._createSubagentContext(sessionState$, subagentStore);
|
|
3511
|
+
const subagentContext = this._createSubagentContext(sessionState$, subagentStore, opts.subagentSnapshots);
|
|
3016
3512
|
store.add(toDisposable(() => {
|
|
3017
3513
|
if (subagentContext.toolCalls.size === 0) {
|
|
3018
3514
|
if (options.subagentStore) {
|
|
@@ -3024,7 +3520,8 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3024
3520
|
}));
|
|
3025
3521
|
store.add(autorunPerKeyedItem(
|
|
3026
3522
|
responseParts$,
|
|
3027
|
-
rp => rp.kind === ResponsePartKind.ToolCall ? `tc:${rp.toolCall.toolCallId}` : rp.kind === ResponsePartKind.Markdown ? `md:${rp.id}` : rp.kind === ResponsePartKind.Reasoning ? `rs:${rp.id}` : rp.kind === ResponsePartKind.InputRequest ?
|
|
3523
|
+
rp => rp.kind === ResponsePartKind.ToolCall ? `tc:${rp.toolCall.toolCallId}` : rp.kind === ResponsePartKind.Markdown ? `md:${rp.id}` : rp.kind === ResponsePartKind.Reasoning ? `rs:${rp.id}` : rp.kind === ResponsePartKind.InputRequest ?
|
|
3524
|
+
this._config.supportsComputerUseSetup && readComputerUseSetupCard(rp.request) ? `ir:${rp.request.id}` : inputRequestResponsePartKey(rp) : `other:${( responseParts$.get().indexOf(rp))}`,
|
|
3028
3525
|
(_key, part$, partStore) => {
|
|
3029
3526
|
const initial = part$.get();
|
|
3030
3527
|
switch (initial.kind) {
|
|
@@ -3055,7 +3552,12 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3055
3552
|
opts.onOpenResponseResource(resource);
|
|
3056
3553
|
break;
|
|
3057
3554
|
}
|
|
3058
|
-
const progress = systemNotificationToChatPart(
|
|
3555
|
+
const progress = systemNotificationToChatPart(
|
|
3556
|
+
initial.content,
|
|
3557
|
+
this._config.connectionAuthority,
|
|
3558
|
+
initial._meta,
|
|
3559
|
+
this._managedPluginRetryTarget(opts.backendSession, opts.chatURI)
|
|
3560
|
+
);
|
|
3059
3561
|
if (progress) {
|
|
3060
3562
|
if (progress.kind === "systemNotification" && progress.presentation === "workspaceTransition" && progress.accessibilityLabel) {
|
|
3061
3563
|
status(progress.accessibilityLabel);
|
|
@@ -3071,15 +3573,27 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3071
3573
|
let lastUsage;
|
|
3072
3574
|
let lastAutoModeResolution;
|
|
3073
3575
|
const modelLookup = this._createTurnModelLookup(opts.sessionResource, undefined);
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
}
|
|
3576
|
+
this._setupMcpAuthPrompt(mcpAuthRequired$, mcpRoutingServers$, store, opts);
|
|
3577
|
+
let shownActivityProgressId;
|
|
3077
3578
|
store.add(autorun(reader => {
|
|
3078
3579
|
const activity = chatState$.read(reader)?.activity;
|
|
3079
3580
|
const progressId = getAgentHostActivityProgressId(responseParts$.read(reader));
|
|
3080
|
-
if (
|
|
3581
|
+
if (progressId === undefined) {
|
|
3582
|
+
return;
|
|
3583
|
+
}
|
|
3584
|
+
if (!activity) {
|
|
3585
|
+
if (shownActivityProgressId === progressId) {
|
|
3586
|
+
shownActivityProgressId = undefined;
|
|
3587
|
+
opts.sink([{
|
|
3588
|
+
kind: "progressMessage",
|
|
3589
|
+
id: progressId,
|
|
3590
|
+
content: ( new MarkdownString()),
|
|
3591
|
+
remove: true
|
|
3592
|
+
}]);
|
|
3593
|
+
}
|
|
3081
3594
|
return;
|
|
3082
3595
|
}
|
|
3596
|
+
shownActivityProgressId = progressId;
|
|
3083
3597
|
opts.sink([{
|
|
3084
3598
|
kind: "progressMessage",
|
|
3085
3599
|
id: progressId,
|
|
@@ -3258,19 +3772,39 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3258
3772
|
}));
|
|
3259
3773
|
return store;
|
|
3260
3774
|
}
|
|
3261
|
-
_setupMcpAuthPrompt(mcpAuthRequired$, store, opts) {
|
|
3775
|
+
_setupMcpAuthPrompt(mcpAuthRequired$, mcpRoutingServers$, store, opts) {
|
|
3262
3776
|
let part;
|
|
3263
3777
|
let ownedIds = ( new Set());
|
|
3264
3778
|
let runId = 0;
|
|
3265
3779
|
store.add(autorun(reader => {
|
|
3266
3780
|
const pendingAuth = mcpAuthRequired$.read(reader);
|
|
3781
|
+
const routingServers = mcpRoutingServers$.read(reader);
|
|
3782
|
+
const routingEnabled = this._configurationService.getValue(AgentHostMcpToolRoutingEnabledSettingId) === true;
|
|
3783
|
+
const deferredServers = ( new Set(pendingAuth.filter(
|
|
3784
|
+
server => routingServers.includes(server.name) || (routingEnabled && server.connectorName !== undefined)
|
|
3785
|
+
).map(server => server.id)));
|
|
3786
|
+
const surfaced = this._getSurfacedMcpAuthServers(opts.sessionResource);
|
|
3787
|
+
for (const server of pendingAuth) {
|
|
3788
|
+
if (( deferredServers.has(server.id))) {
|
|
3789
|
+
surfaced.delete(server.id);
|
|
3790
|
+
ownedIds.delete(server.id);
|
|
3791
|
+
this._mcpAuthNotifications.get(opts.sessionResource)?.deleteAndDispose(server.id);
|
|
3792
|
+
}
|
|
3793
|
+
}
|
|
3267
3794
|
const currentRunId = ++runId;
|
|
3268
|
-
this._filterAutoGrantedMcpAuthentication(opts.sessionResource, pendingAuth).then(servers => {
|
|
3269
|
-
if (currentRunId !== runId) {
|
|
3795
|
+
this._filterAutoGrantedMcpAuthentication(opts.sessionResource, pendingAuth.filter(server => !( deferredServers.has(server.id)))).then(servers => {
|
|
3796
|
+
if (currentRunId !== runId || store.isDisposed) {
|
|
3270
3797
|
return;
|
|
3271
3798
|
}
|
|
3272
3799
|
const surfaced = this._getSurfacedMcpAuthServers(opts.sessionResource);
|
|
3273
3800
|
const newServers = servers.filter(server => !( surfaced.has(server.id)));
|
|
3801
|
+
if (this._accessibilityService.isScreenReaderOptimized()) {
|
|
3802
|
+
for (const server of newServers) {
|
|
3803
|
+
surfaced.add(server.id);
|
|
3804
|
+
this._showMcpAuthNotification(opts.sessionResource, server);
|
|
3805
|
+
}
|
|
3806
|
+
return;
|
|
3807
|
+
}
|
|
3274
3808
|
if (!newServers.length && (!part || part.isUsed)) {
|
|
3275
3809
|
return;
|
|
3276
3810
|
}
|
|
@@ -3296,6 +3830,36 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3296
3830
|
});
|
|
3297
3831
|
}));
|
|
3298
3832
|
}
|
|
3833
|
+
_showMcpAuthNotification(sessionResource, server) {
|
|
3834
|
+
let notifications = this._mcpAuthNotifications.get(sessionResource);
|
|
3835
|
+
if (!notifications) {
|
|
3836
|
+
notifications = ( new DisposableMap());
|
|
3837
|
+
this._mcpAuthNotifications.set(sessionResource, notifications);
|
|
3838
|
+
}
|
|
3839
|
+
const liveServer = this._customizationService.getMcpServers(sessionResource).find(candidate => candidate.id === server.id);
|
|
3840
|
+
const label = liveServer ? getMcpServerDisplayLabel(liveServer) : server.name;
|
|
3841
|
+
let authenticating = false;
|
|
3842
|
+
const notification = this._notificationService.prompt(Severity.Info, ( localize(11507, "The MCP server {0} requires authentication.", label)), [{
|
|
3843
|
+
label: ( localize(11508, "Authenticate")),
|
|
3844
|
+
keepOpen: true,
|
|
3845
|
+
run: async () => {
|
|
3846
|
+
if (authenticating) {
|
|
3847
|
+
return;
|
|
3848
|
+
}
|
|
3849
|
+
authenticating = true;
|
|
3850
|
+
try {
|
|
3851
|
+
if (await this._customizationService.authenticateMcpServer(sessionResource, server.id)) {
|
|
3852
|
+
notification.close();
|
|
3853
|
+
}
|
|
3854
|
+
} finally {
|
|
3855
|
+
authenticating = false;
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
}], {
|
|
3859
|
+
sticky: true
|
|
3860
|
+
});
|
|
3861
|
+
notifications.set(server.id, toDisposable(() => notification.close()));
|
|
3862
|
+
}
|
|
3299
3863
|
_getSurfacedMcpAuthServers(sessionResource) {
|
|
3300
3864
|
let surfaced = this._surfacedMcpAuthServers.get(sessionResource);
|
|
3301
3865
|
if (!surfaced) {
|
|
@@ -3305,6 +3869,16 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3305
3869
|
return surfaced;
|
|
3306
3870
|
}
|
|
3307
3871
|
_reconcileSurfacedMcpAuthServers() {
|
|
3872
|
+
for (const [sessionResource, notifications] of this._mcpAuthNotifications) {
|
|
3873
|
+
const pending = ( new Set(this._customizationService.getMcpServers(sessionResource).filter(
|
|
3874
|
+
server => server.enabled && (server.status === McpServerStatus.AuthRequired || server.status === McpServerStatus.Starting)
|
|
3875
|
+
).map(server => server.id)));
|
|
3876
|
+
for (const id of ( notifications.keys())) {
|
|
3877
|
+
if (!( pending.has(id))) {
|
|
3878
|
+
notifications.deleteAndDispose(id);
|
|
3879
|
+
}
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3308
3882
|
for (const [sessionResource, surfaced] of this._surfacedMcpAuthServers) {
|
|
3309
3883
|
if (surfaced.size === 0) {
|
|
3310
3884
|
continue;
|
|
@@ -3329,6 +3903,11 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3329
3903
|
return remaining;
|
|
3330
3904
|
}
|
|
3331
3905
|
async _autoAuthenticateMcpServer(sessionResource, server) {
|
|
3906
|
+
if (( this._customizationService.getMcpServers(sessionResource).some(
|
|
3907
|
+
candidate => candidate.name === server.name && candidate.connectorName !== undefined
|
|
3908
|
+
))) {
|
|
3909
|
+
return false;
|
|
3910
|
+
}
|
|
3332
3911
|
const key = JSON.stringify([
|
|
3333
3912
|
extUriBiasedIgnorePathCase.getComparisonKey(sessionResource),
|
|
3334
3913
|
agentHostMcpServerId(sessionResource.authority, server.name, server.resource),
|
|
@@ -3353,7 +3932,8 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3353
3932
|
},
|
|
3354
3933
|
oauthClient: server.oauthClient,
|
|
3355
3934
|
requiredScopes: server.requiredScopes ? [...server.requiredScopes] : undefined
|
|
3356
|
-
}
|
|
3935
|
+
},
|
|
3936
|
+
server.target
|
|
3357
3937
|
).catch(err => {
|
|
3358
3938
|
this._logService.error(`[AgentHost] Failed to auto-authenticate MCP server '${server.name}'`, err);
|
|
3359
3939
|
return false;
|
|
@@ -3386,18 +3966,19 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3386
3966
|
_setupReasoningPart(part$, store, opts) {
|
|
3387
3967
|
const partId = part$.get().id;
|
|
3388
3968
|
let lastEmitted = opts.seedEmittedLengths?.get(partId) ?? 0;
|
|
3969
|
+
const initial = lastEmitted > 0 ? reasoningPartToThinking(part$.get()) : undefined;
|
|
3970
|
+
let lastStartedAt = initial?.reasoningStartedAt;
|
|
3971
|
+
let lastDuration = initial?.reasoningDurationMs;
|
|
3389
3972
|
store.add(autorun(reader => {
|
|
3390
|
-
const
|
|
3391
|
-
|
|
3973
|
+
const part = part$.read(reader);
|
|
3974
|
+
const progress = reasoningPartToThinking(part, part.content.substring(lastEmitted));
|
|
3975
|
+
if (!part.content || (part.content.length <= lastEmitted && progress.reasoningStartedAt === lastStartedAt && progress.reasoningDurationMs === lastDuration)) {
|
|
3392
3976
|
return;
|
|
3393
3977
|
}
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
value: delta,
|
|
3399
|
-
id: partId
|
|
3400
|
-
}]);
|
|
3978
|
+
lastEmitted = part.content.length;
|
|
3979
|
+
lastStartedAt = progress.reasoningStartedAt;
|
|
3980
|
+
lastDuration = progress.reasoningDurationMs;
|
|
3981
|
+
opts.sink([progress]);
|
|
3401
3982
|
}));
|
|
3402
3983
|
}
|
|
3403
3984
|
_setupToolCallPart(part$, store, opts, subagentContext) {
|
|
@@ -3499,7 +4080,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3499
4080
|
return {
|
|
3500
4081
|
currentClientId: this._config.connection.clientId,
|
|
3501
4082
|
cancelOtherClientToolCall: toolCall => {
|
|
3502
|
-
const reasonMessage = ( localize(
|
|
4083
|
+
const reasonMessage = ( localize(11509, "{0} was skipped from another client", toolCall.displayName));
|
|
3503
4084
|
this._dispatchAction(backendSession, toolCall.status === ToolCallStatus.PendingConfirmation ? {
|
|
3504
4085
|
type: ActionType.ChatToolCallConfirmed,
|
|
3505
4086
|
turnId,
|
|
@@ -3516,7 +4097,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3516
4097
|
toolCallId: toolCall.toolCallId,
|
|
3517
4098
|
result: {
|
|
3518
4099
|
success: false,
|
|
3519
|
-
pastTenseMessage: ( localize(
|
|
4100
|
+
pastTenseMessage: ( localize(11510, "Skipped {0}", toolCall.displayName)),
|
|
3520
4101
|
error: {
|
|
3521
4102
|
message: reasonMessage,
|
|
3522
4103
|
code: "cancelled"
|
|
@@ -3530,7 +4111,13 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3530
4111
|
const toolCallId = initial.toolCallId;
|
|
3531
4112
|
const subAgentInvocationId = opts.subAgentInvocationId;
|
|
3532
4113
|
const adopted = snapshotInvocationToAdopt(opts, toolCallId);
|
|
3533
|
-
|
|
4114
|
+
const getPendingCall = () => {
|
|
4115
|
+
if (store.isDisposed) {
|
|
4116
|
+
return undefined;
|
|
4117
|
+
}
|
|
4118
|
+
const call = part$.get().toolCall;
|
|
4119
|
+
return call.status === ToolCallStatus.PendingConfirmation ? call : undefined;
|
|
4120
|
+
};
|
|
3534
4121
|
let invocation;
|
|
3535
4122
|
if (adopted) {
|
|
3536
4123
|
invocation = adopted;
|
|
@@ -3562,20 +4149,24 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3562
4149
|
}
|
|
3563
4150
|
}
|
|
3564
4151
|
if (initial.status === ToolCallStatus.PendingConfirmation && !IChatToolInvocation.isComplete(invocation)) {
|
|
4152
|
+
this._signalToolConfirmation();
|
|
3565
4153
|
this._awaitToolConfirmation(
|
|
3566
4154
|
invocation,
|
|
3567
4155
|
toolCallId,
|
|
3568
4156
|
opts.backendSession,
|
|
3569
4157
|
opts.turnId,
|
|
3570
4158
|
opts.cancellationToken,
|
|
3571
|
-
|
|
4159
|
+
getPendingCall,
|
|
3572
4160
|
opts.chatURI
|
|
3573
4161
|
);
|
|
3574
4162
|
}
|
|
3575
4163
|
this._trackSubagentToolCall(initial, invocation, opts, subagentContext);
|
|
3576
4164
|
const outputTerminalAttachment = {
|
|
3577
|
-
disposable:
|
|
4165
|
+
disposable: ( new MutableDisposable())
|
|
3578
4166
|
};
|
|
4167
|
+
store.add(toDisposable(
|
|
4168
|
+
() => this._releaseOutputTerminal(outputTerminalAttachment, part$.get().toolCall, opts.sessionResource)
|
|
4169
|
+
));
|
|
3579
4170
|
store.add(this._config.connection.onDidAction(envelope => {
|
|
3580
4171
|
const action = envelope.action;
|
|
3581
4172
|
if (envelope.rejectionReason || envelope.channel !== opts.chatURI || action.type !== ActionType.ChatToolCallDelta || action.turnId !== opts.turnId || action.toolCallId !== toolCallId || IChatToolInvocation.isComplete(invocation)) {
|
|
@@ -3594,9 +4185,6 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3594
4185
|
const tc = part$.read(reader).toolCall;
|
|
3595
4186
|
const status = tc.status;
|
|
3596
4187
|
const priorStatus = previousStatus;
|
|
3597
|
-
if (status === ToolCallStatus.PendingConfirmation) {
|
|
3598
|
-
confirmationOptions = tc.options;
|
|
3599
|
-
}
|
|
3600
4188
|
const enteringConfirmation = status === ToolCallStatus.PendingConfirmation && previousStatus !== ToolCallStatus.PendingConfirmation;
|
|
3601
4189
|
previousStatus = status;
|
|
3602
4190
|
if (status === ToolCallStatus.Streaming) {
|
|
@@ -3613,13 +4201,14 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3613
4201
|
this._config.connection.resourceUris
|
|
3614
4202
|
);
|
|
3615
4203
|
invocation.requestConfirmation(prepared);
|
|
4204
|
+
this._signalToolConfirmation();
|
|
3616
4205
|
this._awaitToolConfirmation(
|
|
3617
4206
|
invocation,
|
|
3618
4207
|
toolCallId,
|
|
3619
4208
|
opts.backendSession,
|
|
3620
4209
|
opts.turnId,
|
|
3621
4210
|
opts.cancellationToken,
|
|
3622
|
-
|
|
4211
|
+
getPendingCall,
|
|
3623
4212
|
opts.chatURI
|
|
3624
4213
|
);
|
|
3625
4214
|
}
|
|
@@ -3642,9 +4231,9 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3642
4231
|
toolCallId,
|
|
3643
4232
|
result: {
|
|
3644
4233
|
success: false,
|
|
3645
|
-
pastTenseMessage: ( localize(
|
|
4234
|
+
pastTenseMessage: ( localize(11511, "Cancelled tool call")),
|
|
3646
4235
|
error: {
|
|
3647
|
-
message: ( localize(
|
|
4236
|
+
message: ( localize(11512, "MCP authentication was cancelled")),
|
|
3648
4237
|
code: "cancelled"
|
|
3649
4238
|
}
|
|
3650
4239
|
}
|
|
@@ -3653,11 +4242,12 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3653
4242
|
const showAuthentication = toolCall => invocation.setAuthenticationRequired(toolCallAuthenticationServer(
|
|
3654
4243
|
toolCall,
|
|
3655
4244
|
opts.sessionResource.authority,
|
|
4245
|
+
opts.backendSession,
|
|
3656
4246
|
this._toolAuthenticationServerName(toolCall, opts)
|
|
3657
4247
|
), onCancelAuthentication);
|
|
3658
4248
|
if (!silentAuthenticationAttempted) {
|
|
3659
4249
|
silentAuthenticationAttempted = true;
|
|
3660
|
-
const server = toolCallAuthenticationServer(tc, opts.sessionResource.authority);
|
|
4250
|
+
const server = toolCallAuthenticationServer(tc, opts.sessionResource.authority, opts.backendSession);
|
|
3661
4251
|
const serverName = this._customizationService.getMcpServers(opts.sessionResource).find(candidate => candidate.id === server.id)?.name ?? server.name;
|
|
3662
4252
|
this._autoAuthenticateMcpServer(opts.sessionResource, {
|
|
3663
4253
|
...server,
|
|
@@ -3745,7 +4335,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3745
4335
|
}
|
|
3746
4336
|
}
|
|
3747
4337
|
_toolAuthenticationServerName(tc, opts) {
|
|
3748
|
-
const id = toolCallAuthenticationServer(tc, opts.sessionResource.authority).id;
|
|
4338
|
+
const id = toolCallAuthenticationServer(tc, opts.sessionResource.authority, opts.backendSession).id;
|
|
3749
4339
|
const server = this._customizationService.getMcpServers(opts.sessionResource).find(candidate => candidate.id === id);
|
|
3750
4340
|
return server ? getMcpServerDisplayLabel(server) : undefined;
|
|
3751
4341
|
}
|
|
@@ -3763,22 +4353,32 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3763
4353
|
);
|
|
3764
4354
|
invocation.transitionFromStreaming(prepared, undefined, undefined);
|
|
3765
4355
|
}
|
|
3766
|
-
_createSubagentContext(
|
|
4356
|
+
_createSubagentContext(
|
|
4357
|
+
sessionState,
|
|
4358
|
+
store,
|
|
4359
|
+
snapshots = ( new Map())
|
|
4360
|
+
) {
|
|
3767
4361
|
return {
|
|
3768
4362
|
store,
|
|
3769
4363
|
toolCalls: ( new Map()),
|
|
3770
4364
|
observations: store.add(( new DisposableMap())),
|
|
4365
|
+
snapshots,
|
|
3771
4366
|
chats: derivedOpts({
|
|
3772
4367
|
equalsFn: equals
|
|
3773
4368
|
}, reader => sessionState.read(reader)?.chats.flatMap(chat => chat.origin?.kind === ChatOriginKind.Tool ? [{
|
|
3774
4369
|
resource: chat.resource,
|
|
3775
4370
|
parentChat: chat.origin.chat,
|
|
3776
4371
|
toolCallId: chat.origin.toolCallId,
|
|
3777
|
-
status: chat.status
|
|
4372
|
+
status: chat.status,
|
|
4373
|
+
modifiedAt: chat.modifiedAt
|
|
3778
4374
|
}] : []) ?? [])
|
|
3779
4375
|
};
|
|
3780
4376
|
}
|
|
3781
4377
|
_trackSubagentToolCall(toolCall, invocation, opts, context) {
|
|
4378
|
+
const snapshotTools = context.snapshots.get(opts.chatURI)?.toolCalls;
|
|
4379
|
+
if (snapshotTools && !( snapshotTools.has(toolCall.toolCallId))) {
|
|
4380
|
+
snapshotTools.set(toolCall.toolCallId, invocation);
|
|
4381
|
+
}
|
|
3782
4382
|
if (!canOwnSubagentChat(toolCall)) {
|
|
3783
4383
|
return;
|
|
3784
4384
|
}
|
|
@@ -3820,7 +4420,6 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3820
4420
|
if (!canOwnSubagentChat(toolCall)) {
|
|
3821
4421
|
return;
|
|
3822
4422
|
}
|
|
3823
|
-
const childChat = subagentContext.chats.read(reader).find(chat => chat.parentChat === opts.chatURI && chat.toolCallId === toolCallId);
|
|
3824
4423
|
const observation = subagentContext.observations.get(toolCallId);
|
|
3825
4424
|
const isObserved = !!observation;
|
|
3826
4425
|
const currentData = invocation.toolSpecificData?.kind === "subagent" ? invocation.toolSpecificData : undefined;
|
|
@@ -3836,9 +4435,17 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3836
4435
|
if (!protocolData) {
|
|
3837
4436
|
return;
|
|
3838
4437
|
}
|
|
3839
|
-
const
|
|
3840
|
-
const
|
|
3841
|
-
const
|
|
4438
|
+
const advertisedChatResource = readToolCallMeta(toolCall).subagentChatUri;
|
|
4439
|
+
const chats = subagentContext.chats.read(reader);
|
|
4440
|
+
const childChats = chats.filter(chat => chat.parentChat === opts.chatURI && chat.toolCallId === toolCallId);
|
|
4441
|
+
const childChat = advertisedChatResource === undefined ? childChats[0] : childChats.find(chat => chat.resource === advertisedChatResource);
|
|
4442
|
+
const chatResource = advertisedChatResource ?? childChat?.resource ?? protocolData.chatResource ?? currentData?.chatResource;
|
|
4443
|
+
const childChatUri = chatResource ?? this._getOlderHostSubagentChatUri(( opts.backendSession.toString()), toolCallId);
|
|
4444
|
+
const descendants = getSubagentChatDescendants(chats, childChatUri);
|
|
4445
|
+
const hasActiveDescendant = ( chats.some(chat => chat.resource !== childChatUri && ( descendants.has(chat.resource)) && !isSettledSubagentChat(chat.status)));
|
|
4446
|
+
const isSettled = !!childChat && isSettledSubagentChat(childChat.status);
|
|
4447
|
+
const isSettledDeferred = !observation && isSettled && !hasActiveDescendant;
|
|
4448
|
+
const isChatAvailable = observation ? observation.chatResource === childChatUri && observation.isChatAvailable : currentData?.isChatAvailable === true || isSettledDeferred;
|
|
3842
4449
|
const description = protocolData.description ?? currentData?.description;
|
|
3843
4450
|
const agentName = protocolData.agentName ?? currentData?.agentName;
|
|
3844
4451
|
const isPhase = protocolData.presentation === "phase";
|
|
@@ -3855,11 +4462,26 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3855
4462
|
};
|
|
3856
4463
|
invocation.notifyToolSpecificDataChanged();
|
|
3857
4464
|
}
|
|
3858
|
-
|
|
4465
|
+
if (isSettledDeferred && invocation.toolSpecificData?.kind === "subagent" && (invocation.toolSpecificData.hasStarted !== undefined || invocation.toolSpecificData.isActive !== false)) {
|
|
4466
|
+
markSettledSubagentOpenable(invocation.toolSpecificData);
|
|
4467
|
+
invocation.notifyToolSpecificDataChanged();
|
|
4468
|
+
}
|
|
4469
|
+
if (isSettledDeferred && childChat && invocation.toolSpecificData?.kind === "subagent" && !isPhase) {
|
|
4470
|
+
const presentation = this._subagentPresentation.get(childChat.resource);
|
|
4471
|
+
if (presentation?.modifiedAt === childChat.modifiedAt && (invocation.toolSpecificData.startedAt !== presentation.startedAt || invocation.toolSpecificData.duration !== presentation.duration || invocation.toolSpecificData.credits !== presentation.credits)) {
|
|
4472
|
+
invocation.toolSpecificData.startedAt = presentation.startedAt;
|
|
4473
|
+
invocation.toolSpecificData.duration = presentation.duration;
|
|
4474
|
+
invocation.toolSpecificData.credits = presentation.credits;
|
|
4475
|
+
invocation.notifyToolSpecificDataChanged();
|
|
4476
|
+
}
|
|
4477
|
+
}
|
|
4478
|
+
const hasUnsettledObservation = observation && ( [...descendants].some(resource => ( [...(this._subagentObservationsByChat.get(resource) ?? [])].some(observer => observer.hasActiveTurn.read(reader)))));
|
|
4479
|
+
const needsSnapshotReconciliation = !observation && !!opts.subagentSnapshot && !opts.subagentSnapshot.waitForActivity && childChatUri !== undefined && !( subagentContext.snapshots.has(childChatUri));
|
|
4480
|
+
const shouldObserve = (!isSettled || hasActiveDescendant || hasUnsettledObservation || needsSnapshotReconciliation) && shouldObserveSubagentChat(toolCall, !!childChat) && (!opts.subagentSnapshot?.waitForActivity || isObserved || hasActiveDescendant || !!(childChat && (childChat.status & SessionStatus.InProgress)));
|
|
3859
4481
|
if (observation && (observation.chatResource !== childChatUri || !shouldObserve)) {
|
|
3860
4482
|
subagentContext.observations.deleteAndDispose(toolCallId);
|
|
3861
4483
|
}
|
|
3862
|
-
if (( subagentContext.observations.has(toolCallId))) {
|
|
4484
|
+
if (childChatUri === undefined || ( subagentContext.observations.has(toolCallId))) {
|
|
3863
4485
|
return;
|
|
3864
4486
|
}
|
|
3865
4487
|
if (!shouldObserve) {
|
|
@@ -3912,6 +4534,9 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3912
4534
|
perInvocationModel,
|
|
3913
4535
|
opts.subagentSnapshot?.toolCalls
|
|
3914
4536
|
);
|
|
4537
|
+
if (!observationStore.isDisposed) {
|
|
4538
|
+
observationStore.hasActiveTurn.read(reader);
|
|
4539
|
+
}
|
|
3915
4540
|
}
|
|
3916
4541
|
_setupClientToolCall(initial, part$, store, opts, subagentContext, renderedBySnapshot = false) {
|
|
3917
4542
|
const toolCallId = initial.toolCallId;
|
|
@@ -3924,7 +4549,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3924
4549
|
if (adopted && !IChatToolInvocation.isComplete(adopted)) {
|
|
3925
4550
|
adopted.didExecuteTool(undefined);
|
|
3926
4551
|
}
|
|
3927
|
-
const toolData = this._resolveClientTool(toolName);
|
|
4552
|
+
const toolData = this._resolveClientTool(toolName, opts.backendSession, opts.sessionResource);
|
|
3928
4553
|
if (!toolData) {
|
|
3929
4554
|
this._logService.warn(`[AgentHost] Client tool call for unknown tool: ${toolName}`);
|
|
3930
4555
|
this._dispatchAction(opts.backendSession, {
|
|
@@ -3941,11 +4566,15 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
3941
4566
|
}, opts.chatURI);
|
|
3942
4567
|
return;
|
|
3943
4568
|
}
|
|
4569
|
+
const {
|
|
4570
|
+
toolSessionResource
|
|
4571
|
+
} = this._getClientToolOwner(opts.backendSession, opts.sessionResource);
|
|
3944
4572
|
const invocation = this._ensureClientToolInvocation(
|
|
3945
4573
|
opts.chatURI,
|
|
3946
4574
|
opts.turnId,
|
|
3947
4575
|
toolCallId,
|
|
3948
4576
|
toolData.id,
|
|
4577
|
+
toolSessionResource,
|
|
3949
4578
|
opts.subAgentInvocationId
|
|
3950
4579
|
);
|
|
3951
4580
|
if (!invocation) {
|
|
@@ -4064,11 +4693,21 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4064
4693
|
store.add(
|
|
4065
4694
|
this._markInputRequestRendered(opts.chatURI, inputReq.id, opts.sessionResource)
|
|
4066
4695
|
);
|
|
4067
|
-
const planReview = inputReq
|
|
4696
|
+
const planReview = readAgentPlanReview(inputReq);
|
|
4068
4697
|
if (planReview) {
|
|
4069
4698
|
this._setupPlanReviewInputRequest(part$, planReview, store, opts);
|
|
4070
4699
|
return;
|
|
4071
4700
|
}
|
|
4701
|
+
const computerUseSetup = this._config.supportsComputerUseSetup ? readComputerUseSetupCard(inputReq) : undefined;
|
|
4702
|
+
if (computerUseSetup) {
|
|
4703
|
+
this._setupComputerUseSetupCard(part$, computerUseSetup.setupId, store, opts);
|
|
4704
|
+
return;
|
|
4705
|
+
}
|
|
4706
|
+
const computerUseActivation = readComputerUseActivationCard(inputReq);
|
|
4707
|
+
if (computerUseActivation) {
|
|
4708
|
+
this._setupComputerUseActivationCard(part$, computerUseActivation, store, opts);
|
|
4709
|
+
return;
|
|
4710
|
+
}
|
|
4072
4711
|
if (inputReq.url) {
|
|
4073
4712
|
this._setupUrlInputRequest(part$, inputReq.url, store, opts);
|
|
4074
4713
|
return;
|
|
@@ -4149,10 +4788,15 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4149
4788
|
}
|
|
4150
4789
|
_setupPlanReviewInputRequest(part$, planReview, store, opts) {
|
|
4151
4790
|
const inputReq = part$.get().request;
|
|
4152
|
-
const review = createInputRequestPlanReview(
|
|
4791
|
+
const review = createInputRequestPlanReview(
|
|
4792
|
+
inputReq,
|
|
4793
|
+
planReview.review,
|
|
4794
|
+
this._config.connection.resourceUris,
|
|
4795
|
+
this._config.connectionAuthority
|
|
4796
|
+
);
|
|
4153
4797
|
opts.sink([review]);
|
|
4154
4798
|
let inputCompleted = false;
|
|
4155
|
-
let latestResult =
|
|
4799
|
+
let latestResult = planReview.fromInputCompletion(ChatInputResponseKind.Accept, inputReq.answers);
|
|
4156
4800
|
let planReviewCleared = false;
|
|
4157
4801
|
const clearPlanReview = () => {
|
|
4158
4802
|
if (planReviewCleared) {
|
|
@@ -4167,7 +4811,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4167
4811
|
return;
|
|
4168
4812
|
}
|
|
4169
4813
|
inputCompleted = true;
|
|
4170
|
-
latestResult =
|
|
4814
|
+
latestResult = planReview.fromInputCompletion(part.response, part.request.answers);
|
|
4171
4815
|
review.data = latestResult;
|
|
4172
4816
|
review.isUsed = true;
|
|
4173
4817
|
review.draftFeedback = undefined;
|
|
@@ -4179,7 +4823,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4179
4823
|
if (store.isDisposed || inputCompleted) {
|
|
4180
4824
|
return;
|
|
4181
4825
|
}
|
|
4182
|
-
const completion = result ?
|
|
4826
|
+
const completion = result ? planReview.toInputCompletion(result) : {
|
|
4183
4827
|
response: ChatInputResponseKind.Cancel
|
|
4184
4828
|
};
|
|
4185
4829
|
this._config.connection.dispatch(opts.chatURI, {
|
|
@@ -4209,6 +4853,121 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4209
4853
|
clearPlanReview();
|
|
4210
4854
|
}));
|
|
4211
4855
|
}
|
|
4856
|
+
_setupComputerUseSetupCard(part$, setupId, store, opts) {
|
|
4857
|
+
const requestId = part$.get().request.id;
|
|
4858
|
+
let completed = false;
|
|
4859
|
+
const settle = response => {
|
|
4860
|
+
if (completed) {
|
|
4861
|
+
return;
|
|
4862
|
+
}
|
|
4863
|
+
completed = true;
|
|
4864
|
+
this._config.connection.dispatch(opts.chatURI, {
|
|
4865
|
+
type: ActionType.ChatInputCompleted,
|
|
4866
|
+
requestId,
|
|
4867
|
+
response
|
|
4868
|
+
});
|
|
4869
|
+
};
|
|
4870
|
+
const {
|
|
4871
|
+
title,
|
|
4872
|
+
message
|
|
4873
|
+
} = getComputerUseSetupCardText();
|
|
4874
|
+
const card = ( new ChatElicitationRequestPart(title, ( new MarkdownString(message)), "", ( localize(11513, "Set Up Computer Use")), ( localize(11514, "Cancel")), async () => {
|
|
4875
|
+
this._computerUseSetupService.open(setupId);
|
|
4876
|
+
return ElicitationState.Pending;
|
|
4877
|
+
}, async () => {
|
|
4878
|
+
settle(ChatInputResponseKind.Decline);
|
|
4879
|
+
return ElicitationState.Rejected;
|
|
4880
|
+
}));
|
|
4881
|
+
card.keepActionsWhilePending = true;
|
|
4882
|
+
opts.sink([card]);
|
|
4883
|
+
store.add(autorun(reader => {
|
|
4884
|
+
const response = part$.read(reader).response;
|
|
4885
|
+
if (response !== undefined) {
|
|
4886
|
+
completed = true;
|
|
4887
|
+
card.state.set(
|
|
4888
|
+
response === ChatInputResponseKind.Accept ? ElicitationState.Accepted : ElicitationState.Rejected,
|
|
4889
|
+
undefined
|
|
4890
|
+
);
|
|
4891
|
+
}
|
|
4892
|
+
}));
|
|
4893
|
+
const reject = () => {
|
|
4894
|
+
if (card.state.get() === ElicitationState.Pending) {
|
|
4895
|
+
card.state.set(ElicitationState.Rejected, undefined);
|
|
4896
|
+
}
|
|
4897
|
+
};
|
|
4898
|
+
const cancel = () => {
|
|
4899
|
+
settle(ChatInputResponseKind.Cancel);
|
|
4900
|
+
reject();
|
|
4901
|
+
};
|
|
4902
|
+
if (opts.cancellationToken.isCancellationRequested) {
|
|
4903
|
+
cancel();
|
|
4904
|
+
} else {
|
|
4905
|
+
store.add(opts.cancellationToken.onCancellationRequested(cancel));
|
|
4906
|
+
}
|
|
4907
|
+
store.add(toDisposable(reject));
|
|
4908
|
+
}
|
|
4909
|
+
_setupComputerUseActivationCard(
|
|
4910
|
+
part$,
|
|
4911
|
+
{
|
|
4912
|
+
reason
|
|
4913
|
+
},
|
|
4914
|
+
store,
|
|
4915
|
+
opts
|
|
4916
|
+
) {
|
|
4917
|
+
const requestId = part$.get().request.id;
|
|
4918
|
+
let completed = false;
|
|
4919
|
+
const settle = (response, answers) => {
|
|
4920
|
+
if (completed) {
|
|
4921
|
+
return;
|
|
4922
|
+
}
|
|
4923
|
+
completed = true;
|
|
4924
|
+
this._config.connection.dispatch(opts.chatURI, {
|
|
4925
|
+
type: ActionType.ChatInputCompleted,
|
|
4926
|
+
requestId,
|
|
4927
|
+
response,
|
|
4928
|
+
...(answers ? {
|
|
4929
|
+
answers
|
|
4930
|
+
} : {})
|
|
4931
|
+
});
|
|
4932
|
+
};
|
|
4933
|
+
const {
|
|
4934
|
+
title,
|
|
4935
|
+
message
|
|
4936
|
+
} = getComputerUseActivationCardText(reason);
|
|
4937
|
+
const card = ( new ChatElicitationRequestPart(title, ( new MarkdownString(message)), "", ( localize(11515, "Turn On")), ( localize(11516, "Not Now")), async () => {
|
|
4938
|
+
settle(ChatInputResponseKind.Accept, getComputerUseActivationAnswers("turnOn"));
|
|
4939
|
+
return ElicitationState.Accepted;
|
|
4940
|
+
}, async () => {
|
|
4941
|
+
settle(ChatInputResponseKind.Decline);
|
|
4942
|
+
return ElicitationState.Rejected;
|
|
4943
|
+
}));
|
|
4944
|
+
opts.sink([card]);
|
|
4945
|
+
store.add(autorun(reader => {
|
|
4946
|
+
const part = part$.read(reader);
|
|
4947
|
+
if (part.response !== undefined) {
|
|
4948
|
+
completed = true;
|
|
4949
|
+
card.state.set(
|
|
4950
|
+
isComputerUseActivationAccepted(part.response, part.request.answers) ? ElicitationState.Accepted : ElicitationState.Rejected,
|
|
4951
|
+
undefined
|
|
4952
|
+
);
|
|
4953
|
+
}
|
|
4954
|
+
}));
|
|
4955
|
+
const reject = () => {
|
|
4956
|
+
if (card.state.get() === ElicitationState.Pending) {
|
|
4957
|
+
card.state.set(ElicitationState.Rejected, undefined);
|
|
4958
|
+
}
|
|
4959
|
+
};
|
|
4960
|
+
const cancel = () => {
|
|
4961
|
+
settle(ChatInputResponseKind.Cancel);
|
|
4962
|
+
reject();
|
|
4963
|
+
};
|
|
4964
|
+
if (opts.cancellationToken.isCancellationRequested) {
|
|
4965
|
+
cancel();
|
|
4966
|
+
} else {
|
|
4967
|
+
store.add(opts.cancellationToken.onCancellationRequested(cancel));
|
|
4968
|
+
}
|
|
4969
|
+
store.add(toDisposable(reject));
|
|
4970
|
+
}
|
|
4212
4971
|
_setupUrlInputRequest(responsePart$, url, store, opts) {
|
|
4213
4972
|
const inputReq = responsePart$.get().request;
|
|
4214
4973
|
let completionDispatched = false;
|
|
@@ -4225,7 +4984,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4225
4984
|
});
|
|
4226
4985
|
};
|
|
4227
4986
|
const presentation = getUrlInputRequestPresentation(inputReq, url);
|
|
4228
|
-
const part = ( new ChatElicitationRequestPart(( localize(
|
|
4987
|
+
const part = ( new ChatElicitationRequestPart(( localize(11517, "Authorization Required")), presentation.message, "", ( localize(11518, "Open {0}", presentation.authority)), ( localize(11519, "Cancel")), async () => {
|
|
4229
4988
|
try {
|
|
4230
4989
|
const opened = await this._openerService.open(url, {
|
|
4231
4990
|
allowCommands: false
|
|
@@ -4272,6 +5031,24 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4272
5031
|
part.hide();
|
|
4273
5032
|
}));
|
|
4274
5033
|
}
|
|
5034
|
+
_releaseOutputTerminal(attachment, toolCall, sessionResource) {
|
|
5035
|
+
const live = attachment.disposable.clearAndLeak();
|
|
5036
|
+
attachment.disposable.dispose();
|
|
5037
|
+
if (!live) {
|
|
5038
|
+
return;
|
|
5039
|
+
}
|
|
5040
|
+
const source = attachment.source;
|
|
5041
|
+
if (toolCall.status !== ToolCallStatus.Completed || !source || source.hasExited || this._store.isDisposed || !( this._activeSessions.has(sessionResource))) {
|
|
5042
|
+
live.dispose();
|
|
5043
|
+
return;
|
|
5044
|
+
}
|
|
5045
|
+
let retained = this._retainedOutputTerminals.get(sessionResource);
|
|
5046
|
+
if (!retained) {
|
|
5047
|
+
retained = ( new DisposableStore());
|
|
5048
|
+
this._retainedOutputTerminals.set(sessionResource, retained);
|
|
5049
|
+
}
|
|
5050
|
+
retained.add(live);
|
|
5051
|
+
}
|
|
4275
5052
|
_reviveTerminalIfNeeded(invocation, tc, backendSession, chatURI, outputTerminalAttachment) {
|
|
4276
5053
|
if (tc.status !== ToolCallStatus.Running && tc.status !== ToolCallStatus.Completed && tc.status !== ToolCallStatus.PendingResultConfirmation) {
|
|
4277
5054
|
return;
|
|
@@ -4292,9 +5069,11 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4292
5069
|
if (hasSettledNonPtySnapshot) {
|
|
4293
5070
|
outputTerminalAttachment.disposable.clear();
|
|
4294
5071
|
outputTerminalAttachment.sessionId = undefined;
|
|
5072
|
+
outputTerminalAttachment.source = undefined;
|
|
4295
5073
|
} else if (!isPty && outputTerminalAttachment.sessionId !== sessionId) {
|
|
4296
5074
|
outputTerminalAttachment.disposable.value = this._agentHostTerminalService.attachOutputTerminal(this._config.connection, terminalCommandUri, sessionId);
|
|
4297
5075
|
outputTerminalAttachment.sessionId = sessionId;
|
|
5076
|
+
outputTerminalAttachment.source = this._terminalChatService.getOutputSource(sessionId);
|
|
4298
5077
|
}
|
|
4299
5078
|
const existing = invocation.toolSpecificData?.kind === "terminal" ? invocation.toolSpecificData : undefined;
|
|
4300
5079
|
const identityChanged = !!existing && (existing.commandLine.original !== toolInput || existing.terminalToolSessionId !== sessionId || existing.terminalCommandUri?.toString() !== ( terminalCommandUri.toString()));
|
|
@@ -4341,6 +5120,14 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4341
5120
|
}
|
|
4342
5121
|
}, error => this._logService.error(`[AgentHost] Failed to revive terminal '${terminalUri}'`, error));
|
|
4343
5122
|
}
|
|
5123
|
+
_getOlderHostSubagentChatUri(session, toolCallId) {
|
|
5124
|
+
return getOlderHostSubagentChatUri(
|
|
5125
|
+
session,
|
|
5126
|
+
toolCallId,
|
|
5127
|
+
this._config.connection.initializeResult.get(),
|
|
5128
|
+
this._getRootState()
|
|
5129
|
+
);
|
|
5130
|
+
}
|
|
4344
5131
|
async _enrichHistoryWithSubagentCalls(history, parentSession, sessionResource, sessionState, observations) {
|
|
4345
5132
|
const parentSessionStr = ( parentSession.toString());
|
|
4346
5133
|
const parentChatUri = this._getChatURI(sessionResource);
|
|
@@ -4380,18 +5167,13 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4380
5167
|
};
|
|
4381
5168
|
}
|
|
4382
5169
|
if (part.toolSpecificData?.kind === "subagent" && (subagentChat || !parentToolCall || shouldObserveSubagentChat(parentToolCall))) {
|
|
4383
|
-
const childChatUri =
|
|
4384
|
-
|
|
4385
|
-
part.
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
);
|
|
4389
|
-
part.toolSpecificData.chatResource = childChatUri;
|
|
4390
|
-
const waitForActivity = !!subagentChat && (subagentChat.status & (SessionStatus.Idle | SessionStatus.Error)) !== 0 && (subagentChat.status & SessionStatus.InProgress) === 0;
|
|
5170
|
+
const childChatUri = subagentChat?.resource.toString() ?? this._getOlderHostSubagentChatUri(parentSessionStr, part.toolCallId);
|
|
5171
|
+
if (childChatUri !== undefined) {
|
|
5172
|
+
part.toolSpecificData.chatResource = childChatUri;
|
|
5173
|
+
}
|
|
5174
|
+
const waitForActivity = !!subagentChat && isSettledSubagentChat(subagentChat.status);
|
|
4391
5175
|
if (waitForActivity) {
|
|
4392
|
-
part.toolSpecificData
|
|
4393
|
-
part.toolSpecificData.isActive = false;
|
|
4394
|
-
delete part.toolSpecificData.hasStarted;
|
|
5176
|
+
markSettledSubagentOpenable(part.toolSpecificData);
|
|
4395
5177
|
if (!parentToolCall || !requestId) {
|
|
4396
5178
|
continue;
|
|
4397
5179
|
}
|
|
@@ -4426,13 +5208,14 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4426
5208
|
item,
|
|
4427
5209
|
index,
|
|
4428
5210
|
toolCallId,
|
|
4429
|
-
childChatUri,
|
|
5211
|
+
childChatUri: knownChatUri,
|
|
4430
5212
|
requestId,
|
|
4431
5213
|
waitForActivity
|
|
4432
5214
|
}
|
|
4433
5215
|
) => {
|
|
4434
5216
|
const parentPart = item.parts[index];
|
|
4435
5217
|
const parentToolCall = parentToolCalls.get(toolCallId);
|
|
5218
|
+
let observedState;
|
|
4436
5219
|
if (waitForActivity) {
|
|
4437
5220
|
return {
|
|
4438
5221
|
item,
|
|
@@ -4441,19 +5224,40 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4441
5224
|
parentPart,
|
|
4442
5225
|
parentToolCall,
|
|
4443
5226
|
requestId,
|
|
4444
|
-
waitForActivity
|
|
5227
|
+
waitForActivity,
|
|
5228
|
+
observedState
|
|
5229
|
+
};
|
|
5230
|
+
}
|
|
5231
|
+
const childChatUri = knownChatUri;
|
|
5232
|
+
if (childChatUri === undefined) {
|
|
5233
|
+
this._logService.trace(
|
|
5234
|
+
`[AgentHost] Deferred history enrichment for subagent call ${toolCallId} until the host registers its chat`
|
|
5235
|
+
);
|
|
5236
|
+
return {
|
|
5237
|
+
item,
|
|
5238
|
+
index,
|
|
5239
|
+
innerParts: [],
|
|
5240
|
+
parentPart,
|
|
5241
|
+
parentToolCall,
|
|
5242
|
+
requestId,
|
|
5243
|
+
waitForActivity: true,
|
|
5244
|
+
observedState
|
|
4445
5245
|
};
|
|
4446
5246
|
}
|
|
5247
|
+
if (parentPart.kind === "toolInvocationSerialized" && parentPart.toolSpecificData?.kind === "subagent") {
|
|
5248
|
+
parentPart.toolSpecificData.chatResource = childChatUri;
|
|
5249
|
+
}
|
|
4447
5250
|
try {
|
|
4448
|
-
|
|
5251
|
+
observedState = await getChildState(childChatUri);
|
|
4449
5252
|
const childState = observedState?.getState();
|
|
4450
5253
|
if (childState) {
|
|
4451
5254
|
this._applySubagentUsageToHistoryPart(parentPart, sessionResource, childState);
|
|
4452
5255
|
}
|
|
4453
5256
|
const innerParts = childState ? this._getSubagentInnerParts(childChatUri, toolCallId, childState) : [];
|
|
4454
5257
|
if (observedState && childState && (!parentToolCall || !requestId) && ( innerParts.some(part => part instanceof ChatToolInvocation))) {
|
|
4455
|
-
|
|
4456
|
-
|
|
5258
|
+
const retainedState = observedState;
|
|
5259
|
+
observations.add(retainedState.onDidChange(() => {
|
|
5260
|
+
const latestState = retainedState.getState();
|
|
4457
5261
|
if (latestState) {
|
|
4458
5262
|
this._refreshRestoredSubagentParts(parentPart, innerParts, sessionResource, childChatUri, latestState);
|
|
4459
5263
|
}
|
|
@@ -4466,7 +5270,8 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4466
5270
|
parentPart,
|
|
4467
5271
|
parentToolCall,
|
|
4468
5272
|
requestId,
|
|
4469
|
-
waitForActivity
|
|
5273
|
+
waitForActivity,
|
|
5274
|
+
observedState
|
|
4470
5275
|
};
|
|
4471
5276
|
} catch (err) {
|
|
4472
5277
|
this._logService.warn(
|
|
@@ -4480,7 +5285,8 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4480
5285
|
parentPart,
|
|
4481
5286
|
parentToolCall,
|
|
4482
5287
|
requestId,
|
|
4483
|
-
waitForActivity
|
|
5288
|
+
waitForActivity,
|
|
5289
|
+
observedState
|
|
4484
5290
|
};
|
|
4485
5291
|
}
|
|
4486
5292
|
}));
|
|
@@ -4500,7 +5306,8 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4500
5306
|
parentToolCall,
|
|
4501
5307
|
requestId,
|
|
4502
5308
|
innerParts,
|
|
4503
|
-
waitForActivity
|
|
5309
|
+
waitForActivity,
|
|
5310
|
+
observedState
|
|
4504
5311
|
} of enrichedInsertions) {
|
|
4505
5312
|
if (!parentToolCall || !requestId || (parentPart.kind !== "toolInvocation" && parentPart.kind !== "toolInvocationSerialized") || parentPart.toolSpecificData?.kind !== "subagent") {
|
|
4506
5313
|
continue;
|
|
@@ -4550,7 +5357,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4550
5357
|
invocation.toolSpecificData = parentPart.toolSpecificData;
|
|
4551
5358
|
invocation.presentation = parentPart.presentation;
|
|
4552
5359
|
const index = ( item.parts.indexOf(parentPart));
|
|
4553
|
-
if (isUnstartedSubagent(parentPart)) {
|
|
5360
|
+
if (isUnstartedSubagent(parentPart) && parentPart.toolSpecificData?.kind === "subagent" && parentPart.toolSpecificData.chatResource !== undefined) {
|
|
4554
5361
|
item.parts.splice(index, 1);
|
|
4555
5362
|
observation.publisher.publish([invocation]);
|
|
4556
5363
|
} else {
|
|
@@ -4569,10 +5376,15 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4569
5376
|
waitForActivity
|
|
4570
5377
|
}
|
|
4571
5378
|
}, observation.context);
|
|
5379
|
+
if (observedState) {
|
|
5380
|
+
observations.delete(observedState);
|
|
5381
|
+
}
|
|
4572
5382
|
}
|
|
4573
5383
|
}
|
|
4574
5384
|
async _loadSubagentState(parentSessionUri, childChatUri) {
|
|
4575
5385
|
const childSub = this._ensureSessionSubscription(parentSessionUri);
|
|
5386
|
+
const store = ( new DisposableStore());
|
|
5387
|
+
store.add(this._retainSubagentChatSubscription(parentSessionUri, childChatUri));
|
|
4576
5388
|
try {
|
|
4577
5389
|
await this._whenSubscriptionHydrated(childSub, CancellationToken.None);
|
|
4578
5390
|
if (childSub.value instanceof Error) {
|
|
@@ -4583,20 +5395,16 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4583
5395
|
if (childChatSub.value instanceof Error) {
|
|
4584
5396
|
throw childChatSub.value;
|
|
4585
5397
|
}
|
|
4586
|
-
const store = ( new DisposableStore());
|
|
4587
5398
|
const onDidChange = store.add(( new Emitter()));
|
|
4588
5399
|
store.add(childSub.onDidChange(() => onDidChange.fire()));
|
|
4589
5400
|
store.add(childChatSub.onDidChange(() => onDidChange.fire()));
|
|
4590
|
-
store.add(toDisposable(
|
|
4591
|
-
() => this._releaseChatSessionSubscriptions(parentSessionUri, childChatUri)
|
|
4592
|
-
));
|
|
4593
5401
|
return {
|
|
4594
5402
|
onDidChange: onDidChange.event,
|
|
4595
5403
|
getState: () => this._getSessionState(parentSessionUri, childChatUri),
|
|
4596
5404
|
dispose: () => store.dispose()
|
|
4597
5405
|
};
|
|
4598
5406
|
} catch (error) {
|
|
4599
|
-
|
|
5407
|
+
store.dispose();
|
|
4600
5408
|
throw error;
|
|
4601
5409
|
}
|
|
4602
5410
|
}
|
|
@@ -4729,6 +5537,16 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4729
5537
|
snapshotToolCalls
|
|
4730
5538
|
) {
|
|
4731
5539
|
const parentSessionUri = ( parentSession.toString());
|
|
5540
|
+
const observers = this._subagentObservationsByChat.get(childChatUri) ?? ( new Set());
|
|
5541
|
+
this._subagentObservationsByChat.set(childChatUri, observers);
|
|
5542
|
+
observers.add(disposables);
|
|
5543
|
+
disposables.add(toDisposable(() => {
|
|
5544
|
+
observers.delete(disposables);
|
|
5545
|
+
if (observers.size === 0) {
|
|
5546
|
+
this._subagentObservationsByChat.delete(childChatUri);
|
|
5547
|
+
}
|
|
5548
|
+
disposables.hasActiveTurn.set(false, undefined);
|
|
5549
|
+
}));
|
|
4732
5550
|
const cts = ( new CancellationTokenSource());
|
|
4733
5551
|
disposables.add(toDisposable(() => cts.dispose(true)));
|
|
4734
5552
|
disposables.add(toDisposable(() => {
|
|
@@ -4751,16 +5569,22 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4751
5569
|
data.duration = Math.max(0, Date.now() - data.startedAt);
|
|
4752
5570
|
}
|
|
4753
5571
|
}
|
|
5572
|
+
for (const resource of getSubagentChatDescendants(subagentContext.chats.read(undefined), childChatUri)) {
|
|
5573
|
+
const snapshot = subagentContext.snapshots.get(resource);
|
|
5574
|
+
for (const [toolCallId, part] of snapshot?.toolCalls ?? []) {
|
|
5575
|
+
if (part instanceof ChatToolInvocation && !IChatToolInvocation.isComplete(part)) {
|
|
5576
|
+
snapshot?.toolCalls.delete(toolCallId);
|
|
5577
|
+
}
|
|
5578
|
+
}
|
|
5579
|
+
}
|
|
4754
5580
|
subagentContext.observations.deleteAndDispose(parentToolCallId);
|
|
4755
5581
|
parentInvocation.notifyToolSpecificDataChanged();
|
|
4756
5582
|
this._logService.warn(`[AgentHost] Failed to subscribe to subagent chat: ${childChatUri}`, error);
|
|
4757
5583
|
};
|
|
4758
5584
|
try {
|
|
4759
5585
|
const childSub = this._ensureSessionSubscription(parentSessionUri);
|
|
5586
|
+
disposables.add(this._retainSubagentChatSubscription(parentSessionUri, childChatUri));
|
|
4760
5587
|
const childChatSub = this._ensureChatSubscription(parentSessionUri, childChatUri);
|
|
4761
|
-
disposables.add(toDisposable(
|
|
4762
|
-
() => this._releaseChatSessionSubscriptions(parentSessionUri, childChatUri)
|
|
4763
|
-
));
|
|
4764
5588
|
if (childChatSub.onDidError) {
|
|
4765
5589
|
disposables.add(childChatSub.onDidError(onSubscriptionError));
|
|
4766
5590
|
}
|
|
@@ -4798,6 +5622,19 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4798
5622
|
const lastResponsePart = state.activeTurn?.responseParts.at(-1);
|
|
4799
5623
|
const activity = lastResponsePart?.kind === ResponsePartKind.Markdown ? "markdown" : lastResponsePart?.kind === ResponsePartKind.Reasoning ? "reasoning" : undefined;
|
|
4800
5624
|
const fallbackDuration = !isActive && timing.duration === undefined && parentInvocation.toolSpecificData.isActive && parentInvocation.toolSpecificData.startedAt !== undefined ? Date.now() - parentInvocation.toolSpecificData.startedAt : timing.duration;
|
|
5625
|
+
const catalogChat = state.chats.find(chat => chat.resource === childChatUri);
|
|
5626
|
+
const credits = perInvocationCreditsAccumulator.read(reader);
|
|
5627
|
+
const hasTiming = timing.startedAt !== undefined && fallbackDuration !== undefined;
|
|
5628
|
+
if (isActive) {
|
|
5629
|
+
this._subagentPresentation.delete(childChatUri);
|
|
5630
|
+
} else if (catalogChat && (hasTiming || credits > 0)) {
|
|
5631
|
+
this._subagentPresentation.set(childChatUri, {
|
|
5632
|
+
modifiedAt: catalogChat.modifiedAt,
|
|
5633
|
+
startedAt: hasTiming ? timing.startedAt : undefined,
|
|
5634
|
+
duration: hasTiming ? fallbackDuration : undefined,
|
|
5635
|
+
credits: credits > 0 ? credits : undefined
|
|
5636
|
+
});
|
|
5637
|
+
}
|
|
4801
5638
|
if (!parentInvocation.toolSpecificData.hasStarted || parentInvocation.toolSpecificData.isActive !== isActive || parentInvocation.toolSpecificData.activity !== activity || parentInvocation.toolSpecificData.startedAt !== timing.startedAt || parentInvocation.toolSpecificData.duration !== fallbackDuration) {
|
|
4802
5639
|
parentInvocation.toolSpecificData.hasStarted = true;
|
|
4803
5640
|
parentInvocation.toolSpecificData.isActive = isActive;
|
|
@@ -4828,7 +5665,16 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4828
5665
|
}
|
|
4829
5666
|
return ids;
|
|
4830
5667
|
});
|
|
4831
|
-
|
|
5668
|
+
let snapshot = subagentContext.snapshots.get(childChatUri);
|
|
5669
|
+
const restoredTurnIds = snapshot ? ( new Set(snapshot.completedTurnIds)) : snapshotToolCalls ? ( new Set(childState$.get()?.turns.map(turn => turn.id))) : undefined;
|
|
5670
|
+
if (!snapshot) {
|
|
5671
|
+
snapshot = {
|
|
5672
|
+
toolCalls: ( new Map(snapshotToolCalls)),
|
|
5673
|
+
completedTurnIds: ( new Set(restoredTurnIds))
|
|
5674
|
+
};
|
|
5675
|
+
subagentContext.snapshots.set(childChatUri, snapshot);
|
|
5676
|
+
}
|
|
5677
|
+
const retainedSnapshot = snapshot;
|
|
4832
5678
|
disposables.add(
|
|
4833
5679
|
autorunPerKeyedItem(childTurnIds$, t => t.id, (turnId, _t$, turnStore) => {
|
|
4834
5680
|
turnStore.add(this._observeTurn({
|
|
@@ -4840,13 +5686,32 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4840
5686
|
cancellationToken: cts.token,
|
|
4841
5687
|
subAgentInvocationId: rootInvocationId,
|
|
4842
5688
|
subagentStore: disposables,
|
|
5689
|
+
subagentSnapshots: subagentContext.snapshots,
|
|
4843
5690
|
subAgentCreditsAccumulator: perInvocationCreditsAccumulator,
|
|
4844
5691
|
subAgentModelObservable: perInvocationModel,
|
|
4845
|
-
snapshotToolCalls,
|
|
5692
|
+
snapshotToolCalls: retainedSnapshot.toolCalls,
|
|
4846
5693
|
suppressErrorMarkdown: restoredTurnIds?.has(turnId)
|
|
4847
5694
|
}));
|
|
4848
5695
|
})
|
|
4849
5696
|
);
|
|
5697
|
+
disposables.add(autorun(reader => {
|
|
5698
|
+
const state = childState$.read(reader);
|
|
5699
|
+
const hasActiveTurn = !!state?.activeTurn;
|
|
5700
|
+
if (hasActiveTurn) {
|
|
5701
|
+
disposables.hasActiveTurn.set(true, undefined);
|
|
5702
|
+
}
|
|
5703
|
+
if (!hasActiveTurn && disposables.hasActiveTurn.read(undefined) || state?.turns.some(turn => !( retainedSnapshot.completedTurnIds.has(turn.id)))) {
|
|
5704
|
+
queueMicrotask(() => {
|
|
5705
|
+
if (!disposables.isDisposed) {
|
|
5706
|
+
const latest = childState$.read(undefined);
|
|
5707
|
+
for (const turn of latest?.turns ?? []) {
|
|
5708
|
+
retainedSnapshot.completedTurnIds.add(turn.id);
|
|
5709
|
+
}
|
|
5710
|
+
disposables.hasActiveTurn.set(!!latest?.activeTurn, undefined);
|
|
5711
|
+
}
|
|
5712
|
+
});
|
|
5713
|
+
}
|
|
5714
|
+
}));
|
|
4850
5715
|
} catch (err) {
|
|
4851
5716
|
onSubscriptionError(err);
|
|
4852
5717
|
}
|
|
@@ -4905,13 +5770,49 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4905
5770
|
chatSession.progressObs.set([...initialParts, ...initialBuffer.filter(part => !( initialSet.has(part)))], undefined);
|
|
4906
5771
|
initialBuffer = undefined;
|
|
4907
5772
|
}
|
|
5773
|
+
async _resolveTurnFileEdits(sessionResource, requestId) {
|
|
5774
|
+
const session = this._resolveSessionUri(sessionResource);
|
|
5775
|
+
const chat = this._getChatURIOrDefault(sessionResource, session);
|
|
5776
|
+
const sessionState = this._getRawSessionState(( session.toString()));
|
|
5777
|
+
if (!chat || !sessionState) {
|
|
5778
|
+
return undefined;
|
|
5779
|
+
}
|
|
5780
|
+
const chatState = chat === sessionState.defaultChat ? this._getDefaultChatState(( session.toString())) : this._getAdditionalChatState(chat);
|
|
5781
|
+
const resource = resolveTurnChangesetUri(session, ( URI.parse(chat)), sessionState, chatState?.changesets, requestId);
|
|
5782
|
+
if (!resource) {
|
|
5783
|
+
return undefined;
|
|
5784
|
+
}
|
|
5785
|
+
const reference = this._config.connection.getSubscription(StateComponents.Changeset, resource, "AgentHostSnapshotController");
|
|
5786
|
+
const cts = ( new CancellationTokenSource());
|
|
5787
|
+
const timeout = disposableTimeout(() => cts.cancel(), 30_000);
|
|
5788
|
+
try {
|
|
5789
|
+
await raceCancellationError(
|
|
5790
|
+
this._config.connection.refreshSubscription?.(resource) ?? Promise.resolve(),
|
|
5791
|
+
cts.token
|
|
5792
|
+
);
|
|
5793
|
+
const state = await waitForState(
|
|
5794
|
+
observableFromEvent(this, reference.object.onDidChange, () => reference.object.value),
|
|
5795
|
+
value => value !== undefined && !(value instanceof Error) && (value.status === ChangesetStatus.Ready || value.status === ChangesetStatus.Error),
|
|
5796
|
+
value => value instanceof Error ? value : undefined,
|
|
5797
|
+
cts.token
|
|
5798
|
+
);
|
|
5799
|
+
if (!state || state instanceof Error || state.status !== ChangesetStatus.Ready) {
|
|
5800
|
+
throw ( new Error(( localize(11520, "The turn's file changes could not be loaded."))));
|
|
5801
|
+
}
|
|
5802
|
+
return state.files.map(file => file.edit);
|
|
5803
|
+
} finally {
|
|
5804
|
+
timeout.dispose();
|
|
5805
|
+
cts.dispose();
|
|
5806
|
+
reference.dispose();
|
|
5807
|
+
}
|
|
5808
|
+
}
|
|
4908
5809
|
_ensureSnapshotController(sessionResource) {
|
|
4909
5810
|
const chatModel = this._chatService.getSession(sessionResource);
|
|
4910
5811
|
if (!chatModel) {
|
|
4911
5812
|
return undefined;
|
|
4912
5813
|
}
|
|
4913
5814
|
if (!chatModel.editingSession) {
|
|
4914
|
-
chatModel.startEditingSession();
|
|
5815
|
+
chatModel.startEditingSession(chatModel.initialLocation === ChatAgentLocation.Chat);
|
|
4915
5816
|
}
|
|
4916
5817
|
const editingSession = chatModel.editingSession;
|
|
4917
5818
|
if (!(editingSession instanceof AgentHostSnapshotController)) {
|
|
@@ -4945,6 +5846,11 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
4945
5846
|
const editParts = opts.subAgentInvocationId !== undefined ? completedToolCallToEditParts(toolCall, this._config.connectionAuthority, opts.subAgentInvocationId) : this._hydrateFileEdits(opts.sessionResource, opts.turnId, toolCall);
|
|
4946
5847
|
opts.sink(editParts);
|
|
4947
5848
|
}
|
|
5849
|
+
_shouldReviewEdits(chatSessionResource) {
|
|
5850
|
+
const session = this._resolveSessionUri(chatSessionResource);
|
|
5851
|
+
const chat = this._getChatURIOrDefault(chatSessionResource, session);
|
|
5852
|
+
return !this._isSubagentChat(( session.toString()), chat);
|
|
5853
|
+
}
|
|
4948
5854
|
_hydrateFileEdits(sessionResource, requestId, tc) {
|
|
4949
5855
|
const controller = this._ensureSnapshotController(sessionResource);
|
|
4950
5856
|
controller?.addToolCallEdits(requestId, tc);
|
|
@@ -5002,11 +5908,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5002
5908
|
if (identity?.backendSessionIsAdvertised) {
|
|
5003
5909
|
return identity.backendSession;
|
|
5004
5910
|
}
|
|
5005
|
-
const
|
|
5006
|
-
const parent = sessionResource.with({
|
|
5007
|
-
query,
|
|
5008
|
-
fragment: ""
|
|
5009
|
-
});
|
|
5911
|
+
const parent = getAgentHostSessionResource(sessionResource);
|
|
5010
5912
|
const parentIdentity = this._connectionsService.resolveSessionResourceIdentity(parent);
|
|
5011
5913
|
if (parentIdentity?.backendSessionIsAdvertised) {
|
|
5012
5914
|
return parentIdentity.backendSession;
|
|
@@ -5024,10 +5926,64 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5024
5926
|
}
|
|
5025
5927
|
return this._connectionsService.findSessionResource(legacy, authority) ? legacy : undefined;
|
|
5026
5928
|
}
|
|
5929
|
+
async _createSideChat(sessionResource, backendSession, turnId, token, selection) {
|
|
5930
|
+
if (token.isCancellationRequested) {
|
|
5931
|
+
throw ( new CancellationError());
|
|
5932
|
+
}
|
|
5933
|
+
const agent = this._getRootState()?.agents.find(agent => agent.provider === this._config.provider);
|
|
5934
|
+
if (!agent?.capabilities?.multipleChats?.sideChat) {
|
|
5935
|
+
throw ( new Error(`Provider ${this._config.provider} does not support side chats`));
|
|
5936
|
+
}
|
|
5937
|
+
const sessionUri = ( backendSession.toString());
|
|
5938
|
+
const rawState = this._getRawSessionState(sessionUri);
|
|
5939
|
+
if (!rawState) {
|
|
5940
|
+
throw ( new Error(`Cannot create side chat: session state is not hydrated for ${sessionUri}`));
|
|
5941
|
+
}
|
|
5942
|
+
const sourceChat = this._resolveChatUriFromState(sessionResource, rawState);
|
|
5943
|
+
const sourceState = this._getSessionState(sessionUri, sourceChat);
|
|
5944
|
+
if (sourceState?.activeTurn?.id !== turnId && !sourceState?.turns.some(turn => turn.id === turnId)) {
|
|
5945
|
+
throw ( new Error(`Cannot create side chat: turn ${turnId} not found`));
|
|
5946
|
+
}
|
|
5947
|
+
const chat = ( URI.parse(newAgentHostChatUri(
|
|
5948
|
+
sessionUri,
|
|
5949
|
+
rawState.defaultChat,
|
|
5950
|
+
this._config.connection.initializeResult.get()
|
|
5951
|
+
)));
|
|
5952
|
+
await this._config.connection.createChat(backendSession, chat, {
|
|
5953
|
+
model: lastTurnModelSelection(sourceState),
|
|
5954
|
+
sideChat: {
|
|
5955
|
+
source: ( URI.parse(sourceChat)),
|
|
5956
|
+
turnId,
|
|
5957
|
+
...(selection ? {
|
|
5958
|
+
selection
|
|
5959
|
+
} : {})
|
|
5960
|
+
}
|
|
5961
|
+
});
|
|
5962
|
+
const subscription = this._ensureSessionSubscription(sessionUri);
|
|
5963
|
+
const summary = await waitForState(
|
|
5964
|
+
observableFromSubscription(this, subscription).map(state => state?.chats.find(summary => summary.resource === ( chat.toString()))),
|
|
5965
|
+
summary => !!summary,
|
|
5966
|
+
undefined,
|
|
5967
|
+
token
|
|
5968
|
+
);
|
|
5969
|
+
const now = Date.now();
|
|
5970
|
+
return {
|
|
5971
|
+
resource: sessionResource.with({
|
|
5972
|
+
fragment: getAgentHostChatId(summary.resource)
|
|
5973
|
+
}),
|
|
5974
|
+
label: summary.title || ( localize(11521, "Side Chat")),
|
|
5975
|
+
iconPath: getAgentSessionProviderIcon(this._config.sessionType),
|
|
5976
|
+
timing: {
|
|
5977
|
+
created: now,
|
|
5978
|
+
lastRequestStarted: now,
|
|
5979
|
+
lastRequestEnded: now
|
|
5980
|
+
}
|
|
5981
|
+
};
|
|
5982
|
+
}
|
|
5027
5983
|
_isNewSessionResource(sessionResource) {
|
|
5028
5984
|
return !!this._config.isNewSession?.(sessionResource) || this._workingDirectoryResolver.isNewSession(sessionResource);
|
|
5029
5985
|
}
|
|
5030
|
-
async _forkSession(sessionResource, backendSession, request, token) {
|
|
5986
|
+
async _forkSession(sessionResource, backendSession, request, token, options) {
|
|
5031
5987
|
if (token.isCancellationRequested) {
|
|
5032
5988
|
throw ( new Error("Cancelled"));
|
|
5033
5989
|
}
|
|
@@ -5043,12 +5999,19 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5043
5999
|
const sourceChat = this._resolveChatUriFromState(sessionResource, rawSessionState);
|
|
5044
6000
|
const protocolState = this._getSessionState(sessionUri, sourceChat);
|
|
5045
6001
|
let turnIndex;
|
|
5046
|
-
|
|
5047
|
-
|
|
6002
|
+
const sourceRequestId = options?.sourceRequestId ?? request?.id;
|
|
6003
|
+
if (options?.sourceRequestId !== undefined && protocolState && protocolState.activeTurn?.id === sourceRequestId) {
|
|
6004
|
+
if (protocolState.turns.length) {
|
|
6005
|
+
turnIndex = protocolState.turns.length - 1;
|
|
6006
|
+
}
|
|
6007
|
+
} else if (sourceRequestId) {
|
|
6008
|
+
const requestIdx = protocolState?.turns.findIndex(t => t.id === sourceRequestId);
|
|
5048
6009
|
if (requestIdx === undefined || requestIdx < 0) {
|
|
5049
|
-
throw ( new Error(
|
|
6010
|
+
throw ( new Error(
|
|
6011
|
+
`Cannot fork: turn for request ${sourceRequestId} not found in protocol state`
|
|
6012
|
+
));
|
|
5050
6013
|
}
|
|
5051
|
-
turnIndex = requestIdx - 1;
|
|
6014
|
+
turnIndex = options?.sourceRequestId !== undefined ? requestIdx : requestIdx - 1;
|
|
5052
6015
|
if (turnIndex < 0) {
|
|
5053
6016
|
throw ( new Error("Cannot fork: cannot fork before the first request"));
|
|
5054
6017
|
}
|
|
@@ -5060,26 +6023,57 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5060
6023
|
}
|
|
5061
6024
|
const turnId = protocolState.turns[turnIndex].id;
|
|
5062
6025
|
const chatModel = this._chatService.getSession(sessionResource);
|
|
5063
|
-
const
|
|
5064
|
-
const forkedChat = ( URI.parse(
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
}
|
|
5071
|
-
});
|
|
5072
|
-
const sessionSubscription = this._ensureSessionSubscription(sessionUri);
|
|
5073
|
-
const forkedSummary = await waitForState(observableFromSubscription(this, sessionSubscription).map(
|
|
5074
|
-
state => state?.chats.find(summary => parseChatUri(summary.resource)?.chatId === forkedChatId)
|
|
5075
|
-
), summary => !!summary, undefined, token);
|
|
6026
|
+
const capturedInitialMessage = options?.initialMessage ? this._captureForkInitialMessage(sessionResource, protocolState, options.initialMessage) : undefined;
|
|
6027
|
+
const forkedChat = ( URI.parse(newAgentHostChatUri(
|
|
6028
|
+
sessionUri,
|
|
6029
|
+
rawSessionState.defaultChat,
|
|
6030
|
+
this._config.connection.initializeResult.get()
|
|
6031
|
+
)));
|
|
6032
|
+
const forkedChatId = getAgentHostChatId(( forkedChat.toString()));
|
|
5076
6033
|
const forkedResource = ( URI.from({
|
|
5077
6034
|
scheme: this._config.sessionType,
|
|
5078
6035
|
path: sessionResource.path,
|
|
5079
6036
|
fragment: forkedChatId
|
|
5080
6037
|
}));
|
|
6038
|
+
const initialMessage = capturedInitialMessage ? await this._prepareForkInitialMessage(sessionResource, backendSession, capturedInitialMessage, token) : undefined;
|
|
6039
|
+
try {
|
|
6040
|
+
await this._config.connection.createChat(backendSession, forkedChat, {
|
|
6041
|
+
model: lastTurnModelSelection(protocolState),
|
|
6042
|
+
fork: {
|
|
6043
|
+
source: ( URI.parse(sourceChat)),
|
|
6044
|
+
turnId
|
|
6045
|
+
},
|
|
6046
|
+
...(options?.title?.trim() ? {
|
|
6047
|
+
title: options.title
|
|
6048
|
+
} : {}),
|
|
6049
|
+
...(initialMessage ? {
|
|
6050
|
+
initialMessage
|
|
6051
|
+
} : {})
|
|
6052
|
+
});
|
|
6053
|
+
} catch (error) {
|
|
6054
|
+
const failedBeforeCreation = error instanceof ProtocolError && (error.code === AhpErrorCodes.AlreadyExists || error.code === JsonRpcErrorCodes.InvalidParams || error.code === AhpErrorCodes.SessionNotFound || error.code === AhpErrorCodes.ProviderNotFound);
|
|
6055
|
+
if (initialMessage && !failedBeforeCreation) {
|
|
6056
|
+
throw ( new ChatSessionForkError(forkedResource, error));
|
|
6057
|
+
}
|
|
6058
|
+
throw error;
|
|
6059
|
+
}
|
|
6060
|
+
let forkedSummary;
|
|
6061
|
+
try {
|
|
6062
|
+
const sessionSubscription = this._ensureSessionSubscription(sessionUri);
|
|
6063
|
+
forkedSummary = await waitForState(
|
|
6064
|
+
observableFromSubscription(this, sessionSubscription).map(state => state?.chats.find(summary => summary.resource === ( forkedChat.toString()))),
|
|
6065
|
+
summary => !!summary,
|
|
6066
|
+
undefined,
|
|
6067
|
+
token
|
|
6068
|
+
);
|
|
6069
|
+
} catch (error) {
|
|
6070
|
+
if (initialMessage) {
|
|
6071
|
+
throw ( new ChatSessionForkError(forkedResource, error));
|
|
6072
|
+
}
|
|
6073
|
+
throw error;
|
|
6074
|
+
}
|
|
5081
6075
|
const now = Date.now();
|
|
5082
|
-
const forkedLabel = forkedSummary.title || chatModel?.title || ( localize(
|
|
6076
|
+
const forkedLabel = forkedSummary.title || chatModel?.title || ( localize(11522, "Forked Session"));
|
|
5083
6077
|
return {
|
|
5084
6078
|
resource: forkedResource,
|
|
5085
6079
|
label: forkedLabel,
|
|
@@ -5091,15 +6085,43 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5091
6085
|
}
|
|
5092
6086
|
};
|
|
5093
6087
|
}
|
|
6088
|
+
async _prepareForkInitialMessage(sessionResource, backendSession, captured, token) {
|
|
6089
|
+
this._shellInitSynchronizer.reconcile(backendSession);
|
|
6090
|
+
await this._workingDirectorySynchronizer.reconcile(backendSession, token);
|
|
6091
|
+
if (this._isInvocationAbandoned(token)) {
|
|
6092
|
+
throw ( new CancellationError());
|
|
6093
|
+
}
|
|
6094
|
+
await this._ensureActiveClient(sessionResource, backendSession, token);
|
|
6095
|
+
if (this._isInvocationAbandoned(token)) {
|
|
6096
|
+
throw ( new CancellationError());
|
|
6097
|
+
}
|
|
6098
|
+
return captured;
|
|
6099
|
+
}
|
|
6100
|
+
_captureForkInitialMessage(sessionResource, sourceState, intent) {
|
|
6101
|
+
const attachments = this._convertVariablesToAttachments(
|
|
6102
|
+
getChatSessionInitialMessageVariables(intent),
|
|
6103
|
+
sessionResource,
|
|
6104
|
+
intent.text
|
|
6105
|
+
);
|
|
6106
|
+
const sourceMessage = sourceState?.activeTurn?.message ?? sourceState?.turns.at(-1)?.message;
|
|
6107
|
+
return {
|
|
6108
|
+
...requestMessage(intent.text, attachments, undefined, false),
|
|
6109
|
+
...(sourceMessage?.model ? {
|
|
6110
|
+
model: sourceMessage.model
|
|
6111
|
+
} : {}),
|
|
6112
|
+
...(sourceMessage?.agent ? {
|
|
6113
|
+
agent: sourceMessage.agent
|
|
6114
|
+
} : {})
|
|
6115
|
+
};
|
|
6116
|
+
}
|
|
5094
6117
|
async _ensureRequiredAuthentication(model) {
|
|
5095
6118
|
const agentInfo = this._getRootState()?.agents.find(a => a.provider === this._config.provider);
|
|
5096
6119
|
const protectedResources = agentInfo?.protectedResources ?? [];
|
|
5097
|
-
|
|
5098
|
-
if (modelRequiresAgentAuthentication(agentInfo, model, allowSignedOutWhenUsable) && this._config.resolveAuthentication) {
|
|
6120
|
+
if (modelRequiresAgentAuthentication(agentInfo, model) && this._config.resolveAuthentication) {
|
|
5099
6121
|
const authenticated = await this._config.resolveAuthentication(protectedResources);
|
|
5100
6122
|
if (!authenticated) {
|
|
5101
6123
|
throw ( new Error(( localize(
|
|
5102
|
-
|
|
6124
|
+
11523,
|
|
5103
6125
|
"Authentication is required to start a session. Please sign in and try again."
|
|
5104
6126
|
))));
|
|
5105
6127
|
}
|
|
@@ -5197,7 +6219,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5197
6219
|
});
|
|
5198
6220
|
} else {
|
|
5199
6221
|
throw ( new Error(( localize(
|
|
5200
|
-
|
|
6222
|
+
11523,
|
|
5201
6223
|
"Authentication is required to start a session. Please sign in and try again."
|
|
5202
6224
|
))));
|
|
5203
6225
|
}
|
|
@@ -5241,14 +6263,27 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5241
6263
|
if (chatModel) {
|
|
5242
6264
|
const store = ( new DisposableStore());
|
|
5243
6265
|
this._pendingMessageSubscriptions.set(sessionResource, store);
|
|
6266
|
+
store.add(toDisposable(() => this._localSteeringSubmissions.delete(sessionResource)));
|
|
6267
|
+
const chatURI = this._chatURIsBySessionResource.get(sessionResource);
|
|
6268
|
+
store.add(this._config.connection.onDidAction(envelope => {
|
|
6269
|
+
const action = envelope.action;
|
|
6270
|
+
if (envelope.channel === chatURI && envelope.origin?.clientId === this._config.connection.clientId && envelope.rejectionReason && action.type === ActionType.ChatPendingMessageSet && action.kind === PendingMessageKind.Steering && this._localSteeringSubmissions.get(sessionResource)?.delete(action.id)) {
|
|
6271
|
+
this._logService.warn(`[AgentHost] Steering message rejected: ${envelope.rejectionReason}`);
|
|
6272
|
+
this._applyRemotePendingMessages(sessionResource, backendSession);
|
|
6273
|
+
}
|
|
6274
|
+
}));
|
|
5244
6275
|
this._applyRemotePendingMessages(sessionResource, backendSession);
|
|
5245
6276
|
store.add(chatModel.onDidChangePendingRequests(() => {
|
|
5246
6277
|
this._syncPendingMessages(sessionResource, backendSession);
|
|
5247
6278
|
}));
|
|
5248
6279
|
this._syncPendingMessages(sessionResource, backendSession);
|
|
5249
6280
|
const sessionStr = ( backendSession.toString());
|
|
5250
|
-
const chatURI = this._chatURIsBySessionResource.get(sessionResource);
|
|
5251
6281
|
if (chatURI) {
|
|
6282
|
+
if (this._config.retainConsumedSteeringMessages) {
|
|
6283
|
+
const handoff = store.add(( new AgentHostSteeringMessageHandoff(chatModel, this._ensureChatSubscription(sessionStr, chatURI))));
|
|
6284
|
+
this._steeringMessageHandoffs.set(chatURI, handoff);
|
|
6285
|
+
store.add(toDisposable(() => this._steeringMessageHandoffs.delete(chatURI)));
|
|
6286
|
+
}
|
|
5252
6287
|
const onRemoteChange = () => this._applyRemotePendingMessages(sessionResource, backendSession);
|
|
5253
6288
|
store.add(this._ensureSessionSubscription(sessionStr).onDidChange(onRemoteChange));
|
|
5254
6289
|
store.add(
|
|
@@ -5411,7 +6446,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5411
6446
|
return undefined;
|
|
5412
6447
|
}
|
|
5413
6448
|
const model = this._createModelSelection(state.selectedModel?.identifier, state.modelConfiguration);
|
|
5414
|
-
const agentUri =
|
|
6449
|
+
const agentUri = [ChatMode.Agent.id, ChatMode.Ask.id, ChatMode.Edit.id].includes(state.mode.id) ? undefined : ( this._config.connection.resourceUris.toAgentHost(( URI.parse(state.mode.id))).toString());
|
|
5415
6450
|
const attachments = this._variableEntriesToAttachments(state.attachments, sessionResource, state.inputText, false);
|
|
5416
6451
|
if (!state.inputText && !model && !agentUri && attachments.length === 0) {
|
|
5417
6452
|
return undefined;
|
|
@@ -5463,15 +6498,22 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5463
6498
|
}
|
|
5464
6499
|
const modelId = this._toLanguageModelId(sessionResource, draft.model?.id);
|
|
5465
6500
|
const metadata = modelId ? this._languageModelsService.lookupLanguageModel(modelId) : undefined;
|
|
5466
|
-
const variableData = messageAttachmentsToVariableData(
|
|
6501
|
+
const variableData = messageAttachmentsToVariableData(
|
|
6502
|
+
draft.attachments,
|
|
6503
|
+
this._config.connectionAuthority,
|
|
6504
|
+
draft.text,
|
|
6505
|
+
this._config.connection.resourceUris
|
|
6506
|
+
);
|
|
5467
6507
|
const cursor = offsetToPosition(draft.text, draft.text.length);
|
|
6508
|
+
const draftAgentUri = draft.agent ? ( URI.parse(draft.agent.uri)) : undefined;
|
|
6509
|
+
const agent = draftAgentUri && this._customizationService.getCustomAgents(sessionResource).find(agent => isEqual(( URI.parse(agent.uri)), draftAgentUri));
|
|
5468
6510
|
return {
|
|
5469
6511
|
attachments: variableData?.variables ?? [],
|
|
5470
6512
|
contrib: {},
|
|
5471
6513
|
inputText: draft.text,
|
|
5472
6514
|
mode: {
|
|
5473
|
-
id: draft.agent
|
|
5474
|
-
kind: ChatModeKind.Agent
|
|
6515
|
+
id: draft.agent ? ( this._config.connection.resourceUris.fromAgentHost(( URI.parse(draft.agent.uri))).toString()) : ChatMode.Agent.id,
|
|
6516
|
+
kind: agent && readAgentCustomizationMeta(agent)["vscode.chatMode"] === "ask" ? ChatModeKind.Ask : ChatModeKind.Agent
|
|
5475
6517
|
},
|
|
5476
6518
|
selectedModel: modelId && metadata ? {
|
|
5477
6519
|
identifier: modelId,
|
|
@@ -5492,9 +6534,15 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5492
6534
|
if (!languageModelIdentifier) {
|
|
5493
6535
|
return undefined;
|
|
5494
6536
|
}
|
|
5495
|
-
const
|
|
5496
|
-
|
|
5497
|
-
|
|
6537
|
+
for (const vendor of [this._config.sessionType, ...(this._config.modelIdentifierAliases ?? [])]) {
|
|
6538
|
+
const prefix = vendor + ":";
|
|
6539
|
+
if (languageModelIdentifier.startsWith(prefix)) {
|
|
6540
|
+
return languageModelIdentifier.substring(prefix.length);
|
|
6541
|
+
}
|
|
6542
|
+
}
|
|
6543
|
+
const targetSessionType = this._languageModelsService.lookupLanguageModel(languageModelIdentifier)?.targetChatSessionType;
|
|
6544
|
+
if (targetSessionType && languageModelIdentifier.startsWith(targetSessionType + ":")) {
|
|
6545
|
+
return languageModelIdentifier.substring(targetSessionType.length + 1);
|
|
5498
6546
|
}
|
|
5499
6547
|
if (languageModelIdentifier.includes("/")) {
|
|
5500
6548
|
this._logService.warn(
|
|
@@ -5508,9 +6556,20 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5508
6556
|
if (!rawModelId) {
|
|
5509
6557
|
return undefined;
|
|
5510
6558
|
}
|
|
5511
|
-
const prefix = `${
|
|
6559
|
+
const prefix = `${this._getChatModelVendor(sessionResource)}:`;
|
|
5512
6560
|
return rawModelId.startsWith(prefix) ? rawModelId : `${prefix}${rawModelId}`;
|
|
5513
6561
|
}
|
|
6562
|
+
_getChatModelVendor(sessionResource) {
|
|
6563
|
+
const sessionType = getChatSessionType(sessionResource);
|
|
6564
|
+
if (!sessionType.endsWith(this._config.provider)) {
|
|
6565
|
+
return sessionType;
|
|
6566
|
+
}
|
|
6567
|
+
const backendSession = this._resolveSessionUri(sessionResource);
|
|
6568
|
+
const state = this._getRawSessionState(( backendSession.toString()));
|
|
6569
|
+
const chat = state && this._getChatURIOrDefault(sessionResource, backendSession, state);
|
|
6570
|
+
const chatProvider = chat !== undefined ? state?.chats.find(summary => summary.resource === chat)?.provider : undefined;
|
|
6571
|
+
return state && chatProvider && chatProvider !== state.provider ? `${sessionType.slice(0, sessionType.length - this._config.provider.length)}${chatProvider}` : sessionType;
|
|
6572
|
+
}
|
|
5514
6573
|
_getTurnResponseDetails(sessionResource, backendSession, turn) {
|
|
5515
6574
|
const fallbackRawModelId = turn?.message?.model?.id ?? lastTurnModelSelection(this._getSessionState(( backendSession.toString())))?.id;
|
|
5516
6575
|
return turnToResponseDetails(turn, this._createTurnModelLookup(sessionResource, fallbackRawModelId));
|
|
@@ -5575,38 +6634,57 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5575
6634
|
getLanguageModelDisplayNameWithProvider(model, this._languageModelsService)
|
|
5576
6635
|
);
|
|
5577
6636
|
};
|
|
6637
|
+
const localTurn = usage => this._localModels.getTurnPresentation(usage, fallbackRawModelId, rawModelId => {
|
|
6638
|
+
const resolved = lookupRawModel(rawModelId);
|
|
6639
|
+
return resolved && displayName(resolved);
|
|
6640
|
+
}, hideAutoExplainability);
|
|
5578
6641
|
return {
|
|
5579
6642
|
toLanguageModelId: rawModelId => this._toLanguageModelId(sessionResource, resolveRaw(rawModelId)),
|
|
5580
6643
|
isFusionModel: rawModelId => this._config.provider === COPILOT_CLI_AGENT_PROVIDER_ID && isCopilotHydraFusionModelId(rawModelId),
|
|
5581
6644
|
toActualModelId: rawModelId => lookupRawModel(rawModelId)?.identifier ?? this._toLanguageModelId(sessionResource, rawModelId),
|
|
5582
|
-
toModelDisplayName: rawModelId => lookupRawModel(rawModelId)?.model.name,
|
|
6645
|
+
toModelDisplayName: rawModelId => lookupRawModel(rawModelId)?.model.name ?? this._localModels.getDisplayName(rawModelId),
|
|
5583
6646
|
toResponseDetails: (rawModelId, usage, responseModelId) => {
|
|
6647
|
+
const local = responseModelId ? undefined : localTurn(usage);
|
|
6648
|
+
if (local) {
|
|
6649
|
+
return formatTurnResponseDetails({
|
|
6650
|
+
name: local.name,
|
|
6651
|
+
pricing: local.pricing
|
|
6652
|
+
}, undefined, usage);
|
|
6653
|
+
}
|
|
5584
6654
|
const {
|
|
5585
6655
|
billedId,
|
|
5586
6656
|
resolved
|
|
5587
6657
|
} = resolveBilledModel(rawModelId, usage, responseModelId);
|
|
5588
6658
|
const billedModelId = resolved && !resolved.resolvedFromRaw ? billedId : undefined;
|
|
5589
6659
|
const fusionModelName = responseModelId === undefined ? undefined : COPILOT_HYDRA_FUSION_MODEL_NAMES.get(responseModelId);
|
|
5590
|
-
const
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
}
|
|
5597
|
-
const ensembleTier = ensemble && responseModelId ? getEnsembleTierLabel(ensemble.model, responseModelId) : undefined;
|
|
5598
|
-
const responseModel = ensemble && ensembleTier ? {
|
|
5599
|
-
name: ( localize(9788, "{0} {1}", displayName(ensemble), ensembleTier)),
|
|
5600
|
-
pricing: resolved?.model.pricing
|
|
6660
|
+
const fusion = fusionModelName ? lookupRawModel(AUTO_RAW_MODEL_ID) : undefined;
|
|
6661
|
+
const fusionTier = fusion && responseModelId ? getFusionTierLabel(fusion.model, responseModelId) : undefined;
|
|
6662
|
+
const pricing = resolved?.model.multiplierNumeric !== undefined ? resolved.model.pricing : undefined;
|
|
6663
|
+
const responseModel = fusion && fusionTier ? {
|
|
6664
|
+
name: ( localize(11524, "{0} {1}", displayName(fusion), fusionTier)),
|
|
6665
|
+
pricing
|
|
5601
6666
|
} : resolved ? {
|
|
5602
6667
|
name: displayName(resolved),
|
|
5603
|
-
pricing
|
|
6668
|
+
pricing
|
|
5604
6669
|
} : fusionModelName ? {
|
|
5605
6670
|
name: fusionModelName
|
|
5606
6671
|
} : undefined;
|
|
5607
6672
|
return formatTurnResponseDetails(responseModel, billedModelId, usage);
|
|
5608
6673
|
},
|
|
5609
6674
|
toBilledModelInfo: usage => {
|
|
6675
|
+
const runtimeModelConfiguration = readAgentRuntimeModelConfiguration(usage);
|
|
6676
|
+
const localBilled = localTurn(usage)?.billed;
|
|
6677
|
+
if (localBilled) {
|
|
6678
|
+
const known = lookupRawModel(localBilled.rawModelId);
|
|
6679
|
+
const localModelId = known?.identifier ?? this._toLanguageModelId(sessionResource, localBilled.rawModelId);
|
|
6680
|
+
return localModelId ? {
|
|
6681
|
+
modelId: localModelId,
|
|
6682
|
+
modelName: known ? displayName(known) : localBilled.name,
|
|
6683
|
+
...(runtimeModelConfiguration ? {
|
|
6684
|
+
runtimeModelConfiguration
|
|
6685
|
+
} : {})
|
|
6686
|
+
} : undefined;
|
|
6687
|
+
}
|
|
5610
6688
|
const chosenModel = readUsageInfoMeta(usage).autoModeResolved?.chosenModel;
|
|
5611
6689
|
const {
|
|
5612
6690
|
billedId,
|
|
@@ -5615,7 +6693,6 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5615
6693
|
const knownModel = resolved && (resolved.resolvedFromRaw || !billedId) ? resolved : undefined;
|
|
5616
6694
|
const modelId = knownModel?.identifier ?? this._toLanguageModelId(sessionResource, billedId ?? fallbackRawModelId);
|
|
5617
6695
|
const modelName = knownModel ? displayName(knownModel) : billedId ?? fallbackRawModelId;
|
|
5618
|
-
const runtimeModelConfiguration = readAgentRuntimeModelConfiguration(usage);
|
|
5619
6696
|
return modelId && modelName ? {
|
|
5620
6697
|
modelId,
|
|
5621
6698
|
modelName,
|
|
@@ -5631,10 +6708,17 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5631
6708
|
return undefined;
|
|
5632
6709
|
}
|
|
5633
6710
|
if (!resolution) {
|
|
5634
|
-
return {
|
|
6711
|
+
return lookupModel(fallbackRawModelId)?.model.autoModelFusion ? undefined : {
|
|
5635
6712
|
kind: "autoModeResolution"
|
|
5636
6713
|
};
|
|
5637
6714
|
}
|
|
6715
|
+
const localRouted = localTurn(usage)?.routed;
|
|
6716
|
+
if (localRouted) {
|
|
6717
|
+
return {
|
|
6718
|
+
kind: "autoModeResolution",
|
|
6719
|
+
resolved: localRouted
|
|
6720
|
+
};
|
|
6721
|
+
}
|
|
5638
6722
|
const resolved = lookupRawModel(resolution.chosenModel);
|
|
5639
6723
|
const name = resolved && displayName(resolved);
|
|
5640
6724
|
return usageInfoToAutoModeResolution(usage, name);
|
|
@@ -5642,18 +6726,24 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5642
6726
|
};
|
|
5643
6727
|
}
|
|
5644
6728
|
_resolveRequestedWorkingDirectory(sessionResource) {
|
|
5645
|
-
|
|
6729
|
+
const configured = this._config.resolveWorkingDirectory?.(sessionResource);
|
|
6730
|
+
if (configured === null) {
|
|
6731
|
+
return undefined;
|
|
6732
|
+
}
|
|
6733
|
+
return configured ?? this._newSessionFolderService?.getFolder(sessionResource) ?? this._workingDirectoryResolver?.resolve(sessionResource) ?? this._newSessionFolderService?.getDefaultFolder() ?? this._workspaceContextService.getWorkspace().folders[0]?.uri;
|
|
5646
6734
|
}
|
|
5647
6735
|
_getSensitiveEditLocationsConfig(sessionResource, existingState) {
|
|
5648
|
-
const desired = mergeChatSensitiveEditLocations(
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
6736
|
+
const desired = mergeChatSensitiveEditLocations(
|
|
6737
|
+
...this._resolveSessionWorkingDirectoryRoots(sessionResource).map(resource => {
|
|
6738
|
+
const overrides = {
|
|
6739
|
+
resource
|
|
6740
|
+
};
|
|
6741
|
+
return getChatSensitiveEditLocations(
|
|
6742
|
+
this._configurationService.getValue(ChatHookFilesLocationsSettingId, overrides),
|
|
6743
|
+
this._configurationService.getValue(ChatAgentFilesLocationsSettingId, overrides)
|
|
6744
|
+
);
|
|
6745
|
+
})
|
|
6746
|
+
);
|
|
5657
6747
|
const current = existingState?.config?.values[SessionConfigKey.SensitiveEditLocations];
|
|
5658
6748
|
return (desired.length > 0 || (current !== undefined && !equals(current, desired))) ? {
|
|
5659
6749
|
[SessionConfigKey.SensitiveEditLocations]: desired
|
|
@@ -5668,6 +6758,17 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5668
6758
|
this._config.provider
|
|
5669
6759
|
));
|
|
5670
6760
|
}
|
|
6761
|
+
_resolveCustomizationScopeRoots(sessionResource) {
|
|
6762
|
+
const backendSession = this._resolveSessionUri(sessionResource);
|
|
6763
|
+
const state = this._getRawSessionState(( backendSession.toString()));
|
|
6764
|
+
if (readSessionWorkspaceless(state?._meta)) {
|
|
6765
|
+
return [];
|
|
6766
|
+
}
|
|
6767
|
+
const scratchFolders = readSessionScratchFolders(state?._meta).map(
|
|
6768
|
+
folder => this._config.connection.resourceUris.fromAgentHost(( URI.parse(folder)))
|
|
6769
|
+
);
|
|
6770
|
+
return this._resolveSessionWorkingDirectoryRoots(sessionResource).filter(folder => !( scratchFolders.some(scratch => isEqual(folder, scratch))));
|
|
6771
|
+
}
|
|
5671
6772
|
_hostAddressableWorkingDirectories(directories) {
|
|
5672
6773
|
const defaultDirectory = this._config.connection.initializeResult.get()?.defaultDirectory;
|
|
5673
6774
|
if (!directories?.length || !defaultDirectory) {
|
|
@@ -5685,7 +6786,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5685
6786
|
);
|
|
5686
6787
|
return addressable.length > 0 ? addressable : undefined;
|
|
5687
6788
|
}
|
|
5688
|
-
|
|
6789
|
+
_resolveSessionWorkingDirectoryRoots(sessionResource) {
|
|
5689
6790
|
if (!this._isNewSessionResource(sessionResource)) {
|
|
5690
6791
|
const own = this._existingSessionWorkingDirectories(sessionResource);
|
|
5691
6792
|
if (own !== undefined) {
|
|
@@ -5700,7 +6801,9 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5700
6801
|
if (dirs === undefined) {
|
|
5701
6802
|
return undefined;
|
|
5702
6803
|
}
|
|
5703
|
-
return dirs.map(
|
|
6804
|
+
return dirs.map(
|
|
6805
|
+
directory => this._config.connection.resourceUris.fromAgentHost(typeof directory === "string" ? ( URI.parse(directory)) : directory)
|
|
6806
|
+
);
|
|
5704
6807
|
}
|
|
5705
6808
|
async _resolveSessionTrustFolders(sessionResource, token) {
|
|
5706
6809
|
if (!this._isNewSessionResource(sessionResource)) {
|
|
@@ -5716,7 +6819,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5716
6819
|
return this._resolveRequestedWorkingDirectories(sessionResource) ?? [];
|
|
5717
6820
|
}
|
|
5718
6821
|
async _ensureFoldersTrusted(folders, onInteractionRequired) {
|
|
5719
|
-
const message = ( localize(
|
|
6822
|
+
const message = ( localize(11525, "AI features are currently only supported in trusted workspaces."));
|
|
5720
6823
|
const localFolders = folders.filter(folder => folder.scheme === Schemas.file);
|
|
5721
6824
|
if (localFolders.length === 0) {
|
|
5722
6825
|
if (!this._workspaceTrustManagementService.isWorkspaceTrusted()) {
|
|
@@ -5749,10 +6852,10 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5749
6852
|
}
|
|
5750
6853
|
return true;
|
|
5751
6854
|
}
|
|
5752
|
-
_convertVariablesToAttachments(
|
|
5753
|
-
const attachments = this._variableEntriesToAttachments(
|
|
6855
|
+
_convertVariablesToAttachments(variables, sessionResource, message) {
|
|
6856
|
+
const attachments = this._variableEntriesToAttachments(variables, sessionResource, message);
|
|
5754
6857
|
const explicitCount = attachments.length;
|
|
5755
|
-
this._appendActiveEditorAttachments(attachments,
|
|
6858
|
+
this._appendActiveEditorAttachments(attachments, variables, sessionResource, message);
|
|
5756
6859
|
if (attachments.length !== explicitCount) {
|
|
5757
6860
|
this._logService.trace(
|
|
5758
6861
|
`[AgentHost] Forwarded ${attachments.length - explicitCount} active editor attachment(s); ${attachments.length} total`
|
|
@@ -5760,17 +6863,17 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5760
6863
|
}
|
|
5761
6864
|
return attachments;
|
|
5762
6865
|
}
|
|
5763
|
-
_appendActiveEditorAttachments(attachments,
|
|
6866
|
+
_appendActiveEditorAttachments(attachments, variables, sessionResource, message) {
|
|
5764
6867
|
if (!this._configurationService.getValue(ChatConfiguration.ImplicitContextActiveEditor)) {
|
|
5765
6868
|
return;
|
|
5766
6869
|
}
|
|
5767
|
-
const implicitContext = this._chatWidgetService.getWidgetBySessionResource(
|
|
6870
|
+
const implicitContext = this._chatWidgetService.getWidgetBySessionResource(sessionResource)?.input.implicitContext;
|
|
5768
6871
|
if (!implicitContext) {
|
|
5769
6872
|
return;
|
|
5770
6873
|
}
|
|
5771
6874
|
const existingKeys = ( new Set());
|
|
5772
|
-
for (const v of
|
|
5773
|
-
const key = this._fileEntryDedupeKey(v,
|
|
6875
|
+
for (const v of variables) {
|
|
6876
|
+
const key = this._fileEntryDedupeKey(v, sessionResource);
|
|
5774
6877
|
if (key) {
|
|
5775
6878
|
existingKeys.add(key);
|
|
5776
6879
|
}
|
|
@@ -5786,7 +6889,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5786
6889
|
if (skipUntitled && entry.uri?.scheme === Schemas.untitled) {
|
|
5787
6890
|
continue;
|
|
5788
6891
|
}
|
|
5789
|
-
const key = this._fileEntryDedupeKey(entry,
|
|
6892
|
+
const key = this._fileEntryDedupeKey(entry, sessionResource);
|
|
5790
6893
|
let forwardEntry = true;
|
|
5791
6894
|
if (key) {
|
|
5792
6895
|
if (( existingKeys.has(key))) {
|
|
@@ -5796,7 +6899,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5796
6899
|
}
|
|
5797
6900
|
}
|
|
5798
6901
|
if (forwardEntry) {
|
|
5799
|
-
const attachment = this._convertVariableToAttachment(entry,
|
|
6902
|
+
const attachment = this._convertVariableToAttachment(entry, sessionResource, message);
|
|
5800
6903
|
if (!Array.isArray(attachment) && attachment) {
|
|
5801
6904
|
attachments.push(attachment);
|
|
5802
6905
|
}
|
|
@@ -5819,7 +6922,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
5819
6922
|
existingKeys.add(outputKey);
|
|
5820
6923
|
attachments.push({
|
|
5821
6924
|
type: MessageAttachmentKind.Resource,
|
|
5822
|
-
uri: ( outputUri.toString()),
|
|
6925
|
+
uri: ( this._config.connection.resourceUris.toAgentHost(outputUri).toString()),
|
|
5823
6926
|
label: `${entry.name} output.json`,
|
|
5824
6927
|
displayKind: "document"
|
|
5825
6928
|
});
|
|
@@ -6103,12 +7206,14 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
6103
7206
|
};
|
|
6104
7207
|
}
|
|
6105
7208
|
_toSessionReferenceTrajectoryPath(sessionResource) {
|
|
6106
|
-
return buildHostLocalEventsPath(
|
|
6107
|
-
|
|
6108
|
-
|
|
7209
|
+
return buildHostLocalEventsPath(
|
|
7210
|
+
sessionResource,
|
|
7211
|
+
this._copilotHomeService.home,
|
|
7212
|
+
authority => this._remoteAgentHostService.connections.find(connection => agentHostAuthority(connection.address) === authority)
|
|
7213
|
+
);
|
|
6109
7214
|
}
|
|
6110
7215
|
_toResourceAttachment(uri, label, displayKind, sessionResource, _meta, range) {
|
|
6111
|
-
const attachmentUri = this._rebaseAttachmentUri(uri, sessionResource);
|
|
7216
|
+
const attachmentUri = this._config.connection.resourceUris.toAgentHost(this._rebaseAttachmentUri(uri, sessionResource));
|
|
6112
7217
|
const attachment = {
|
|
6113
7218
|
type: MessageAttachmentKind.Resource,
|
|
6114
7219
|
uri: ( attachmentUri.toString()),
|
|
@@ -6124,7 +7229,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
6124
7229
|
return attachment;
|
|
6125
7230
|
}
|
|
6126
7231
|
_toSelectionAttachment(location, label, displayKind, sessionResource, _meta, range) {
|
|
6127
|
-
const attachmentUri = this._rebaseAttachmentUri(location.uri, sessionResource);
|
|
7232
|
+
const attachmentUri = this._config.connection.resourceUris.toAgentHost(this._rebaseAttachmentUri(location.uri, sessionResource));
|
|
6128
7233
|
const attachment = {
|
|
6129
7234
|
type: MessageAttachmentKind.Resource,
|
|
6130
7235
|
uri: ( attachmentUri.toString()),
|
|
@@ -6195,7 +7300,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
6195
7300
|
const itemMeta = {
|
|
6196
7301
|
id: item.id,
|
|
6197
7302
|
text: item.text,
|
|
6198
|
-
resourceUri: ( item.resourceUri.toString()),
|
|
7303
|
+
resourceUri: ( this._config.connection.resourceUris.toAgentHost(item.resourceUri).toString()),
|
|
6199
7304
|
range: this._toTextRange(item.range),
|
|
6200
7305
|
...(item.replies?.length ? {
|
|
6201
7306
|
replies: [...item.replies]
|
|
@@ -6220,7 +7325,7 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
6220
7325
|
const feedbackItems = v.feedbackItems.map(item => ({
|
|
6221
7326
|
id: item.id,
|
|
6222
7327
|
text: item.text,
|
|
6223
|
-
resourceUri: ( item.resourceUri.toString()),
|
|
7328
|
+
resourceUri: ( this._config.connection.resourceUris.toAgentHost(item.resourceUri).toString()),
|
|
6224
7329
|
range: this._toTextRange(item.range),
|
|
6225
7330
|
...(item.replies?.length ? {
|
|
6226
7331
|
replies: [...item.replies]
|
|
@@ -6300,7 +7405,11 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
6300
7405
|
_rebaseAttachmentUri(uri, sessionResource) {
|
|
6301
7406
|
const requestedDirectories = this._resolveRequestedWorkingDirectories(sessionResource);
|
|
6302
7407
|
const requestedDir = requestedDirectories?.[0];
|
|
6303
|
-
if (!requestedDir
|
|
7408
|
+
if (!requestedDir) {
|
|
7409
|
+
return uri;
|
|
7410
|
+
}
|
|
7411
|
+
const hostRequestedDir = this._config.connection.resourceUris.toAgentHost(requestedDir);
|
|
7412
|
+
if (hostRequestedDir.scheme !== Schemas.file) {
|
|
6304
7413
|
return uri;
|
|
6305
7414
|
}
|
|
6306
7415
|
const owningRequestedDirectory = findDeepestContainingWorkingDirectory(uri, requestedDirectories);
|
|
@@ -6310,20 +7419,18 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
6310
7419
|
const backendSession = this._resolveSessionUri(sessionResource);
|
|
6311
7420
|
const rawResolvedDir = this._getSessionState(( backendSession.toString()))?.workingDirectories?.[0];
|
|
6312
7421
|
const resolvedDir = typeof rawResolvedDir === "string" ? ( URI.parse(rawResolvedDir)) : rawResolvedDir;
|
|
6313
|
-
if (!resolvedDir || resolvedDir.scheme !==
|
|
7422
|
+
if (!resolvedDir || resolvedDir.scheme !== Schemas.file) {
|
|
6314
7423
|
return uri;
|
|
6315
7424
|
}
|
|
6316
|
-
if (extUriBiasedIgnorePathCase.isEqual(
|
|
7425
|
+
if (extUriBiasedIgnorePathCase.isEqual(hostRequestedDir, resolvedDir)) {
|
|
6317
7426
|
return uri;
|
|
6318
7427
|
}
|
|
6319
7428
|
const rel = extUriBiasedIgnorePathCase.relativePath(requestedDir, uri);
|
|
6320
7429
|
if (rel === undefined) {
|
|
6321
7430
|
return uri;
|
|
6322
7431
|
}
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
}
|
|
6326
|
-
return URI.joinPath(resolvedDir, ...rel.split("/"));
|
|
7432
|
+
const rebasedUri = rel === "" ? resolvedDir : URI.joinPath(resolvedDir, ...rel.split("/"));
|
|
7433
|
+
return this._config.connection.resourceUris.fromAgentHost(rebasedUri);
|
|
6327
7434
|
}
|
|
6328
7435
|
_ensureSessionSubscription(sessionUri) {
|
|
6329
7436
|
let ref = this._sessionSubscriptions.get(sessionUri);
|
|
@@ -6368,8 +7475,20 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
6368
7475
|
}
|
|
6369
7476
|
return ref.object;
|
|
6370
7477
|
}
|
|
7478
|
+
_retainSubagentChatSubscription(sessionUri, chatUri) {
|
|
7479
|
+
this._subagentChatSubscriptionHolds.set(chatUri, (this._subagentChatSubscriptionHolds.get(chatUri) ?? 0) + 1);
|
|
7480
|
+
return toDisposable(() => {
|
|
7481
|
+
const remaining = (this._subagentChatSubscriptionHolds.get(chatUri) ?? 1) - 1;
|
|
7482
|
+
if (remaining > 0) {
|
|
7483
|
+
this._subagentChatSubscriptionHolds.set(chatUri, remaining);
|
|
7484
|
+
} else {
|
|
7485
|
+
this._subagentChatSubscriptionHolds.delete(chatUri);
|
|
7486
|
+
this._releaseChatSessionSubscriptions(sessionUri, chatUri);
|
|
7487
|
+
}
|
|
7488
|
+
});
|
|
7489
|
+
}
|
|
6371
7490
|
_releaseChatSessionSubscriptions(sessionUri, chatUri) {
|
|
6372
|
-
if (chatUri !== this._getRawSessionState(sessionUri)?.defaultChat?.toString()) {
|
|
7491
|
+
if (chatUri !== undefined && chatUri !== this._getRawSessionState(sessionUri)?.defaultChat?.toString() && !( this._subagentChatSubscriptionHolds.has(chatUri)) && ![...( this._chatURIsBySessionResource.values())].includes(chatUri)) {
|
|
6373
7492
|
const chatRef = this._additionalChatSubscriptions.get(chatUri);
|
|
6374
7493
|
if (chatRef) {
|
|
6375
7494
|
this._additionalChatSubscriptions.delete(chatUri);
|
|
@@ -6448,6 +7567,15 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
6448
7567
|
(sessionState.status & SessionStatus.IsArchived) === SessionStatus.IsArchived
|
|
6449
7568
|
);
|
|
6450
7569
|
}
|
|
7570
|
+
_findChatOwner(chat) {
|
|
7571
|
+
for (const session of ( this._sessionSubscriptions.keys())) {
|
|
7572
|
+
const state = this._getRawSessionState(session);
|
|
7573
|
+
if (state && (state.defaultChat?.toString() === chat || ( state.chats.some(summary => ( summary.resource.toString()) === chat)))) {
|
|
7574
|
+
return session;
|
|
7575
|
+
}
|
|
7576
|
+
}
|
|
7577
|
+
return undefined;
|
|
7578
|
+
}
|
|
6451
7579
|
_getRawSessionState(sessionUri) {
|
|
6452
7580
|
const ref = this._sessionSubscriptions.get(sessionUri);
|
|
6453
7581
|
const value = ref?.object.value;
|
|
@@ -6499,12 +7627,19 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
6499
7627
|
_ensureChatSubscription(sessionUri, chatUri) {
|
|
6500
7628
|
return chatUri === this._requireDefaultChatUri(sessionUri) ? this._ensureDefaultChatSubscription(sessionUri) : this._ensureAdditionalChatSubscription(chatUri);
|
|
6501
7629
|
}
|
|
6502
|
-
resolveChatResponseUri(
|
|
6503
|
-
|
|
6504
|
-
|
|
7630
|
+
resolveChatResponseUri(sessionResource, href, kind) {
|
|
7631
|
+
const session = this._resolveSessionUri(sessionResource);
|
|
7632
|
+
const chatUri = this._getChatURIOrDefault(sessionResource, session);
|
|
7633
|
+
const directory = kind === "image" || kind === "link" ? this._getSessionState(( session.toString()), chatUri)?.workingDirectories?.[0] : undefined;
|
|
7634
|
+
const resolve = target => rewriteAgentHostLinkTarget(
|
|
7635
|
+
target,
|
|
6505
7636
|
this._config.connectionAuthority,
|
|
6506
|
-
this._config.connection.resourceUris
|
|
7637
|
+
this._config.connection.resourceUris,
|
|
7638
|
+
directory ? ( URI.parse(directory)) : undefined
|
|
6507
7639
|
);
|
|
7640
|
+
const resolved = resolve(href);
|
|
7641
|
+
const chat = chatUri === this._getRawSessionState(( session.toString()))?.defaultChat ? this._getDefaultChatState(( session.toString())) : chatUri ? this._getAdditionalChatState(chatUri) : undefined;
|
|
7642
|
+
return (kind === "image" ? resolveAgentHostToolResultImage(chat, resolved, resolve) : undefined) ?? resolved;
|
|
6508
7643
|
}
|
|
6509
7644
|
_getRootState() {
|
|
6510
7645
|
const value = this._config.connection.rootState.value;
|
|
@@ -6528,10 +7663,11 @@ let AgentHostSessionHandler = class AgentHostSessionHandler extends Disposable {
|
|
|
6528
7663
|
ref.dispose();
|
|
6529
7664
|
}
|
|
6530
7665
|
this._additionalChatSubscriptions.clear();
|
|
7666
|
+
this._subagentPresentation.clear();
|
|
6531
7667
|
super.dispose();
|
|
6532
7668
|
}
|
|
6533
7669
|
};
|
|
6534
|
-
AgentHostSessionHandler = AgentHostSessionHandler_1 = ( __decorate([( __param(1, IChatAgentService)), ( __param(2, IChatService)), ( __param(3, IChatEditingService)), ( __param(4, ILogService)), ( __param(5, IWorkspaceContextService)), ( __param(6, IInstantiationService)), ( __param(7, ITerminalChatService)), ( __param(8, IAgentHostTerminalService)), ( __param(9, IAgentHostSessionWorkingDirectoryResolver)), ( __param(10, IAgentHostSessionWorkingDirectorySynchronizer)), ( __param(11, IAgentHostShellInitSynchronizer)), ( __param(12, IAgentHostNewSessionFolderService)), ( __param(13, IAgentHostUntitledProvisionalSessionService)), ( __param(14, IAgentHostImportConversationStore)), ( __param(15, ILanguageModelToolsService)), ( __param(16, IChatWidgetService)), ( __param(17, ILanguageModelsService)), ( __param(18, IOpenerService)), ( __param(19, IEditorService)), ( __param(20, IAgentHostActiveClientService)), ( __param(21,
|
|
7670
|
+
AgentHostSessionHandler = AgentHostSessionHandler_1 = ( __decorate([( __param(1, IChatAgentService)), ( __param(2, IChatService)), ( __param(3, IChatEditingService)), ( __param(4, ILogService)), ( __param(5, IWorkspaceContextService)), ( __param(6, IInstantiationService)), ( __param(7, ITerminalChatService)), ( __param(8, IAgentHostTerminalService)), ( __param(9, IAgentHostSessionWorkingDirectoryResolver)), ( __param(10, IAgentHostSessionWorkingDirectorySynchronizer)), ( __param(11, IAgentHostShellInitSynchronizer)), ( __param(12, IAgentHostNewSessionFolderService)), ( __param(13, IAgentHostUntitledProvisionalSessionService)), ( __param(14, IAgentHostImportConversationStore)), ( __param(15, ILanguageModelToolsService)), ( __param(16, IChatWidgetService)), ( __param(17, ILanguageModelsService)), ( __param(18, IOpenerService)), ( __param(19, IEditorService)), ( __param(20, IAgentHostActiveClientService)), ( __param(21, IAgentHostMcpAppToolsService)), ( __param(22, IChatEntitlementService)), ( __param(23, IWorkspaceTrustRequestService)), ( __param(24, IWorkspaceTrustManagementService)), ( __param(25, IModelService)), ( __param(26, IWorkingCopyService)), ( __param(27, IConfigurationService)), ( __param(28, IChatResponseFileChangesService)), ( __param(29, ICopilotHomeService)), ( __param(30, IRemoteAgentHostService)), ( __param(31, IAgentHostCustomizationService)), ( __param(32, ITelemetryService)), ( __param(33, IWorkbenchAssignmentService)), ( __param(34, IAgentHostConnectionsService)), ( __param(35, INotificationService)), ( __param(36, IAccessibilitySignalService)), ( __param(37, IAccessibilityService)), ( __param(38, ITextFileService)), ( __param(39, IComputerUseSetupService)), ( __param(40, IChatSessionReviewPreferencesService))], AgentHostSessionHandler));
|
|
6535
7671
|
function toolResultToProtocol(result, toolName) {
|
|
6536
7672
|
const isError = !!result.toolResultError;
|
|
6537
7673
|
const defaultPastTense = isError ? `${toolName} failed` : `Ran ${toolName}`;
|
|
@@ -6568,4 +7704,4 @@ function toolResultToProtocol(result, toolName) {
|
|
|
6568
7704
|
};
|
|
6569
7705
|
}
|
|
6570
7706
|
|
|
6571
|
-
export { AgentHostSessionHandler, DraftSyncState, UNOBSERVED_CLIENT_TOOL_GRACE_MS, convertCarouselAnswers, isNotFoundError,
|
|
7707
|
+
export { AgentHostSessionHandler, DraftSyncState, UNOBSERVED_CLIENT_TOOL_GRACE_MS, convertCarouselAnswers, isNotFoundError, toolResultToProtocol, unwrapSessionLoadErrorMessage };
|