Skip to content

Commit c077cda

Browse files
authored
Adopt mode name in agent instructions (#1421)
* Adopt mode name in agent instructions * Test
1 parent 3d6a871 commit c077cda

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

src/extension/prompts/node/agent/agentPrompt.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,12 @@ export class AgentPrompt extends PromptElement<AgentPromptProps> {
185185
/>
186186
);
187187
if (this.props.promptContext.modeInstructions) {
188-
const { content, toolReferences } = this.props.promptContext.modeInstructions;
188+
const { name, content, toolReferences } = this.props.promptContext.modeInstructions;
189189
const resolvedContent = toolReferences && toolReferences.length > 0 ? await this.promptVariablesService.resolveToolReferencesInPrompt(content, toolReferences) : content;
190190

191191
customInstructionsBodyParts.push(
192-
<Tag name='customInstructions'>
193-
Below are some additional instructions from the user.<br />
192+
<Tag name='modeInstructions'>
193+
You are currently running in "{name}" mode. Below are your instructions for this mode, they must take precedence over any instructions above.<br />
194194
<br />
195195
{resolvedContent}
196196
</Tag>

src/extension/prompts/node/agent/test/__snapshots__/agentPrompt.spec.tsx.snap

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -796,11 +796,11 @@ When generating code, please follow these user provided coding instructions. You
796796
<instructions>
797797
This is a test custom instruction file
798798
</instructions>
799-
<customInstructions>
800-
Below are some additional instructions from the user.
799+
<modeInstructions>
800+
You are currently running in "Plan" mode. Below are your instructions for this mode, they must take precedence over any instructions above.
801801
802802
custom mode instructions
803-
</customInstructions>
803+
</modeInstructions>
804804
805805
806806
[copilot_cache_control: { type: 'ephemeral' }]
@@ -2092,11 +2092,11 @@ When generating code, please follow these user provided coding instructions. You
20922092
<instructions>
20932093
This is a test custom instruction file
20942094
</instructions>
2095-
<customInstructions>
2096-
Below are some additional instructions from the user.
2095+
<modeInstructions>
2096+
You are currently running in "Plan" mode. Below are your instructions for this mode, they must take precedence over any instructions above.
20972097
20982098
custom mode instructions
2099-
</customInstructions>
2099+
</modeInstructions>
21002100
21012101
21022102
[copilot_cache_control: { type: 'ephemeral' }]
@@ -3805,11 +3805,11 @@ When generating code, please follow these user provided coding instructions. You
38053805
<instructions>
38063806
This is a test custom instruction file
38073807
</instructions>
3808-
<customInstructions>
3809-
Below are some additional instructions from the user.
3808+
<modeInstructions>
3809+
You are currently running in "Plan" mode. Below are your instructions for this mode, they must take precedence over any instructions above.
38103810
38113811
custom mode instructions
3812-
</customInstructions>
3812+
</modeInstructions>
38133813
38143814
38153815
[copilot_cache_control: { type: 'ephemeral' }]

src/extension/prompts/node/agent/test/agentPrompt.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ import { AgentPrompt, AgentPromptProps } from '../agentPrompt';
255255
chatVariables: new ChatVariablesCollection(),
256256
history: [],
257257
query: 'hello',
258-
modeInstructions: { content: 'custom mode instructions' },
258+
modeInstructions: { name: 'Plan', content: 'custom mode instructions' },
259259
}, undefined)).toMatchSnapshot();
260260
});
261261

src/extension/vscode.proposed.chatParticipantAdditions.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
declare module 'vscode' {
77

88
export interface ChatParticipant {
9-
onDidPerformAction: Event<ChatUserActionEvent>;
9+
readonly onDidPerformAction: Event<ChatUserActionEvent>;
1010
}
1111

1212
/**
@@ -442,7 +442,7 @@ declare module 'vscode' {
442442
* Event that fires when a request is paused or unpaused.
443443
* Chat requests are initially unpaused in the {@link requestHandler}.
444444
*/
445-
onDidChangePauseState: Event<ChatParticipantPauseStateEvent>;
445+
readonly onDidChangePauseState: Event<ChatParticipantPauseStateEvent>;
446446
}
447447

448448
export interface ChatParticipantPauseStateEvent {
@@ -652,6 +652,7 @@ declare module 'vscode' {
652652
}
653653

654654
export interface ChatRequestModeInstructions {
655+
readonly name: string;
655656
readonly content: string;
656657
readonly toolReferences?: readonly ChatLanguageModelToolReference[];
657658
readonly metadata?: Record<string, boolean | string | number>;

0 commit comments

Comments
 (0)