Skip to content

Commit 10454ee

Browse files
committed
Add in fix for System Prompt to only make vs code lm api calls available if flag is enabled.
1 parent 0ef9569 commit 10454ee

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/core/prompts/tools/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ export function getToolDescriptionsForMode(
7070
const groupName = getGroupName(groupEntry)
7171
const toolGroup = TOOL_GROUPS[groupName]
7272
if (toolGroup) {
73+
// Skip group if it requires an experiment that's not enabled
74+
if (toolGroup.requireExperiment && experiments) {
75+
if (!experiments[toolGroup.requireExperiment]) {
76+
return
77+
}
78+
}
79+
7380
toolGroup.tools.forEach((tool) => {
7481
if (isToolAllowedForMode(tool as ToolName, mode, customModes ?? [], experiments ?? {})) {
7582
tools.add(tool)

src/shared/modes.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,21 @@ export function doesFileMatchRegex(filePath: string, pattern: string): boolean {
5353
}
5454

5555
// Helper to get all tools for a mode
56-
export function getToolsForMode(groups: readonly GroupEntry[]): string[] {
56+
export function getToolsForMode(groups: readonly GroupEntry[], experiments?: Record<string, boolean>): string[] {
5757
const tools = new Set<string>()
5858

5959
// Add tools from each group
6060
groups.forEach((group) => {
6161
const groupName = getGroupName(group)
6262
const groupConfig = TOOL_GROUPS[groupName]
63+
64+
// Skip group if it requires an experiment that's not enabled
65+
if (groupConfig.requireExperiment && experiments) {
66+
if (!experiments[groupConfig.requireExperiment]) {
67+
return
68+
}
69+
}
70+
6371
groupConfig.tools.forEach((tool: string) => tools.add(tool))
6472
})
6573

0 commit comments

Comments
 (0)