From ed3e52a2e264c5d70e72f1f003af310efdd59a06 Mon Sep 17 00:00:00 2001 From: Josh Spicer <23246594+joshspicer@users.noreply.github.com> Date: Thu, 26 Jun 2025 20:36:21 -0700 Subject: [PATCH 1/2] special handling from prompt (https://github.com/microsoft/vscode/pull/252581/files) --- src/github/copilotRemoteAgent.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/github/copilotRemoteAgent.ts b/src/github/copilotRemoteAgent.ts index 9301a962a3..841ea13d68 100644 --- a/src/github/copilotRemoteAgent.ts +++ b/src/github/copilotRemoteAgent.ts @@ -196,6 +196,7 @@ export class CopilotRemoteAgentManager extends Disposable { // https://github.com/microsoft/vscode-copilot/issues/18918 const userPrompt: string | undefined = args.userPrompt; const summary: string | undefined = args.summary; + const source: string | undefined = args.source; if (!userPrompt || userPrompt.trim().length === 0) { return; @@ -216,7 +217,7 @@ export class CopilotRemoteAgentManager extends Disposable { let autoPushAndCommit = false; const message = vscode.l10n.t('GitHub Coding Agent will continue your work in \'{0}\'', repoName); - if (hasChanges && this.autoCommitAndPushEnabled()) { + if (source !== 'prompt' && hasChanges && this.autoCommitAndPushEnabled()) { const modalResult = await vscode.window.showInformationMessage( message, { @@ -242,7 +243,7 @@ export class CopilotRemoteAgentManager extends Disposable { } } else { const modalResult = await vscode.window.showInformationMessage( - message, + (source !== 'prompt' ? message : vscode.l10n.t('GitHub Coding Agent will implement the specification outlined in this prompt file')), { modal: true, }, @@ -271,6 +272,17 @@ export class CopilotRemoteAgentManager extends Disposable { } const { webviewUri, link, number } = result; + + if (source === 'prompt') { + const VIEW = vscode.l10n.t('View'); + const finished = vscode.l10n.t('Coding agent has begun work on your prompt in #{0}', number); + vscode.window.showInformationMessage(finished, VIEW).then((value) => { + if (value === VIEW) { + vscode.commands.executeCommand('vscode.open', webviewUri); + } + }); + } + // allow-any-unicode-next-line return vscode.l10n.t('🚀 Coding agent will continue work in [#{0}]({1}). Track progress [here]({2}).', number, link, webviewUri.toString()); } From 60e268a1614a7429e6d4e33c4231123b27ecfb9b Mon Sep 17 00:00:00 2001 From: Josh Spicer <23246594+joshspicer@users.noreply.github.com> Date: Fri, 27 Jun 2025 11:32:09 -0700 Subject: [PATCH 2/2] add types to command args --- src/commands.ts | 4 ++-- src/github/copilotRemoteAgent.ts | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/commands.ts b/src/commands.ts index 3bfb030099..2d98a2fe93 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -18,7 +18,7 @@ import { ITelemetry } from './common/telemetry'; import { asTempStorageURI, fromPRUri, fromReviewUri, Schemes, toPRUri } from './common/uri'; import { formatError } from './common/utils'; import { EXTENSION_ID } from './constants'; -import { CopilotRemoteAgentManager } from './github/copilotRemoteAgent'; +import { CopilotRemoteAgentManager, ICopilotRemoteAgentCommandArgs } from './github/copilotRemoteAgent'; import { FolderRepositoryManager } from './github/folderRepositoryManager'; import { GitHubRepository } from './github/githubRepository'; import { Issue } from './github/interface'; @@ -1463,7 +1463,7 @@ ${contents} } })); context.subscriptions.push( - vscode.commands.registerCommand('githubpr.remoteAgent', async (args) => await copilotRemoteAgentManager.commandImpl(args)) + vscode.commands.registerCommand('githubpr.remoteAgent', async (args: ICopilotRemoteAgentCommandArgs) => await copilotRemoteAgentManager.commandImpl(args)) ); context.subscriptions.push( vscode.commands.registerCommand('pr.applySuggestionWithCopilot', async (comment: GHPRComment) => { diff --git a/src/github/copilotRemoteAgent.ts b/src/github/copilotRemoteAgent.ts index 841ea13d68..c3ace05495 100644 --- a/src/github/copilotRemoteAgent.ts +++ b/src/github/copilotRemoteAgent.ts @@ -26,6 +26,12 @@ export interface IAPISessionLogs { logs: string; } +export interface ICopilotRemoteAgentCommandArgs { + userPrompt: string; + summary?: string; + source?: string; +} + const LEARN_MORE = vscode.l10n.t('Learn about Coding Agent'); // Without Pending Changes const CONTINUE = vscode.l10n.t('Continue'); @@ -192,12 +198,12 @@ export class CopilotRemoteAgentManager extends Disposable { return { owner, repo, remote, baseRef, repository }; } - async commandImpl(args?: any): Promise { - // https://github.com/microsoft/vscode-copilot/issues/18918 - const userPrompt: string | undefined = args.userPrompt; - const summary: string | undefined = args.summary; - const source: string | undefined = args.source; + async commandImpl(args?: ICopilotRemoteAgentCommandArgs): Promise { + if (!args) { + return; + } + const { userPrompt, summary, source } = args; if (!userPrompt || userPrompt.trim().length === 0) { return; }