From 8a6d685c8184cdec8a6d5db9a216a0ead2d67b5d Mon Sep 17 00:00:00 2001 From: xinyi-gong Date: Wed, 29 Apr 2026 10:28:01 +0800 Subject: [PATCH 1/3] add data layer and service skeleton --- .../eclipse/core/chat/ConfirmationResult.java | 19 ++ .../lsp/protocol/CopilotCapabilities.java | 21 +- .../InvokeClientToolConfirmationParams.java | 36 +++- .../core/lsp/protocol/ToolAnnotations.java | 84 ++++++++ .../core/lsp/protocol/ToolMetadata.java | 189 ++++++++++++++++++ .../confirmation/ConfirmationHandler.java | 23 +++ .../confirmation/ConfirmationService.java | 25 +++ .../ui/chat/services/AgentToolService.java | 19 ++ 8 files changed, 410 insertions(+), 6 deletions(-) create mode 100644 com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/ConfirmationResult.java create mode 100644 com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/ToolAnnotations.java create mode 100644 com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/ToolMetadata.java create mode 100644 com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/ConfirmationHandler.java create mode 100644 com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/ConfirmationService.java diff --git a/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/ConfirmationResult.java b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/ConfirmationResult.java new file mode 100644 index 00000000..a702256a --- /dev/null +++ b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/ConfirmationResult.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package com.microsoft.copilot.eclipse.core.chat; + +/** + * Result of evaluating an auto-approve confirmation request. + */ +public enum ConfirmationResult { + /** + * The tool invocation is automatically approved and no user confirmation is needed. + */ + AUTO_APPROVED, + + /** + * The tool invocation requires user confirmation before proceeding. + */ + NEEDS_CONFIRMATION +} diff --git a/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/CopilotCapabilities.java b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/CopilotCapabilities.java index a9f5cb00..97a5a77d 100644 --- a/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/CopilotCapabilities.java +++ b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/CopilotCapabilities.java @@ -31,6 +31,10 @@ public class CopilotCapabilities { private boolean manageTodoListTool; + // When true, CLS always sends confirmation requests to the IDE instead of auto-approving + // internally. The IDE takes over all confirmation decisions. + private boolean editorHandlesAllConfirmation; + private List contentProvider; /** @@ -46,6 +50,7 @@ public CopilotCapabilities(boolean fetch, boolean watchedFiles, boolean subAgent this.watchedFiles = watchedFiles; this.subAgent = subAgent; this.contentProvider = contentProvider; + this.editorHandlesAllConfirmation = false; } public boolean isFetch() { @@ -112,6 +117,14 @@ public void setManageTodoListTool(boolean manageTodoListTool) { this.manageTodoListTool = manageTodoListTool; } + public boolean isEditorHandlesAllConfirmation() { + return editorHandlesAllConfirmation; + } + + public void setEditorHandlesAllConfirmation(boolean editorHandlesAllConfirmation) { + this.editorHandlesAllConfirmation = editorHandlesAllConfirmation; + } + @Override public String toString() { ToStringBuilder builder = new ToStringBuilder(this); @@ -124,13 +137,14 @@ public String toString() { builder.append("contentProvider", contentProvider); builder.append("debuggerAgent", debuggerAgent); builder.append("manageTodoListTool", manageTodoListTool); + builder.append("editorHandlesAllConfirmation", editorHandlesAllConfirmation); return builder.toString(); } @Override public int hashCode() { - return Objects.hash(cveRemediatorAgent, debuggerAgent, didChangeFeatureFlags, fetch, manageTodoListTool, - stateDatabase, subAgent, watchedFiles, contentProvider); + return Objects.hash(cveRemediatorAgent, debuggerAgent, didChangeFeatureFlags, editorHandlesAllConfirmation, fetch, + manageTodoListTool, stateDatabase, subAgent, watchedFiles, contentProvider); } @Override @@ -144,7 +158,8 @@ public boolean equals(Object obj) { CopilotCapabilities other = (CopilotCapabilities) obj; return cveRemediatorAgent == other.cveRemediatorAgent && debuggerAgent == other.debuggerAgent - && didChangeFeatureFlags == other.didChangeFeatureFlags && fetch == other.fetch + && didChangeFeatureFlags == other.didChangeFeatureFlags + && editorHandlesAllConfirmation == other.editorHandlesAllConfirmation && fetch == other.fetch && manageTodoListTool == other.manageTodoListTool && stateDatabase == other.stateDatabase && subAgent == other.subAgent && watchedFiles == other.watchedFiles && Objects.equals(contentProvider, other.contentProvider); diff --git a/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/InvokeClientToolConfirmationParams.java b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/InvokeClientToolConfirmationParams.java index ba40b954..2066c74c 100644 --- a/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/InvokeClientToolConfirmationParams.java +++ b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/InvokeClientToolConfirmationParams.java @@ -52,6 +52,16 @@ public class InvokeClientToolConfirmationParams { */ private String toolCallId; + /** + * The MCP tool annotations describing tool behavior hints. + */ + private ToolAnnotations annotations; + + /** + * Additional metadata associated with the tool invocation. + */ + private ToolMetadata toolMetadata; + public String getName() { return name; } @@ -116,9 +126,26 @@ public void setToolCallId(String toolCallId) { this.toolCallId = toolCallId; } + public ToolAnnotations getAnnotations() { + return annotations; + } + + public void setAnnotations(ToolAnnotations annotations) { + this.annotations = annotations; + } + + public ToolMetadata getToolMetadata() { + return toolMetadata; + } + + public void setToolMetadata(ToolMetadata toolMetadata) { + this.toolMetadata = toolMetadata; + } + @Override public int hashCode() { - return Objects.hash(conversationId, input, message, name, roundId, title, toolCallId, turnId); + return Objects.hash(annotations, conversationId, input, message, name, roundId, title, toolCallId, toolMetadata, + turnId); } @Override @@ -133,10 +160,11 @@ public boolean equals(Object obj) { return false; } InvokeClientToolConfirmationParams other = (InvokeClientToolConfirmationParams) obj; - return Objects.equals(conversationId, other.conversationId) && Objects.equals(input, other.input) + return Objects.equals(annotations, other.annotations) + && Objects.equals(conversationId, other.conversationId) && Objects.equals(input, other.input) && Objects.equals(message, other.message) && Objects.equals(name, other.name) && roundId == other.roundId && Objects.equals(title, other.title) && Objects.equals(toolCallId, other.toolCallId) - && Objects.equals(turnId, other.turnId); + && Objects.equals(toolMetadata, other.toolMetadata) && Objects.equals(turnId, other.turnId); } @Override @@ -150,6 +178,8 @@ public String toString() { builder.append("turnId", turnId); builder.append("roundId", roundId); builder.append("toolCallId", toolCallId); + builder.append("annotations", annotations); + builder.append("toolMetadata", toolMetadata); return builder.toString(); } } diff --git a/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/ToolAnnotations.java b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/ToolAnnotations.java new file mode 100644 index 00000000..a59f3598 --- /dev/null +++ b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/ToolAnnotations.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package com.microsoft.copilot.eclipse.core.lsp.protocol; + +import java.util.Objects; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * MCP tool annotations describing tool behavior hints (e.g., readOnly, destructive). + * Provided by CLS, originally sourced from the MCP server's tool definition. + */ +public class ToolAnnotations { + private boolean readOnlyHint; + private boolean destructiveHint; + private boolean idempotentHint; + private boolean openWorldHint; + + public boolean isReadOnlyHint() { + return readOnlyHint; + } + + public void setReadOnlyHint(boolean readOnlyHint) { + this.readOnlyHint = readOnlyHint; + } + + public boolean isDestructiveHint() { + return destructiveHint; + } + + public void setDestructiveHint(boolean destructiveHint) { + this.destructiveHint = destructiveHint; + } + + public boolean isIdempotentHint() { + return idempotentHint; + } + + public void setIdempotentHint(boolean idempotentHint) { + this.idempotentHint = idempotentHint; + } + + public boolean isOpenWorldHint() { + return openWorldHint; + } + + public void setOpenWorldHint(boolean openWorldHint) { + this.openWorldHint = openWorldHint; + } + + @Override + public int hashCode() { + return Objects.hash(readOnlyHint, destructiveHint, idempotentHint, openWorldHint); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + ToolAnnotations other = (ToolAnnotations) obj; + return readOnlyHint == other.readOnlyHint + && destructiveHint == other.destructiveHint + && idempotentHint == other.idempotentHint + && openWorldHint == other.openWorldHint; + } + + @Override + public String toString() { + ToStringBuilder builder = new ToStringBuilder(this); + builder.append("readOnlyHint", readOnlyHint); + builder.append("destructiveHint", destructiveHint); + builder.append("idempotentHint", idempotentHint); + builder.append("openWorldHint", openWorldHint); + return builder.toString(); + } +} diff --git a/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/ToolMetadata.java b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/ToolMetadata.java new file mode 100644 index 00000000..9883a504 --- /dev/null +++ b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/ToolMetadata.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package com.microsoft.copilot.eclipse.core.lsp.protocol; + +import java.util.Arrays; +import java.util.Objects; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * Tool-specific metadata provided by CLS as part of the confirmation request, used by the + * auto-approve system to make confirmation decisions. + */ +public class ToolMetadata { + + private TerminalCommandData terminalCommandData; + private SensitiveFileData sensitiveFileData; + + public TerminalCommandData getTerminalCommandData() { + return terminalCommandData; + } + + public void setTerminalCommandData(TerminalCommandData terminalCommandData) { + this.terminalCommandData = terminalCommandData; + } + + public SensitiveFileData getSensitiveFileData() { + return sensitiveFileData; + } + + public void setSensitiveFileData(SensitiveFileData sensitiveFileData) { + this.sensitiveFileData = sensitiveFileData; + } + + @Override + public int hashCode() { + return Objects.hash(terminalCommandData, sensitiveFileData); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null || getClass() != obj.getClass()) { + return false; + } + ToolMetadata other = (ToolMetadata) obj; + return Objects.equals(terminalCommandData, other.terminalCommandData) + && Objects.equals(sensitiveFileData, other.sensitiveFileData); + } + + @Override + public String toString() { + ToStringBuilder builder = new ToStringBuilder(this); + builder.append("terminalCommandData", terminalCommandData); + builder.append("sensitiveFileData", sensitiveFileData); + return builder.toString(); + } + + /** + * Data describing a terminal command and its sub-commands. + */ + public static class TerminalCommandData { + private String[] subCommands; + private String[] commandNames; + + public String[] getSubCommands() { + return subCommands; + } + + public void setSubCommands(String[] subCommands) { + this.subCommands = subCommands; + } + + public String[] getCommandNames() { + return commandNames; + } + + public void setCommandNames(String[] commandNames) { + this.commandNames = commandNames; + } + + @Override + public int hashCode() { + return Objects.hash(Arrays.hashCode(subCommands), Arrays.hashCode(commandNames)); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + TerminalCommandData other = (TerminalCommandData) obj; + return Arrays.equals(subCommands, other.subCommands) + && Arrays.equals(commandNames, other.commandNames); + } + + @Override + public String toString() { + ToStringBuilder builder = new ToStringBuilder(this); + builder.append("subCommands", subCommands); + builder.append("commandNames", commandNames); + return builder.toString(); + } + } + + /** + * Data describing a sensitive file that requires confirmation. + */ + public static class SensitiveFileData { + private String filePath; + private String matchingRule; + private String ruleDescription; + private boolean isGlobal; + + public String getFilePath() { + return filePath; + } + + public void setFilePath(String filePath) { + this.filePath = filePath; + } + + public String getMatchingRule() { + return matchingRule; + } + + public void setMatchingRule(String matchingRule) { + this.matchingRule = matchingRule; + } + + public String getRuleDescription() { + return ruleDescription; + } + + public void setRuleDescription(String ruleDescription) { + this.ruleDescription = ruleDescription; + } + + public boolean isGlobal() { + return isGlobal; + } + + public void setGlobal(boolean isGlobal) { + this.isGlobal = isGlobal; + } + + @Override + public int hashCode() { + return Objects.hash(filePath, matchingRule, ruleDescription, isGlobal); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + SensitiveFileData other = (SensitiveFileData) obj; + return Objects.equals(filePath, other.filePath) + && Objects.equals(matchingRule, other.matchingRule) + && Objects.equals(ruleDescription, other.ruleDescription) + && isGlobal == other.isGlobal; + } + + @Override + public String toString() { + ToStringBuilder builder = new ToStringBuilder(this); + builder.append("filePath", filePath); + builder.append("matchingRule", matchingRule); + builder.append("ruleDescription", ruleDescription); + builder.append("isGlobal", isGlobal); + return builder.toString(); + } + } +} diff --git a/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/ConfirmationHandler.java b/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/ConfirmationHandler.java new file mode 100644 index 00000000..db45d2f9 --- /dev/null +++ b/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/ConfirmationHandler.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package com.microsoft.copilot.eclipse.ui.chat.confirmation; + +import com.microsoft.copilot.eclipse.core.chat.ConfirmationResult; +import com.microsoft.copilot.eclipse.core.lsp.protocol.InvokeClientToolConfirmationParams; + +/** + * Evaluates whether a tool confirmation request can be auto-approved. + * Each implementation handles a specific category of tool (terminal, file operations, MCP, etc.). + */ +public interface ConfirmationHandler { + + /** + * Evaluates whether the given confirmation request should be auto-approved. + * + * @param params the confirmation request parameters from CLS + * @return ConfirmationResult.AUTO_APPROVED if the tool call can proceed without user + * confirmation, or ConfirmationResult.NEEDS_CONFIRMATION if the user must approve + */ + ConfirmationResult evaluate(InvokeClientToolConfirmationParams params); +} diff --git a/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/ConfirmationService.java b/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/ConfirmationService.java new file mode 100644 index 00000000..1e617bd5 --- /dev/null +++ b/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/ConfirmationService.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +package com.microsoft.copilot.eclipse.ui.chat.confirmation; + +import com.microsoft.copilot.eclipse.core.chat.ConfirmationResult; +import com.microsoft.copilot.eclipse.core.lsp.protocol.InvokeClientToolConfirmationParams; + +/** + * Central entry point for auto-approve evaluation. Decides whether a tool confirmation + * request should be auto-approved or shown to the user. Currently a no-op skeleton that + * always requires confirmation; concrete logic will be added in subsequent sub-tasks. + */ +public class ConfirmationService { + + /** + * Evaluates whether a tool confirmation request should be auto-approved. + * + * @param params the confirmation request parameters from CLS + * @return the confirmation result (currently always {@link ConfirmationResult#NEEDS_CONFIRMATION}) + */ + public ConfirmationResult evaluate(InvokeClientToolConfirmationParams params) { + return ConfirmationResult.NEEDS_CONFIRMATION; + } +} diff --git a/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/AgentToolService.java b/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/AgentToolService.java index 4eab4f0c..cbe496cc 100644 --- a/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/AgentToolService.java +++ b/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/AgentToolService.java @@ -18,6 +18,7 @@ import com.microsoft.copilot.eclipse.core.CopilotCore; import com.microsoft.copilot.eclipse.core.chat.ChatEventsManager; +import com.microsoft.copilot.eclipse.core.chat.ConfirmationResult; import com.microsoft.copilot.eclipse.core.chat.ToolInvocationListener; import com.microsoft.copilot.eclipse.core.lsp.CopilotLanguageServerConnection; import com.microsoft.copilot.eclipse.core.lsp.protocol.InvokeClientToolConfirmationParams; @@ -35,6 +36,7 @@ import com.microsoft.copilot.eclipse.ui.chat.BaseTurnWidget; import com.microsoft.copilot.eclipse.ui.chat.ChatContentViewer; import com.microsoft.copilot.eclipse.ui.chat.ChatView; +import com.microsoft.copilot.eclipse.ui.chat.confirmation.ConfirmationService; import com.microsoft.copilot.eclipse.ui.chat.tools.BaseTool; import com.microsoft.copilot.eclipse.ui.chat.tools.CreateFileTool; import com.microsoft.copilot.eclipse.ui.chat.tools.EditFileTool; @@ -55,6 +57,7 @@ public class AgentToolService implements ToolInvocationListener, TerminalService protected CopilotLanguageServerConnection lsConnection; private volatile boolean terminalToolsRegistered = false; private List cachedBuiltInTools; + private final ConfirmationService confirmationService; /** * Constructor for AgentToolService. @@ -62,6 +65,7 @@ public class AgentToolService implements ToolInvocationListener, TerminalService public AgentToolService(CopilotLanguageServerConnection lsConnection) { this.tools = new ConcurrentHashMap<>(); this.lsConnection = lsConnection; + this.confirmationService = new ConfirmationService(); TerminalServiceManager terminalManager = TerminalServiceManager.getInstance(); if (terminalManager != null) { terminalManager.addListener(this); @@ -243,6 +247,12 @@ public CompletableFuture onToolConfirmation return CompletableFuture.completedFuture(result); } + // Auto-approve evaluation + if (confirmationService.evaluate(params) == ConfirmationResult.AUTO_APPROVED) { + return CompletableFuture.completedFuture( + new LanguageModelToolConfirmationResult(ToolConfirmationResult.ACCEPT)); + } + BaseTurnWidget turnWidget = boundChatView.getChatContentViewer().getTurnWidget(params.getTurnId()); if (turnWidget == null) { LanguageModelToolConfirmationResult result = new LanguageModelToolConfirmationResult( @@ -283,6 +293,15 @@ private boolean validToolConfirmInvokeParams(String conversationId, String turnI return true; } + /** + * Get the confirmation service for auto-approve evaluation. + * + * @return the confirmation service + */ + public ConfirmationService getConfirmationService() { + return confirmationService; + } + /** * Dispose the service. */ From 320cec3b4c7ba1c869f8db171510a8ae70ccc964 Mon Sep 17 00:00:00 2001 From: xinyi-gong Date: Wed, 29 Apr 2026 16:23:15 +0800 Subject: [PATCH 2/3] add setting and remove capabilities --- .../lsp/protocol/CopilotAgentSettings.java | 18 ++++++++++++++-- .../lsp/protocol/CopilotCapabilities.java | 21 +++---------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/CopilotAgentSettings.java b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/CopilotAgentSettings.java index 254a1266..be30e612 100644 --- a/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/CopilotAgentSettings.java +++ b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/CopilotAgentSettings.java @@ -16,6 +16,10 @@ public class CopilotAgentSettings { @SerializedName("maxToolCallingLoop") private int agentMaxRequests; + // Control if the editor handles all confirmation requests from CLS. + @SerializedName("editorHandlesAllConfirmation") + private boolean editorHandlesAllConfirmation; + public int getAgentMaxRequests() { return agentMaxRequests; } @@ -24,9 +28,17 @@ public void setAgentMaxRequests(int agentMaxRequests) { this.agentMaxRequests = agentMaxRequests; } + public boolean isEditorHandlesAllConfirmation() { + return editorHandlesAllConfirmation; + } + + public void setEditorHandlesAllConfirmation(boolean editorHandlesAllConfirmation) { + this.editorHandlesAllConfirmation = editorHandlesAllConfirmation; + } + @Override public int hashCode() { - return Objects.hash(agentMaxRequests); + return Objects.hash(agentMaxRequests, editorHandlesAllConfirmation); } @Override @@ -38,13 +50,15 @@ public boolean equals(Object obj) { return false; } CopilotAgentSettings other = (CopilotAgentSettings) obj; - return agentMaxRequests == other.agentMaxRequests; + return agentMaxRequests == other.agentMaxRequests + && editorHandlesAllConfirmation == other.editorHandlesAllConfirmation; } @Override public String toString() { ToStringBuilder builder = new ToStringBuilder(this); builder.append("agentMaxRequests", agentMaxRequests); + builder.append("editorHandlesAllConfirmation", editorHandlesAllConfirmation); return builder.toString(); } } diff --git a/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/CopilotCapabilities.java b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/CopilotCapabilities.java index 97a5a77d..a9f5cb00 100644 --- a/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/CopilotCapabilities.java +++ b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/CopilotCapabilities.java @@ -31,10 +31,6 @@ public class CopilotCapabilities { private boolean manageTodoListTool; - // When true, CLS always sends confirmation requests to the IDE instead of auto-approving - // internally. The IDE takes over all confirmation decisions. - private boolean editorHandlesAllConfirmation; - private List contentProvider; /** @@ -50,7 +46,6 @@ public CopilotCapabilities(boolean fetch, boolean watchedFiles, boolean subAgent this.watchedFiles = watchedFiles; this.subAgent = subAgent; this.contentProvider = contentProvider; - this.editorHandlesAllConfirmation = false; } public boolean isFetch() { @@ -117,14 +112,6 @@ public void setManageTodoListTool(boolean manageTodoListTool) { this.manageTodoListTool = manageTodoListTool; } - public boolean isEditorHandlesAllConfirmation() { - return editorHandlesAllConfirmation; - } - - public void setEditorHandlesAllConfirmation(boolean editorHandlesAllConfirmation) { - this.editorHandlesAllConfirmation = editorHandlesAllConfirmation; - } - @Override public String toString() { ToStringBuilder builder = new ToStringBuilder(this); @@ -137,14 +124,13 @@ public String toString() { builder.append("contentProvider", contentProvider); builder.append("debuggerAgent", debuggerAgent); builder.append("manageTodoListTool", manageTodoListTool); - builder.append("editorHandlesAllConfirmation", editorHandlesAllConfirmation); return builder.toString(); } @Override public int hashCode() { - return Objects.hash(cveRemediatorAgent, debuggerAgent, didChangeFeatureFlags, editorHandlesAllConfirmation, fetch, - manageTodoListTool, stateDatabase, subAgent, watchedFiles, contentProvider); + return Objects.hash(cveRemediatorAgent, debuggerAgent, didChangeFeatureFlags, fetch, manageTodoListTool, + stateDatabase, subAgent, watchedFiles, contentProvider); } @Override @@ -158,8 +144,7 @@ public boolean equals(Object obj) { CopilotCapabilities other = (CopilotCapabilities) obj; return cveRemediatorAgent == other.cveRemediatorAgent && debuggerAgent == other.debuggerAgent - && didChangeFeatureFlags == other.didChangeFeatureFlags - && editorHandlesAllConfirmation == other.editorHandlesAllConfirmation && fetch == other.fetch + && didChangeFeatureFlags == other.didChangeFeatureFlags && fetch == other.fetch && manageTodoListTool == other.manageTodoListTool && stateDatabase == other.stateDatabase && subAgent == other.subAgent && watchedFiles == other.watchedFiles && Objects.equals(contentProvider, other.contentProvider); From 6dbc34f864e87fd61b04d55d25453a15615c1540 Mon Sep 17 00:00:00 2001 From: xinyi-gong Date: Thu, 7 May 2026 10:02:06 +0800 Subject: [PATCH 3/3] move ConfirmationHandler to core bundle --- .../copilot/eclipse/core/chat}/ConfirmationHandler.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) rename {com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation => com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat}/ConfirmationHandler.java (86%) diff --git a/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/ConfirmationHandler.java b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/ConfirmationHandler.java similarity index 86% rename from com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/ConfirmationHandler.java rename to com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/ConfirmationHandler.java index db45d2f9..b8553435 100644 --- a/com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/confirmation/ConfirmationHandler.java +++ b/com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/chat/ConfirmationHandler.java @@ -1,9 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -package com.microsoft.copilot.eclipse.ui.chat.confirmation; +package com.microsoft.copilot.eclipse.core.chat; -import com.microsoft.copilot.eclipse.core.chat.ConfirmationResult; import com.microsoft.copilot.eclipse.core.lsp.protocol.InvokeClientToolConfirmationParams; /**