Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import { ChatAgentLocation, ChatConfiguration, ChatModeKind } from '../../chat/c
import { ChatContextKeys } from '../../chat/common/actions/chatContextKeys.js';
import { ChatWidget } from '../../chat/browser/widget/chatWidget.js';
import { IAgentSessionsService } from '../../chat/browser/agentSessions/agentSessionsService.js';
import { AgentSessionProviders } from '../../chat/browser/agentSessions/agentSessions.js';
import { AgentSessionProviders, getAgentSessionProvider } from '../../chat/browser/agentSessions/agentSessions.js';
import { IAgentSession } from '../../chat/browser/agentSessions/agentSessionsModel.js';
import { AgentSessionsWelcomeEditorOptions, AgentSessionsWelcomeInput } from './agentSessionsWelcomeInput.js';
import { IChatService } from '../../chat/common/chatService/chatService.js';
Expand All @@ -59,6 +59,7 @@ import { IWorkspaceTrustManagementService } from '../../../../platform/workspace
import { IViewDescriptorService, ViewContainerLocation } from '../../../common/views.js';

const configurationKey = 'workbench.startupEditor';
const SELECTED_SESSION_PROVIDER_KEY = 'agentSessionsWelcome.selectedSessionProvider';
const MAX_SESSIONS = 6;
const MAX_REPO_PICKS = 10;
const MAX_WALKTHROUGHS = 10;
Expand All @@ -80,7 +81,7 @@ export class AgentSessionsWelcomePage extends EditorPane {
private readonly contentDisposables = this._register(new DisposableStore());
private contextService: IContextKeyService;
private walkthroughs: IResolvedWalkthrough[] = [];
private _selectedSessionProvider: AgentSessionProviders = AgentSessionProviders.Local;
private _selectedSessionProvider: AgentSessionProviders;
private _selectedWorkspace: IWorkspacePickerItem | undefined;
private _recentWorkspaces: Array<IRecentWorkspace | IRecentFolder> = [];
private _isEmptyWorkspace: boolean = false;
Expand Down Expand Up @@ -110,6 +111,11 @@ export class AgentSessionsWelcomePage extends EditorPane {
) {
super(AgentSessionsWelcomePage.ID, group, telemetryService, themeService, storageService);

// Restore persisted session provider or default to Local
const persistedProvider = this.storageService.get(SELECTED_SESSION_PROVIDER_KEY, StorageScope.APPLICATION);
const validatedProvider = persistedProvider ? getAgentSessionProvider(persistedProvider) : undefined;
this._selectedSessionProvider = validatedProvider ?? AgentSessionProviders.Local;

this.container = $('.agentSessionsWelcome', {
role: 'document',
tabindex: 0,
Expand Down Expand Up @@ -239,6 +245,7 @@ export class AgentSessionsWelcomePage extends EditorPane {
getActiveSessionProvider: () => this._selectedSessionProvider,
setActiveSessionProvider: (provider: AgentSessionProviders) => {
this._selectedSessionProvider = provider;
this.storageService.store(SELECTED_SESSION_PROVIDER_KEY, provider, StorageScope.APPLICATION, StorageTarget.USER);
onDidChangeActiveSessionProvider.fire(provider);
try {
recreateSessionForProvider(provider);
Expand Down