@@ -53,6 +53,7 @@ import { Link } from '../../../../platform/opener/browser/link.js';
5353import { IProgressService } from '../../../../platform/progress/common/progress.js' ;
5454import { ChatViewId } from './chat.js' ;
5555import { disposableTimeout } from '../../../../base/common/async.js' ;
56+ import { AgentSessionsFilter } from './agentSessions/agentSessionsFilter.js' ;
5657
5758interface IChatViewPaneState extends Partial < IChatModelInputState > {
5859 sessionId ?: string ;
@@ -348,26 +349,34 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
348349 menuOptions : { shouldForwardArgs : true }
349350 } ) ) ;
350351
351- // Sessions Control
352- this . sessionsControlContainer = append ( sessionsContainer , $ ( '.agent-sessions-control-container' ) ) ;
353- this . sessionsControl = this . _register ( this . instantiationService . createInstance ( AgentSessionsControl , this . sessionsControlContainer , {
354- allowOpenSessionsInPanel : true ,
355- filter : {
356- limitResults : ( ) => {
357- return that . sessionsViewerLimited ? ChatViewPane . SESSIONS_LIMIT : undefined ;
358- } ,
359- exclude ( session ) {
360- if ( that . sessionsViewerLimited && session . isArchived ( ) ) {
352+ // Sessions Filter
353+ const sessionsFilter = this . _register ( this . instantiationService . createInstance ( AgentSessionsFilter , {
354+ filterMenuId : MenuId . AgentSessionsViewerFilterSubMenu ,
355+ limitResults : ( ) => {
356+ return that . sessionsViewerLimited ? ChatViewPane . SESSIONS_LIMIT : undefined ;
357+ } ,
358+ overrideExclude ( session ) {
359+ if ( that . sessionsViewerLimited ) {
360+ if ( session . isArchived ( ) ) {
361361 return true ; // exclude archived sessions when limited
362362 }
363363
364364 return false ;
365- } ,
366- notifyResults ( count : number ) {
367- that . notifySessionsControlChanged ( count ) ;
368365 }
366+
367+ return undefined ; // leave up to the filter settings
368+ } ,
369+ notifyResults ( count : number ) {
370+ that . notifySessionsControlChanged ( count ) ;
369371 }
370372 } ) ) ;
373+
374+ // Sessions Control
375+ this . sessionsControlContainer = append ( sessionsContainer , $ ( '.agent-sessions-control-container' ) ) ;
376+ this . sessionsControl = this . _register ( this . instantiationService . createInstance ( AgentSessionsControl , this . sessionsControlContainer , {
377+ allowOpenSessionsInPanel : true ,
378+ filter : sessionsFilter
379+ } ) ) ;
371380 this . _register ( this . onDidChangeBodyVisibility ( visible => this . sessionsControl ?. setVisible ( visible ) ) ) ;
372381
373382 toolbar . context = this . sessionsControl ;
@@ -422,12 +431,12 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
422431 newSessionsContainerVisible = false ; // disabled in settings
423432 } else {
424433
425- // Sessions control: stacked, compact
434+ // Sessions control: stacked
426435 if ( this . sessionsViewerOrientation === AgentSessionsViewerOrientation . Stacked ) {
427436 newSessionsContainerVisible =
428- ( ! this . _widget || this . _widget ?. isEmpty ( ) ) && // chat widget empty
429- ! this . welcomeController ?. isShowingWelcome . get ( ) && // welcome not showing
430- this . sessionsCount > 0 ; // has sessions
437+ ( ! this . _widget || this . _widget ?. isEmpty ( ) ) && // chat widget empty
438+ ! this . welcomeController ?. isShowingWelcome . get ( ) && // welcome not showing
439+ ( this . sessionsCount > 0 || ! this . sessionsViewerLimited ) ; // has sessions or is showing all sessions
431440 }
432441
433442 // Sessions control: sidebar
@@ -636,7 +645,7 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
636645 widthReduction = this . sessionsContainer . offsetWidth ;
637646 }
638647
639- // Show compact (grows with the number of items displayed)
648+ // Show stacked (grows with the number of items displayed)
640649 else {
641650 let sessionsHeight : number ;
642651 if ( this . sessionsViewerLimited ) {
@@ -650,7 +659,7 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
650659 this . sessionsControl . layout ( sessionsHeight , width ) ;
651660
652661 heightReduction = this . sessionsContainer . offsetHeight ;
653- widthReduction = 0 ; // compact on top of the chat widget
662+ widthReduction = 0 ; // stacked on top of the chat widget
654663 }
655664
656665 return { heightReduction, widthReduction } ;
0 commit comments