@@ -9,12 +9,14 @@ import { ChatFetchResponseType, ChatLocation } from '../../../platform/chat/comm
99import { getTextPart , roleToString } from '../../../platform/chat/common/globalStringUtils' ;
1010import { ConfigKey , IConfigurationService } from '../../../platform/configuration/common/configurationService' ;
1111import { isAutoModel } from '../../../platform/endpoint/node/autoChatEndpoint' ;
12+ import { IVSCodeExtensionContext } from '../../../platform/extContext/common/extensionContext' ;
1213import { ILanguageDiagnosticsService } from '../../../platform/languages/common/languageDiagnosticsService' ;
1314import { IChatEndpoint } from '../../../platform/networking/common/networking' ;
1415import { ITelemetryService } from '../../../platform/telemetry/common/telemetry' ;
1516import { TelemetryData as PlatformTelemetryData } from '../../../platform/telemetry/common/telemetryData' ;
1617import { getCachedSha256Hash } from '../../../util/common/crypto' ;
1718import { isNotebookCellOrNotebookChatInput } from '../../../util/common/notebooks' ;
19+ import { extUriBiasedIgnorePathCase } from '../../../util/vs/base/common/resources' ;
1820import { URI } from '../../../util/vs/base/common/uri' ;
1921import { IInstantiationService } from '../../../util/vs/platform/instantiation/common/instantiation' ;
2022import { isBYOKModel } from '../../byok/node/openAIEndpoint' ;
@@ -212,12 +214,7 @@ const builtinSlashCommands = new Set(
212214 Object . values ( agentsToCommands ) . flatMap ( commands => commands ? Object . keys ( commands ) : [ ] )
213215) ;
214216
215- function isOwnExtensionUri ( uri : URI ) : boolean {
216- // Extension-provided prompt files live under .../extensions/github.copilot-chat-<version>/...
217- return / \/ e x t e n s i o n s \/ g i t h u b \. c o p i l o t - c h a t - / . test ( uri . path ) ;
218- }
219-
220- function getSlashCommandForTelemetry ( request : vscode . ChatRequest ) : string {
217+ function getSlashCommandForTelemetry ( request : vscode . ChatRequest , extensionUri : URI ) : string {
221218 // Built-in slash commands (explain, fix, tests, etc.) are safe to send as plain text
222219 if ( request . command && builtinSlashCommands . has ( request . command ) ) {
223220 return request . command ;
@@ -230,7 +227,7 @@ function getSlashCommandForTelemetry(request: vscode.ChatRequest): string {
230227 }
231228
232229 // Extension-provided prompt files are safe to send as plain text
233- if ( URI . isUri ( match . variable . value ) && isOwnExtensionUri ( match . variable . value ) ) {
230+ if ( URI . isUri ( match . variable . value ) && extUriBiasedIgnorePathCase . isEqualOrParent ( match . variable . value , extensionUri ) ) {
234231 return match . command ;
235232 }
236233
@@ -602,6 +599,7 @@ export class PanelChatTelemetry extends ChatTelemetry<IDocumentContext | undefin
602599 repoInfoTelemetry : RepoInfoTelemetry ,
603600 @ITelemetryService telemetryService : ITelemetryService ,
604601 @IConfigurationService private readonly _configurationService : IConfigurationService ,
602+ @IVSCodeExtensionContext private readonly _extensionContext : IVSCodeExtensionContext ,
605603 ) {
606604 super ( ChatLocation . Panel ,
607605 sessionId ,
@@ -739,7 +737,7 @@ export class PanelChatTelemetry extends ChatTelemetry<IDocumentContext | undefin
739737 mode : this . _getModeNameForTelemetry ( ) ,
740738 parentRequestId : this . _request . parentRequestId ,
741739 vscodeRequestId : this . _request . id ,
742- slashCommand : getSlashCommandForTelemetry ( this . _request )
740+ slashCommand : getSlashCommandForTelemetry ( this . _request , URI . from ( this . _extensionContext . extensionUri ) )
743741 } satisfies RequestPanelTelemetryProperties , {
744742 turn : this . _conversation . turns . length ,
745743 round : roundIndex ,
0 commit comments