|
7 | 7 | extractParameterKey, |
8 | 8 | buildToolIdList, |
9 | 9 | createSyntheticAssistantMessageWithToolPart, |
10 | | - createSyntheticUserMessage, |
11 | 10 | } from "./utils" |
12 | 11 | import { getFilePathFromParameters, isProtectedFilePath } from "../protected-file-patterns" |
13 | 12 | import { getLastUserMessage } from "../shared-utils" |
@@ -140,32 +139,20 @@ export const insertPruneToolContext = ( |
140 | 139 |
|
141 | 140 | const userInfo = lastUserMessage.info as UserMessage |
142 | 141 | const providerID = userInfo.model.providerID |
| 142 | + const modelID = userInfo.model.modelID |
143 | 143 | const isGitHubCopilot = |
144 | 144 | providerID === "github-copilot" || providerID === "github-copilot-enterprise" |
| 145 | + const isAnthropic = modelID.includes("claude") |
145 | 146 |
|
146 | | - if (isGitHubCopilot) { |
| 147 | + if (isGitHubCopilot || isAnthropic) { |
147 | 148 | const lastMessage = messages[messages.length - 1] |
148 | 149 | if (lastMessage?.info?.role === "user") { |
149 | 150 | return |
150 | 151 | } |
151 | 152 | } |
152 | 153 |
|
153 | | - logger.info("Injecting prunable-tools list", { |
154 | | - providerID, |
155 | | - isGitHubCopilot, |
156 | | - injectionType: isGitHubCopilot ? "assistant-with-tool-part" : "user-message", |
157 | | - }) |
158 | | - |
159 | | - const variant = state.variant ?? (lastUserMessage.info as UserMessage).variant |
160 | | - if (isGitHubCopilot) { |
161 | | - messages.push( |
162 | | - createSyntheticAssistantMessageWithToolPart( |
163 | | - lastUserMessage, |
164 | | - prunableToolsContent, |
165 | | - variant, |
166 | | - ), |
167 | | - ) |
168 | | - } else { |
169 | | - messages.push(createSyntheticUserMessage(lastUserMessage, prunableToolsContent, variant)) |
170 | | - } |
| 154 | + const variant = state.variant ?? userInfo.variant |
| 155 | + messages.push( |
| 156 | + createSyntheticAssistantMessageWithToolPart(lastUserMessage, prunableToolsContent, variant), |
| 157 | + ) |
171 | 158 | } |
0 commit comments