Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/extension/intents/node/agentIntent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { BudgetExceededError } from '@vscode/prompt-tsx/dist/base/materialized';
import type * as vscode from 'vscode';
import { ChatLocation, ChatResponse } from '../../../platform/chat/common/commonTypes';
import { ConfigKey, IConfigurationService } from '../../../platform/configuration/common/configurationService';
import { isHiddenModelB, modelCanUseApplyPatchExclusively, modelCanUseReplaceStringExclusively, modelSupportsApplyPatch, modelSupportsMultiReplaceString, modelSupportsReplaceString, modelSupportsSimplifiedApplyPatchInstructions } from '../../../platform/endpoint/common/chatModelCapabilities';
import { modelCanUseApplyPatchExclusively, modelCanUseReplaceStringExclusively, modelSupportsApplyPatch, modelSupportsMultiReplaceString, modelSupportsReplaceString, modelSupportsSimplifiedApplyPatchInstructions } from '../../../platform/endpoint/common/chatModelCapabilities';
import { IEndpointProvider } from '../../../platform/endpoint/common/endpointProvider';
import { IEnvService } from '../../../platform/env/common/envService';
import { ILogService } from '../../../platform/log/common/logService';
Expand Down Expand Up @@ -65,9 +65,8 @@ export const getAgentTools = (instaService: IInstantiationService, request: vsco

const allowTools: Record<string, boolean> = {};

const isHiddenModelBFlag = await isHiddenModelB(model);
const learned = editToolLearningService.getPreferredEndpointEditTool(model);
if (!isHiddenModelBFlag && learned) { // a learning-enabled (BYOK) model, we should go with what it prefers
if (learned) { // a learning-enabled (BYOK) model, we should go with what it prefers
allowTools[ToolName.EditFile] = learned.includes(ToolName.EditFile);
allowTools[ToolName.ReplaceString] = learned.includes(ToolName.ReplaceString);
allowTools[ToolName.MultiReplaceString] = learned.includes(ToolName.MultiReplaceString);
Expand All @@ -94,7 +93,7 @@ export const getAgentTools = (instaService: IInstantiationService, request: vsco
allowTools[ToolName.RunTests] = await testService.hasAnyTests();
allowTools[ToolName.CoreRunTask] = tasksService.getTasks().length > 0;

if (model.family === 'gpt-5-codex' || model.family.includes('grok-code') || await isHiddenModelB(model)) {
if (model.family === 'gpt-5-codex' || model.family.includes('grok-code')) {
allowTools[ToolName.CoreManageTodoList] = false;
}

Expand Down
5 changes: 2 additions & 3 deletions src/extension/prompts/node/agent/agentPrompt.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { BasePromptElementProps, Chunk, Image, PromptElement, PromptPiece, Promp
import type { ChatRequestEditedFileEvent, LanguageModelToolInformation, NotebookEditor, TaskDefinition, TextEditor } from 'vscode';
import { ChatLocation } from '../../../../platform/chat/common/commonTypes';
import { ConfigKey, IConfigurationService } from '../../../../platform/configuration/common/configurationService';
import { isHiddenModelB, isVSCModel, modelNeedsStrongReplaceStringHint } from '../../../../platform/endpoint/common/chatModelCapabilities';
import { isVSCModel, modelNeedsStrongReplaceStringHint } from '../../../../platform/endpoint/common/chatModelCapabilities';
import { CacheType } from '../../../../platform/endpoint/common/endpointTypes';
import { IEnvService, OperatingSystem } from '../../../../platform/env/common/envService';
import { getGitHubRepoInfoFromContext, IGitService } from '../../../../platform/git/common/gitService';
Expand Down Expand Up @@ -339,8 +339,7 @@ export class AgentUserMessage extends PromptElement<AgentUserMessageProps> {
: '';
const hasToolsToEditNotebook = hasCreateFileTool || hasEditNotebookTool || hasReplaceStringTool || hasApplyPatchTool || hasEditFileTool;
const hasTodoTool = !!this.props.availableTools?.find(tool => tool.name === ToolName.CoreManageTodoList);
const isHiddenModelBFlag = await isHiddenModelB(this.props.endpoint);
const shouldUseUserQuery = this.props.endpoint.family.startsWith('grok-code') || isHiddenModelBFlag;
const shouldUseUserQuery = this.props.endpoint.family.startsWith('grok-code');

return (
<>
Expand Down
5 changes: 0 additions & 5 deletions src/extension/prompts/node/agent/xAIPrompts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/

import { PromptElement, PromptSizing } from '@vscode/prompt-tsx';
import { isHiddenModelB } from '../../../../platform/endpoint/common/chatModelCapabilities';
import { IChatEndpoint } from '../../../../platform/networking/common/networking';
import { ToolName } from '../../../tools/common/toolNames';
import { InstructionMessage } from '../base/instructionMessage';
Expand Down Expand Up @@ -122,10 +121,6 @@ class DefaultGrokCodeFastAgentPrompt extends PromptElement<DefaultAgentPromptPro
class XAIPromptResolver implements IAgentPrompt {
static readonly familyPrefixes = ['grok-code'];

static matchesModel(endpoint: IChatEndpoint): Promise<boolean> {
return isHiddenModelB(endpoint);
}

resolvePrompt(endpoint: IChatEndpoint): PromptConstructor | undefined {
return DefaultGrokCodeFastAgentPrompt;
}
Expand Down
14 changes: 2 additions & 12 deletions src/platform/endpoint/common/chatModelCapabilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ const HIDDEN_MODEL_A_HASHES = [
'6b0f165d0590bf8d508540a796b4fda77bf6a0a4ed4e8524d5451b1913100a95'
];

const HIDDEN_MODEL_B_HASHES = [
'e0f69b60bf6a6e138121a69884fa51b89aae7315f37d5f41bd0500b2d9346048',
'19bf22638886749a7a346f454f1c957c07db04b3302c0671f1dafa66d00508c6'
];

const VSC_MODEL_HASHES = [
'7b667eee9b3517fb9aae7061617fd9cec524859fcd6a20a605bfb142a6b0f14e',
'e7cfc1a7adaf9e419044e731b7a9e21940a5280a438b472db0c46752dd70eab3',
Expand All @@ -35,11 +30,6 @@ export async function isHiddenModelA(model: LanguageModelChat | IChatEndpoint) {
return HIDDEN_MODEL_A_HASHES.includes(h);
}

export async function isHiddenModelB(model: LanguageModelChat | IChatEndpoint) {
const h = await getCachedSha256Hash(getModelId(model));
return HIDDEN_MODEL_B_HASHES.includes(h);
}

export async function isVSCModel(model: LanguageModelChat | IChatEndpoint) {
const h = await getCachedSha256Hash(getModelId(model));
return VSC_MODEL_HASHES.includes(h);
Expand Down Expand Up @@ -80,7 +70,7 @@ export function modelPrefersJsonNotebookRepresentation(model: LanguageModelChat
* Model supports replace_string_in_file as an edit tool.
*/
export async function modelSupportsReplaceString(model: LanguageModelChat | IChatEndpoint): Promise<boolean> {
return model.family.includes('gemini') || model.family.includes('grok-code') || await isHiddenModelB(model) || await modelSupportsMultiReplaceString(model);
return model.family.includes('gemini') || model.family.includes('grok-code') || await modelSupportsMultiReplaceString(model);
}

/**
Expand All @@ -95,7 +85,7 @@ export async function modelSupportsMultiReplaceString(model: LanguageModelChat |
* without needing insert_edit_into_file.
*/
export async function modelCanUseReplaceStringExclusively(model: LanguageModelChat | IChatEndpoint): Promise<boolean> {
return model.family.startsWith('claude') || model.family.startsWith('Anthropic') || model.family.includes('grok-code') || await isHiddenModelB(model);
return model.family.startsWith('claude') || model.family.startsWith('Anthropic') || model.family.includes('grok-code');
}

/**
Expand Down
Loading