diff --git a/src/@types/vscode.proposed.chatParticipantAdditions.d.ts b/src/@types/vscode.proposed.chatParticipantAdditions.d.ts index f05e4fe691..f4ce44cd9e 100644 --- a/src/@types/vscode.proposed.chatParticipantAdditions.d.ts +++ b/src/@types/vscode.proposed.chatParticipantAdditions.d.ts @@ -167,7 +167,14 @@ declare module 'vscode' { constructor(value: ChatResponseDiffEntry[], title: string, readOnly?: boolean); } - export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatPrepareToolInvocationPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart; + export class ChatResponseExternalEditPart { + uris: Uri[]; + callback: () => Thenable; + applied: Thenable; + constructor(uris: Uri[], callback: () => Thenable); + } + + export type ExtendedChatResponsePart = ChatResponsePart | ChatResponseTextEditPart | ChatResponseNotebookEditPart | ChatResponseConfirmationPart | ChatResponseCodeCitationPart | ChatResponseReferencePart2 | ChatResponseMovePart | ChatResponseExtensionsPart | ChatResponsePullRequestPart | ChatPrepareToolInvocationPart | ChatToolInvocationPart | ChatResponseMultiDiffPart | ChatResponseThinkingProgressPart | ChatResponseExternalEditPart; export class ChatResponseWarningPart { value: MarkdownString; constructor(value: string | MarkdownString); @@ -301,6 +308,14 @@ declare module 'vscode' { notebookEdit(target: Uri, isDone: true): void; + /** + * Makes an external edit to one or more resources. Changes to the + * resources made within the `callback` and before it resolves will be + * tracked as agent edits. This can be used to track edits made from + * external tools that don't generate simple {@link textEdit textEdits}. + */ + externalEdit(target: Uri | Uri[], callback: () => Thenable): Thenable; + markdownWithVulnerabilities(value: string | MarkdownString, vulnerabilities: ChatVulnerability[]): void; codeblockUri(uri: Uri, isEdit?: boolean): void; push(part: ChatResponsePart | ChatResponseTextEditPart | ChatResponseWarningPart | ChatResponseProgressPart2): void; diff --git a/src/@types/vscode.proposed.chatParticipantPrivate.d.ts b/src/@types/vscode.proposed.chatParticipantPrivate.d.ts index dca0f364d7..398dce07fd 100644 --- a/src/@types/vscode.proposed.chatParticipantPrivate.d.ts +++ b/src/@types/vscode.proposed.chatParticipantPrivate.d.ts @@ -87,6 +87,8 @@ declare module 'vscode' { * Events for edited files in this session collected since the last request. */ readonly editedFileEvents?: ChatRequestEditedFileEvent[]; + + readonly isSubagent?: boolean; } export enum ChatRequestEditedFileEventKind { diff --git a/src/view/reviewManager.ts b/src/view/reviewManager.ts index 6260047828..ec6ef2c0ae 100644 --- a/src/view/reviewManager.ts +++ b/src/view/reviewManager.ts @@ -16,6 +16,7 @@ import { ProgressHelper } from './progress'; import { PullRequestsTreeDataProvider } from './prsTreeDataProvider'; import { ReviewCommentController, SuggestionInformation } from './reviewCommentController'; import { ReviewModel } from './reviewModel'; +import { COPILOT_SWE_AGENT } from '../common/copilot'; import { DiffChangeType, DiffHunk, parsePatch, splitIntoSmallerHunks } from '../common/diffHunk'; import { commands } from '../common/executeCommands'; import { GitChangeType, InMemFileChange, SlimFileChange } from '../common/file'; @@ -1142,9 +1143,11 @@ export class ReviewManager extends Disposable { this._upgradePullRequestEditors(pr); /* __GDPR__ - "pr.checkout" : {} + "pr.checkout" : { + "isCopilot" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + } */ - this._telemetry.sendTelemetryEvent('pr.checkout'); + this._telemetry.sendTelemetryEvent('pr.checkout', { isCopilot: (pr.author.login === COPILOT_SWE_AGENT) ? 'true' : 'false' }); Logger.appendLine(`Switch to Pull Request #${pr.number} - done`, this.id); } finally { this.setStatusForPr(pr); diff --git a/src/view/reviewsManager.ts b/src/view/reviewsManager.ts index 2995e0c8a8..1143b0efb2 100644 --- a/src/view/reviewsManager.ts +++ b/src/view/reviewsManager.ts @@ -11,6 +11,7 @@ import { PrsTreeModel } from './prsTreeModel'; import { ReviewManager } from './reviewManager'; import { Repository } from '../api/api'; import { GitApiImpl, Status } from '../api/api1'; +import { COPILOT_SWE_AGENT } from '../common/copilot'; import { Disposable } from '../common/lifecycle'; import * as PersistentState from '../common/persistentState'; import { ITelemetry } from '../common/telemetry'; @@ -120,10 +121,11 @@ export class ReviewsManager extends Disposable { /* __GDPR__ "pr.checkout" : { - "fromDescriptionPage" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } + "fromDescription" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }, + "isCopilot" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" } } */ - this._telemetry.sendTelemetryEvent('pr.checkout', { fromDescription: isFromDescription.toString() }); + this._telemetry.sendTelemetryEvent('pr.checkout', { fromDescription: isFromDescription.toString(), isCopilot: (pullRequestModel.author.login === COPILOT_SWE_AGENT) ? 'true' : 'false' }); return vscode.window.withProgress( {