44 *--------------------------------------------------------------------------------------------*/
55
66import './media/chatViewPane.css' ;
7- import { $ , getWindow } from '../../../../base/browser/dom.js' ;
7+ import { $ , append , getWindow } from '../../../../base/browser/dom.js' ;
88import { CancellationToken } from '../../../../base/common/cancellation.js' ;
99import { MutableDisposable , toDisposable } from '../../../../base/common/lifecycle.js' ;
1010import { MarshalledId } from '../../../../base/common/marshallingIds.js' ;
@@ -36,11 +36,15 @@ import { CHAT_PROVIDER_ID } from '../common/chatParticipantContribTypes.js';
3636import { IChatModelReference , IChatService } from '../common/chatService.js' ;
3737import { IChatSessionsExtensionPoint , IChatSessionsService , localChatSessionType } from '../common/chatSessionsService.js' ;
3838import { LocalChatSessionUri } from '../common/chatUri.js' ;
39- import { ChatAgentLocation , ChatConfiguration , ChatModeKind } from '../common/constants.js' ;
39+ import { ChatAgentLocation , ChatConfiguration , ChatModeKind , LEGACY_AGENT_SESSIONS_VIEW_ID } from '../common/constants.js' ;
40+ import { AGENT_SESSIONS_VIEW_ID } from './agentSessions/agentSessions.js' ;
4041import { showCloseActiveChatNotification } from './actions/chatCloseNotification.js' ;
4142import { ChatWidget } from './chatWidget.js' ;
43+ import { Link } from '../../../../platform/opener/browser/link.js' ;
44+ import { localize } from '../../../../nls.js' ;
4245import { ChatViewWelcomeController , IViewWelcomeDelegate } from './viewsWelcome/chatViewWelcomeController.js' ;
4346import { AgentSessionsControl } from './agentSessions/agentSessionsControl.js' ;
47+ import { ICommandService } from '../../../../platform/commands/common/commands.js' ;
4448
4549interface IChatViewPaneState extends Partial < IChatModelInputState > {
4650 sessionId ?: string ;
@@ -64,6 +68,7 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
6468
6569 private sessionsContainer : HTMLElement | undefined ;
6670 private sessionsControl : AgentSessionsControl | undefined ;
71+ private sessionsLinkContainer : HTMLElement | undefined ;
6772
6873 private restoringSession : Promise < void > | undefined ;
6974
@@ -88,6 +93,7 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
8893 @ILayoutService private readonly layoutService : ILayoutService ,
8994 @IChatSessionsService private readonly chatSessionsService : IChatSessionsService ,
9095 @ITelemetryService private readonly telemetryService : ITelemetryService ,
96+ @ICommandService private readonly commandService : ICommandService ,
9197 ) {
9298 super ( options , keybindingService , contextMenuService , configurationService , contextKeyService , viewDescriptorService , instantiationService , openerService , themeService , hoverService ) ;
9399
@@ -247,9 +253,24 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
247253 }
248254
249255 private createSessionsControl ( parent : HTMLElement ) : void {
250- this . sessionsContainer = parent . appendChild ( $ ( '.chat-viewpane-sessions-container' ) ) ;
256+
257+ // Sessions Control
258+ this . sessionsContainer = parent . appendChild ( $ ( '.agent-sessions-container' ) ) ;
251259 this . sessionsControl = this . _register ( this . instantiationService . createInstance ( AgentSessionsControl , this . sessionsContainer , undefined ) ) ;
252260
261+ // Link to Sessions View
262+ this . sessionsLinkContainer = append ( this . sessionsContainer , $ ( '.agent-sessions-link-container' ) ) ;
263+ this . _register ( this . instantiationService . createInstance ( Link , this . sessionsLinkContainer , { label : localize ( 'openAgentSessionsView' , "Show All Sessions" ) , href : '' , } , {
264+ opener : ( ) => {
265+ // TODO@bpasero remove this check once settled
266+ if ( this . configurationService . getValue ( 'chat.agentSessionsViewLocation' ) === 'single-view' ) {
267+ this . commandService . executeCommand ( AGENT_SESSIONS_VIEW_ID ) ;
268+ } else {
269+ this . commandService . executeCommand ( LEGACY_AGENT_SESSIONS_VIEW_ID ) ;
270+ }
271+ }
272+ } ) ) ;
273+
253274 this . updateSessionsControlVisibility ( false ) ;
254275
255276 this . _register ( this . onDidChangeBodyVisibility ( ( ) => this . updateSessionsControlVisibility ( true ) ) ) ;
@@ -373,14 +394,17 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate {
373394
374395 this . lastDimensions = { height, width } ;
375396
376- let widgetHeight = height ;
397+ let remainingHeight = height ;
377398
378399 // Sessions Control
379- const sessionsControlHeight = this . sessionsContainer ?. offsetHeight ?? 0 ;
380- widgetHeight -= sessionsControlHeight ;
381- this . sessionsControl ?. layout ( sessionsControlHeight , width ) ;
400+ const sessionsContainerHeight = this . sessionsContainer ?. offsetHeight ?? 0 ;
401+ remainingHeight -= sessionsContainerHeight ;
382402
383- this . _widget . layout ( widgetHeight , width ) ;
403+ const sessionsLinkHeight = this . sessionsLinkContainer ?. offsetHeight ?? 0 ;
404+ this . sessionsControl ?. layout ( sessionsContainerHeight - sessionsLinkHeight , width ) ;
405+
406+ // Chat Widget
407+ this . _widget . layout ( remainingHeight , width ) ;
384408 }
385409
386410 override saveState ( ) : void {
0 commit comments