@@ -261,8 +261,19 @@ export class InteractiveSessionWidget extends Disposable implements IInteractive
261261 }
262262
263263 if ( ! this . slashCommandsPromise ) {
264- this . slashCommandsPromise = this . interactiveSessionService . getSlashCommands ( this . viewModel . sessionId , CancellationToken . None ) ;
265- this . slashCommandsPromise . then ( commands => this . lastSlashCommands = commands ) ;
264+ this . slashCommandsPromise = this . interactiveSessionService . getSlashCommands ( this . viewModel . sessionId , CancellationToken . None ) . then ( commands => {
265+ // If this becomes a repeated pattern, we should have a real internal slash command provider system
266+ const clearCommand : IInteractiveSlashCommand = {
267+ command : 'clear' ,
268+ sortText : 'z_clear' ,
269+ detail : localize ( 'clear' , "Clear the session" ) ,
270+ } ;
271+ this . lastSlashCommands = [
272+ ...( commands ?? [ ] ) ,
273+ clearCommand
274+ ] ;
275+ return this . lastSlashCommands ;
276+ } ) ;
266277 }
267278
268279 return this . slashCommandsPromise ;
@@ -513,12 +524,21 @@ export class InteractiveSessionWidget extends Disposable implements IInteractive
513524 }
514525
515526 if ( this . viewModel ) {
516- if ( ! query && this . _inputEditor . getValue ( ) ) {
527+ const editorValue = this . _inputEditor . getValue ( ) ;
528+ if ( ! query && editorValue ) {
517529 // Followups and programmatic messages don't go to history
518- this . history . add ( this . _inputEditor . getValue ( ) ) ;
530+ this . history . add ( editorValue ) ;
531+ }
532+
533+ // Shortcut for /clear command
534+ if ( ! query && editorValue . trim ( ) === '/clear' ) {
535+ // If this becomes a repeated pattern, we should have a real internal slash command provider system
536+ this . clear ( ) ;
537+ this . _inputEditor . setValue ( '' ) ;
538+ return ;
519539 }
520540
521- const input = query ?? this . _inputEditor . getValue ( ) ;
541+ const input = query ?? editorValue ;
522542 const result = this . interactiveSessionService . sendRequest ( this . viewModel . sessionId , input ) ;
523543 if ( result ) {
524544 this . requestInProgress . set ( true ) ;
0 commit comments