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
4 changes: 2 additions & 2 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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) => {
Expand Down
30 changes: 24 additions & 6 deletions src/github/copilotRemoteAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -192,11 +198,12 @@ export class CopilotRemoteAgentManager extends Disposable {
return { owner, repo, remote, baseRef, repository };
}

async commandImpl(args?: any): Promise<string | undefined> {
// https://github.com/microsoft/vscode-copilot/issues/18918
const userPrompt: string | undefined = args.userPrompt;
const summary: string | undefined = args.summary;
async commandImpl(args?: ICopilotRemoteAgentCommandArgs): Promise<string | undefined> {
if (!args) {
return;
}

const { userPrompt, summary, source } = args;
if (!userPrompt || userPrompt.trim().length === 0) {
return;
}
Expand All @@ -216,7 +223,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,
{
Expand All @@ -242,7 +249,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,
},
Expand Down Expand Up @@ -271,6 +278,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());
}
Expand Down