Skip to content

Commit 68b0d88

Browse files
committed
refactor(copilotcli): update action descriptions and adjust plan path handling
1 parent 05d42a2 commit 68b0d88

3 files changed

Lines changed: 19 additions & 13 deletions

File tree

extensions/copilot/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6106,12 +6106,12 @@
61066106
{
61076107
"name": "plan",
61086108
"description": "%github.copilot.command.cli.plan.description%",
6109-
"when": "config.github.copilot.chat.cli.planExitMode.enabled"
6109+
"when": "false"
61106110
},
61116111
{
61126112
"name": "fleet",
61136113
"description": "%github.copilot.command.cli.fleet.description%",
6114-
"when": "config.github.copilot.chat.cli.planExitMode.enabled"
6114+
"when": "false"
61156115
}
61166116
],
61176117
"customAgentTarget": "github-copilot",

extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSession.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -473,20 +473,25 @@ export class CopilotCLISession extends DisposableStore implements ICopilotCLISes
473473
this._sdkSession.respondToExitPlanMode(event.data.requestId, { approved: false });
474474
return;
475475
}
476-
const actionDescriptions: Record<ActionType, string> = {
477-
'autopilot': l10n.t('Auto-approve all tool calls and continue until the task is done'),
478-
'interactive': l10n.t('Let the agent continue in interactive mode, asking for user input and approval for each action.'),
479-
'exit_only': l10n.t('Exit plan mode, but do not execute the plan. I will execute the plan myself after reviewing it.'),
480-
'autopilot_fleet': l10n.t('Auto-approve all tool calls, including fleet management actions, and continue until the task is done.'),
481-
};
476+
const actionDescriptions: Record<string, { label: string; description: string }> = {
477+
'autopilot': { label: 'Autopilot', description: l10n.t('Auto-approve all tool calls and continue until the task is done') },
478+
'interactive': { label: 'Interactive', description: l10n.t('Let the agent continue in interactive mode, asking for input and approval for each action.') },
479+
'exit_only': { label: 'Approve and exit', description: l10n.t('Exit planning, but do not execute the plan. I will execute the plan myself.') },
480+
'autopilot_fleet': { label: 'Autopilot Fleet', description: l10n.t('Auto-approve all tool calls, including fleet management actions, and continue until the task is done.') },
481+
} satisfies Record<ActionType, { label: string; description: string }>;
482482

483483
const approved = true;
484-
event.data.actions;
485484
try {
485+
const planPath = this._sdkSession.getPlanPath();
486+
486487
const userInputRequest: IQuestion = {
487-
question: l10n.t('Approve this plan?'),
488+
question: planPath ? l10n.t('Approve this plan {0}?', `[Plan.md](${Uri.file(planPath).toString()})`) : l10n.t('Approve this plan?'),
488489
header: l10n.t('Approve this plan?'),
489-
options: event.data.actions.map(a => ({ label: (actionDescriptions as Record<string, string>)[a] ?? a, recommended: a === event.data.recommendedAction })),
490+
options: event.data.actions.map(a => ({
491+
label: actionDescriptions[a]?.label ?? a,
492+
recommended: a === event.data.recommendedAction,
493+
description: actionDescriptions[a]?.description ?? '',
494+
})),
490495
allowFreeformInput: true,
491496
};
492497
const answer = await this._userQuestionHandler.askUserQuestion(userInputRequest, this._toolInvocationToken as unknown as never, token);
@@ -499,8 +504,8 @@ export class CopilotCLISession extends DisposableStore implements ICopilotCLISes
499504
this._sdkSession.respondToExitPlanMode(event.data.requestId, { approved: false, feedback: answer.freeText });
500505
} else {
501506
let selectedAction: ActionType = answer.selected[0] as ActionType;
502-
Object.entries(actionDescriptions).forEach(([action, description]) => {
503-
if (description === selectedAction) {
507+
Object.entries(actionDescriptions).forEach(([action, item]) => {
508+
if (item.label === selectedAction) {
504509
selectedAction = action as ActionType;
505510
}
506511
});

extensions/copilot/src/extension/chatSessions/copilotcli/node/test/copilotcliSession.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ class MockSdkSession {
132132
async getSelectedModel() { return this._selectedModel; }
133133
async setSelectedModel(model: string, _reasoningEffort?: string) { this._selectedModel = model; }
134134
async getEvents() { return []; }
135+
getPlanPath(): string | null { return null; }
135136
}
136137

137138
function createWorkspaceService(root: string): IWorkspaceService {

0 commit comments

Comments
 (0)