@@ -6,14 +6,41 @@ export type RequestKind =
66 | 'terminal-steering'
77 | 'todo-tracker'
88 | 'settings-resolver'
9+ | 'prompt-categorizer'
10+ | 'chat-title'
11+ | 'inline-progress-message'
12+ | 'git-branch-name'
13+ | 'git-commit-message'
14+ | 'rename-suggestions'
915 | 'background'
1016 | 'unknown' ;
1117
1218const TODO_TRACKER_PREFIX = 'You are a background task tracker' ;
19+ const PROMPT_CATEGORIZER_PREFIX = 'You are an expert classifier for AI coding assistant prompts' ;
1320const SETTINGS_RESOLVER_PREFIX =
1421 'You are a Visual Studio Code assistant. Your job is to assist users in using Visual Studio Code by returning settings' ;
22+ const CHAT_TITLE_PREFIXES = [
23+ 'You are an expert in crafting ultra-compact titles' ,
24+ 'You are an expert in crafting pithy titles' ,
25+ ] as const ;
26+ const INLINE_PROGRESS_MESSAGE_PREFIX =
27+ 'You are an expert in writing short, catchy, and encouraging progress messages' ;
28+ const GIT_BRANCH_NAME_PREFIX = 'You are an expert in crafting pithy branch names' ;
29+ const GIT_COMMIT_MESSAGE_PREFIX =
30+ 'You are an AI programming assistant, helping a software developer to come with the best git commit message' ;
31+ const RENAME_SUGGESTIONS_PREFIX = 'You are a distinguished software engineer' ;
1532const MAIN_AGENT_PREFIX = 'You are an expert AI programming assistant' ;
1633const TERMINAL_NOTIFICATION_PATTERN = / ^ \[ T e r m i n a l \s + \S + \s + n o t i f i c a t i o n : / ;
34+ const REQUEST_KINDS_WITH_FORCED_NONE_THINKING = new Set < RequestKind > ( [
35+ 'todo-tracker' ,
36+ 'prompt-categorizer' ,
37+ 'settings-resolver' ,
38+ 'chat-title' ,
39+ 'inline-progress-message' ,
40+ 'git-branch-name' ,
41+ 'git-commit-message' ,
42+ 'rename-suggestions' ,
43+ ] ) ;
1744
1845export function formatModelFields ( vscodeModelId : string , apiModelId ?: string ) : string {
1946 const apiField = apiModelId && apiModelId !== vscodeModelId ? ` apiModel=${ apiModelId } ` : '' ;
@@ -24,6 +51,10 @@ export function formatRequestLogLine(requestKind: RequestKind, message: string):
2451 return `[${ requestKind } ] ${ message } ` ;
2552}
2653
54+ export function shouldForceThinkingNone ( requestKind : RequestKind ) : boolean {
55+ return REQUEST_KINDS_WITH_FORCED_NONE_THINKING . has ( requestKind ) ;
56+ }
57+
2758export function classifyProviderRequest ( input : {
2859 messages : readonly vscode . LanguageModelChatRequestMessage [ ] ;
2960 tools ?: readonly vscode . LanguageModelChatTool [ ] ;
@@ -66,9 +97,30 @@ function classifyRequest(input: {
6697 ) {
6798 return 'todo-tracker' ;
6899 }
100+ if (
101+ isOnlyTool ( input . toolNames , 'categorize_prompt' ) ||
102+ firstText . startsWith ( PROMPT_CATEGORIZER_PREFIX )
103+ ) {
104+ return 'prompt-categorizer' ;
105+ }
69106 if ( firstText . startsWith ( SETTINGS_RESOLVER_PREFIX ) ) {
70107 return 'settings-resolver' ;
71108 }
109+ if ( startsWithAny ( firstText , CHAT_TITLE_PREFIXES ) ) {
110+ return 'chat-title' ;
111+ }
112+ if ( firstText . startsWith ( INLINE_PROGRESS_MESSAGE_PREFIX ) ) {
113+ return 'inline-progress-message' ;
114+ }
115+ if ( firstText . startsWith ( GIT_BRANCH_NAME_PREFIX ) ) {
116+ return 'git-branch-name' ;
117+ }
118+ if ( firstText . startsWith ( GIT_COMMIT_MESSAGE_PREFIX ) ) {
119+ return 'git-commit-message' ;
120+ }
121+ if ( firstText . startsWith ( RENAME_SUGGESTIONS_PREFIX ) ) {
122+ return 'rename-suggestions' ;
123+ }
72124 if (
73125 firstText . startsWith ( MAIN_AGENT_PREFIX ) ||
74126 firstText . includes ( '<skills>' ) ||
@@ -86,6 +138,10 @@ function isOnlyTool(toolNames: readonly string[], toolName: string): boolean {
86138 return toolNames . length === 1 && toolNames [ 0 ] === toolName ;
87139}
88140
141+ function startsWithAny ( text : string , prefixes : readonly string [ ] ) : boolean {
142+ return prefixes . some ( ( prefix ) => text . startsWith ( prefix ) ) ;
143+ }
144+
89145function getDeepSeekToolName ( tool : DeepSeekTool ) : string {
90146 return tool . function . name ;
91147}
0 commit comments