File tree Expand file tree Collapse file tree 4 files changed +20
-7
lines changed Expand file tree Collapse file tree 4 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -353,6 +353,7 @@ class ExtHostChatAgent {
353353 private _supportIssueReporting : boolean | undefined ;
354354 private _agentVariableProvider ?: { provider : vscode . ChatAgentCompletionItemProvider ; triggerCharacters : string [ ] } ;
355355 private _welcomeMessageProvider ?: vscode . ChatAgentWelcomeMessageProvider | undefined ;
356+ private _isSticky : boolean | undefined ;
356357
357358 constructor (
358359 public readonly extension : IExtensionDescription ,
@@ -476,7 +477,8 @@ class ExtHostChatAgent {
476477 helpTextPrefix : ( ! this . _helpTextPrefix || typeof this . _helpTextPrefix === 'string' ) ? this . _helpTextPrefix : typeConvert . MarkdownString . from ( this . _helpTextPrefix ) ,
477478 helpTextPostfix : ( ! this . _helpTextPostfix || typeof this . _helpTextPostfix === 'string' ) ? this . _helpTextPostfix : typeConvert . MarkdownString . from ( this . _helpTextPostfix ) ,
478479 sampleRequest : this . _sampleRequest ,
479- supportIssueReporting : this . _supportIssueReporting
480+ supportIssueReporting : this . _supportIssueReporting ,
481+ isSticky : this . _isSticky ,
480482 } ) ;
481483 updateScheduled = false ;
482484 } ) ;
@@ -622,6 +624,13 @@ class ExtHostChatAgent {
622624 ? undefined !
623625 : this . _onDidPerformAction . event
624626 ,
627+ get isSticky ( ) {
628+ return that . _isSticky ;
629+ } ,
630+ set isSticky ( v ) {
631+ that . _isSticky = v ;
632+ updateMetadataSoon ( ) ;
633+ } ,
625634 dispose ( ) {
626635 disposed = true ;
627636 that . _commandProvider = undefined ;
Original file line number Diff line number Diff line change @@ -237,8 +237,7 @@ class InputEditorSlashCommandMode extends Disposable {
237237 public readonly id = 'InputEditorSlashCommandMode' ;
238238
239239 constructor (
240- private readonly widget : IChatWidget ,
241- @IChatAgentService private readonly _chatAgentService : IChatAgentService
240+ private readonly widget : IChatWidget
242241 ) {
243242 super ( ) ;
244243 this . _register ( this . widget . onDidSubmitAgent ( e => {
@@ -248,10 +247,9 @@ class InputEditorSlashCommandMode extends Disposable {
248247
249248 private async repopulateAgentCommand ( agent : IChatAgentData , slashCommand : IChatAgentCommand | undefined ) {
250249 let value : string | undefined ;
251- if ( slashCommand && slashCommand . shouldRepopulate ) {
250+ if ( slashCommand && slashCommand . isSticky ) {
252251 value = `${ chatAgentLeader } ${ agent . id } ${ chatSubcommandLeader } ${ slashCommand . name } ` ;
253- } else if ( agent . id !== this . _chatAgentService . getDefaultAgent ( ) ?. id ) {
254- // Agents always repopulate, and slash commands fall back to the agent if they don't repopulate
252+ } else if ( agent . metadata . isSticky ) {
255253 value = `${ chatAgentLeader } ${ agent . id } ` ;
256254 }
257255
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ export interface IChatAgentCommand {
5454 * chat into a persistent mode, where the
5555 * slash command is prepended to the chat input.
5656 */
57- shouldRepopulate ?: boolean ;
57+ isSticky ?: boolean ;
5858
5959 /**
6060 * Placeholder text to render in the chat input
@@ -79,6 +79,7 @@ export interface IChatAgentMetadata {
7979 sampleRequest ?: string ;
8080 supportIssueReporting ?: boolean ;
8181 followupPlaceholder ?: string ;
82+ isSticky ?: boolean ;
8283}
8384
8485
Original file line number Diff line number Diff line change @@ -277,6 +277,11 @@ declare module 'vscode' {
277277 */
278278 sampleRequest ?: string ;
279279
280+ /**
281+ * Whether invoking the agent puts the chat into a persistent mode, where the agent is automatically added to the chat input for the next message.
282+ */
283+ isSticky ?: boolean ;
284+
280285 /**
281286 * An event that fires whenever feedback for a result is received, e.g. when a user up- or down-votes
282287 * a result.
You can’t perform that action at this time.
0 commit comments