@@ -54,6 +54,7 @@ import { Link } from '../../../../platform/opener/browser/link.js';
5454import { IProgressService } from '../../../../platform/progress/common/progress.js' ;
5555import { ChatViewId } from './chat.js' ;
5656import { disposableTimeout } from '../../../../base/common/async.js' ;
57+ import { AgentSessionsFilter } from './agentSessions/agentSessionsFilter.js' ;
5758
5859interface IChatViewPaneState extends Partial < IChatModelInputState > {
5960 sessionId ?: string ;
@@ -355,26 +356,34 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
355356 menuOptions : { shouldForwardArgs : true }
356357 } ) ) ;
357358
358- // Sessions Control
359- this . sessionsControlContainer = append ( sessionsContainer , $ ( '.agent-sessions-control-container' ) ) ;
360- this . sessionsControl = this . _register ( this . instantiationService . createInstance ( AgentSessionsControl , this . sessionsControlContainer , {
361- allowOpenSessionsInPanel : true ,
362- filter : {
363- limitResults : ( ) => {
364- return that . sessionsViewerLimited ? ChatViewPane . SESSIONS_LIMIT : undefined ;
365- } ,
366- exclude ( session ) {
367- if ( that . sessionsViewerLimited && session . isArchived ( ) ) {
359+ // Sessions Filter
360+ const sessionsFilter = this . _register ( this . instantiationService . createInstance ( AgentSessionsFilter , {
361+ filterMenuId : MenuId . AgentSessionsViewerFilterSubMenu ,
362+ limitResults : ( ) => {
363+ return that . sessionsViewerLimited ? ChatViewPane . SESSIONS_LIMIT : undefined ;
364+ } ,
365+ overrideExclude ( session ) {
366+ if ( that . sessionsViewerLimited ) {
367+ if ( session . isArchived ( ) ) {
368368 return true ; // exclude archived sessions when limited
369369 }
370370
371371 return false ;
372- } ,
373- notifyResults ( count : number ) {
374- that . notifySessionsControlChanged ( count ) ;
375372 }
373+
374+ return undefined ; // leave up to the filter settings
375+ } ,
376+ notifyResults ( count : number ) {
377+ that . notifySessionsControlChanged ( count ) ;
376378 }
377379 } ) ) ;
380+
381+ // Sessions Control
382+ this . sessionsControlContainer = append ( sessionsContainer , $ ( '.agent-sessions-control-container' ) ) ;
383+ this . sessionsControl = this . _register ( this . instantiationService . createInstance ( AgentSessionsControl , this . sessionsControlContainer , {
384+ allowOpenSessionsInPanel : true ,
385+ filter : sessionsFilter
386+ } ) ) ;
378387 this . _register ( this . onDidChangeBodyVisibility ( visible => this . sessionsControl ?. setVisible ( visible ) ) ) ;
379388
380389 toolbar . context = this . sessionsControl ;
@@ -429,12 +438,12 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
429438 newSessionsContainerVisible = false ; // disabled in settings
430439 } else {
431440
432- // Sessions control: stacked, compact
441+ // Sessions control: stacked
433442 if ( this . sessionsViewerOrientation === AgentSessionsViewerOrientation . Stacked ) {
434443 newSessionsContainerVisible =
435- ( ! this . _widget || this . _widget ?. isEmpty ( ) ) && // chat widget empty
436- ! this . welcomeController ?. isShowingWelcome . get ( ) && // welcome not showing
437- this . sessionsCount > 0 ; // has sessions
444+ ( ! this . _widget || this . _widget ?. isEmpty ( ) ) && // chat widget empty
445+ ! this . welcomeController ?. isShowingWelcome . get ( ) && // welcome not showing
446+ this . sessionsCount > 0 || ! this . sessionsViewerLimited ; // has sessions or is showing all sessions
438447 }
439448
440449 // Sessions control: sidebar
@@ -643,7 +652,7 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
643652 widthReduction = this . sessionsContainer . offsetWidth ;
644653 }
645654
646- // Show compact (grows with the number of items displayed)
655+ // Show stacked (grows with the number of items displayed)
647656 else {
648657 let sessionsHeight : number ;
649658 if ( this . sessionsViewerLimited ) {
@@ -657,7 +666,7 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
657666 this . sessionsControl . layout ( sessionsHeight , width ) ;
658667
659668 heightReduction = this . sessionsContainer . offsetHeight ;
660- widthReduction = 0 ; // compact on top of the chat widget
669+ widthReduction = 0 ; // stacked on top of the chat widget
661670 }
662671
663672 return { heightReduction, widthReduction } ;
0 commit comments