-
Notifications
You must be signed in to change notification settings - Fork 39.3k
Expand file tree
/
Copy pathaiCustomizationManagementEditor.ts
More file actions
2065 lines (1800 loc) · 83 KB
/
aiCustomizationManagementEditor.ts
File metadata and controls
2065 lines (1800 loc) · 83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import './media/aiCustomizationManagement.css';
import * as DOM from '../../../../../base/browser/dom.js';
import { RunOnceScheduler } from '../../../../../base/common/async.js';
import { CancellationToken } from '../../../../../base/common/cancellation.js';
import { VSBuffer } from '../../../../../base/common/buffer.js';
import { onUnexpectedError } from '../../../../../base/common/errors.js';
import { DisposableStore, IReference, toDisposable } from '../../../../../base/common/lifecycle.js';
import { Event } from '../../../../../base/common/event.js';
import { autorun } from '../../../../../base/common/observable.js';
import { Orientation, Sizing, SplitView } from '../../../../../base/browser/ui/splitview/splitview.js';
import { localize } from '../../../../../nls.js';
import { generateUuid } from '../../../../../base/common/uuid.js';
import { IStorageService, StorageScope, StorageTarget } from '../../../../../platform/storage/common/storage.js';
import { ITelemetryService } from '../../../../../platform/telemetry/common/telemetry.js';
import { IThemeService } from '../../../../../platform/theme/common/themeService.js';
import { IEditorOptions } from '../../../../../platform/editor/common/editor.js';
import { EditorPane } from '../../../../browser/parts/editor/editorPane.js';
import { IEditorOpenContext } from '../../../../common/editor.js';
import { IEditorGroup } from '../../../../services/editor/common/editorGroupsService.js';
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
import { IContextKey, IContextKeyService } from '../../../../../platform/contextkey/common/contextkey.js';
import { WorkbenchList } from '../../../../../platform/list/browser/listService.js';
import { IListVirtualDelegate, IListRenderer } from '../../../../../base/browser/ui/list/list.js';
import { ThemeIcon } from '../../../../../base/common/themables.js';
import { Codicon } from '../../../../../base/common/codicons.js';
import { IOpenerService } from '../../../../../platform/opener/common/opener.js';
import { basename, dirname, isEqual, isEqualOrParent } from '../../../../../base/common/resources.js';
import { URI } from '../../../../../base/common/uri.js';
import { registerColor } from '../../../../../platform/theme/common/colorRegistry.js';
import { PANEL_BORDER } from '../../../../common/theme.js';
import { AICustomizationManagementEditorInput } from './aiCustomizationManagementEditorInput.js';
import { AICustomizationListWidget } from './aiCustomizationListWidget.js';
import { McpListWidget } from './mcpListWidget.js';
import { PluginListWidget } from './pluginListWidget.js';
import {
AI_CUSTOMIZATION_MANAGEMENT_EDITOR_ID,
AI_CUSTOMIZATION_MANAGEMENT_SIDEBAR_WIDTH_KEY,
AI_CUSTOMIZATION_MANAGEMENT_SELECTED_SECTION_KEY,
AICustomizationManagementSection,
AICustomizationPromptsStorage,
BUILTIN_STORAGE,
CONTEXT_AI_CUSTOMIZATION_MANAGEMENT_EDITOR,
CONTEXT_AI_CUSTOMIZATION_MANAGEMENT_SECTION,
CONTEXT_AI_CUSTOMIZATION_MANAGEMENT_HARNESS,
SIDEBAR_DEFAULT_WIDTH,
SIDEBAR_MIN_WIDTH,
SIDEBAR_MAX_WIDTH,
CONTENT_MIN_WIDTH,
} from './aiCustomizationManagement.js';
import { agentIcon, instructionsIcon, promptIcon, skillIcon, hookIcon, pluginIcon } from './aiCustomizationIcons.js';
import { ChatModelsWidget } from '../chatManagement/chatModelsWidget.js';
import { PromptsType, Target } from '../../common/promptSyntax/promptTypes.js';
import { IPromptsService, PromptsStorage } from '../../common/promptSyntax/service/promptsService.js';
import { AGENT_MD_FILENAME } from '../../common/promptSyntax/config/promptFileLocations.js';
import { INewPromptOptions, NEW_PROMPT_COMMAND_ID, NEW_INSTRUCTIONS_COMMAND_ID, NEW_AGENT_COMMAND_ID, NEW_SKILL_COMMAND_ID } from '../promptSyntax/newPromptFileActions.js';
import { showConfigureHooksQuickPick } from '../promptSyntax/hookActions.js';
import { resolveWorkspaceTargetDirectory, resolveUserTargetDirectory } from './customizationCreatorService.js';
import { ICommandService } from '../../../../../platform/commands/common/commands.js';
import { IAICustomizationWorkspaceService } from '../../common/aiCustomizationWorkspaceService.js';
import { CodeEditorWidget } from '../../../../../editor/browser/widget/codeEditor/codeEditorWidget.js';
import { ITextModel } from '../../../../../editor/common/model.js';
import { createTextBufferFactoryFromSnapshot } from '../../../../../editor/common/model/textModel.js';
import { IModelService } from '../../../../../editor/common/services/model.js';
import { IResolvedTextEditorModel, ITextModelService } from '../../../../../editor/common/services/resolverService.js';
import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';
import { getSimpleEditorOptions } from '../../../codeEditor/browser/simpleEditorOptions.js';
import { IWorkingCopyService } from '../../../../services/workingCopy/common/workingCopyService.js';
import { IHoverService } from '../../../../../platform/hover/browser/hover.js';
import { IFileService } from '../../../../../platform/files/common/files.js';
import { INotificationService } from '../../../../../platform/notification/common/notification.js';
import { IQuickInputService, IQuickPickItem } from '../../../../../platform/quickinput/common/quickInput.js';
import { IContextMenuService } from '../../../../../platform/contextview/browser/contextView.js';
import { Action } from '../../../../../base/common/actions.js';
import { McpServerEditorInput } from '../../../mcp/browser/mcpServerEditorInput.js';
import { McpServerEditor } from '../../../mcp/browser/mcpServerEditor.js';
import { getDefaultHoverDelegate } from '../../../../../base/browser/ui/hover/hoverDelegateFactory.js';
import { IWorkbenchMcpServer } from '../../../mcp/common/mcpTypes.js';
import { AgentPluginEditor } from '../agentPluginEditor/agentPluginEditor.js';
import { AgentPluginEditorInput } from '../agentPluginEditor/agentPluginEditorInput.js';
import { IAgentPluginItem } from '../agentPluginEditor/agentPluginItems.js';
import { ICustomizationHarnessService, CustomizationHarness, matchesWorkspaceSubpath } from '../../common/customizationHarnessService.js';
import { ChatConfiguration } from '../../common/constants.js';
import { AICustomizationWelcomePage } from './aiCustomizationWelcomePage.js';
import { IViewsService } from '../../../../services/views/common/viewsService.js';
const $ = DOM.$;
//#region Telemetry
type CustomizationEditorOpenedEvent = {
section: string;
};
type CustomizationEditorOpenedClassification = {
section: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The initially selected section when the editor opens.' };
owner: 'joshspicer';
comment: 'Tracks when the Agent Customizations editor is opened.';
};
type CustomizationEditorSectionChangedEvent = {
section: string;
};
type CustomizationEditorSectionChangedClassification = {
section: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The section the user navigated to.' };
owner: 'joshspicer';
comment: 'Tracks section navigation within the Agent Customizations editor.';
};
type CustomizationEditorItemSelectedEvent = {
section: string;
promptType: string;
storage: string;
};
type CustomizationEditorItemSelectedClassification = {
section: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The active section when the item was selected.' };
promptType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The prompt type of the selected item.' };
storage: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The storage location of the selected item (local, user, extension, plugin, builtin).' };
owner: 'joshspicer';
comment: 'Tracks item selection in the Agent Customizations editor.';
};
type CustomizationEditorCreateItemEvent = {
section: string;
promptType: string;
creationMode: 'ai' | 'manual';
target: string;
};
type CustomizationEditorCreateItemClassification = {
section: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The active section when the item was created.' };
promptType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The type of customization being created.' };
creationMode: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the item was created via AI-guided flow or manual creation.' };
target: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The target storage for the new item (workspace, user).' };
owner: 'joshspicer';
comment: 'Tracks customization creation in the Agent Customizations editor.';
};
type CustomizationEditorSaveItemEvent = {
promptType: string;
storage: string;
saveTarget: string;
};
type CustomizationEditorSaveItemClassification = {
promptType: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The type of customization being saved.' };
storage: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The original storage location of the item.' };
saveTarget: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The target storage for the save (workspace, user, existing).' };
owner: 'joshspicer';
comment: 'Tracks save actions in the Agent Customizations editor.';
};
//#endregion
export const aiCustomizationManagementSashBorder = registerColor(
'aiCustomizationManagement.sashBorder',
PANEL_BORDER,
localize('aiCustomizationManagementSashBorder', "The color of the Agent Customizations editor splitview sash border.")
);
//#region Sidebar Section Item
interface ISectionItem {
readonly id: AICustomizationManagementSection;
readonly label: string;
readonly icon: ThemeIcon;
readonly description: string;
count: number;
}
interface ISaveTargetQuickPickItem extends IQuickPickItem {
readonly target: 'workspace' | 'user' | 'cancel';
readonly folder?: URI;
}
interface IBuiltinPromptSaveRequest {
readonly target: 'workspace' | 'user';
readonly folder: URI;
readonly sourceUri: URI;
readonly content: string;
readonly promptType: PromptsType;
readonly projectRoot?: URI;
}
interface IExistingCustomizationSaveRequest {
readonly fileUri: URI;
readonly content: string;
readonly projectRoot?: URI;
}
class SectionItemDelegate implements IListVirtualDelegate<ISectionItem> {
getHeight(): number {
return 26;
}
getTemplateId(): string {
return 'sectionItem';
}
}
interface ISectionItemTemplateData {
readonly container: HTMLElement;
readonly icon: HTMLElement;
readonly label: HTMLElement;
readonly count: HTMLElement;
readonly templateDisposables: DisposableStore;
}
class SectionItemRenderer implements IListRenderer<ISectionItem, ISectionItemTemplateData> {
readonly templateId = 'sectionItem';
constructor(private readonly hoverService: IHoverService) { }
renderTemplate(container: HTMLElement): ISectionItemTemplateData {
container.classList.add('section-list-item');
const icon = DOM.append(container, $('.section-icon'));
const label = DOM.append(container, $('.section-label'));
const count = DOM.append(container, $('.section-count'));
const templateDisposables = new DisposableStore();
return { container, icon, label, count, templateDisposables };
}
renderElement(element: ISectionItem, index: number, templateData: ISectionItemTemplateData): void {
templateData.templateDisposables.clear();
templateData.icon.className = 'section-icon';
templateData.icon.classList.add(...ThemeIcon.asClassNameArray(element.icon));
templateData.label.textContent = element.label;
if (element.count > 0) {
templateData.count.textContent = String(element.count);
templateData.count.style.display = '';
} else {
templateData.count.textContent = '';
templateData.count.style.display = 'none';
}
templateData.templateDisposables.add(this.hoverService.setupManagedHover(getDefaultHoverDelegate('element'), templateData.container, element.description));
}
disposeTemplate(templateData: ISectionItemTemplateData): void {
templateData.templateDisposables.dispose();
}
}
//#endregion
/**
* Editor pane for the AI Customizations Management Editor.
* Provides a global view of all AI customizations with a sidebar for navigation
* and a content area showing a searchable list of items.
*/
export class AICustomizationManagementEditor extends EditorPane {
static readonly ID = AI_CUSTOMIZATION_MANAGEMENT_EDITOR_ID;
private container!: HTMLElement;
private splitViewContainer!: HTMLElement;
private splitView!: SplitView<number>;
private sidebarContainer!: HTMLElement;
private sectionsList!: WorkbenchList<ISectionItem>;
private contentContainer!: HTMLElement;
private listWidget!: AICustomizationListWidget;
private mcpListWidget: McpListWidget | undefined;
private pluginListWidget: PluginListWidget | undefined;
private modelsWidget: ChatModelsWidget | undefined;
private promptsContentContainer!: HTMLElement;
private mcpContentContainer: HTMLElement | undefined;
private pluginContentContainer: HTMLElement | undefined;
private modelsContentContainer: HTMLElement | undefined;
private modelsFooterElement: HTMLElement | undefined;
// Embedded editor state
private editorContentContainer: HTMLElement | undefined;
private embeddedEditor: CodeEditorWidget | undefined;
private editorActionButton!: HTMLButtonElement;
private editorActionButtonIcon!: HTMLElement;
private editorActionButtonInProgress = false;
private editorItemNameElement!: HTMLElement;
private editorItemPathElement!: HTMLElement;
private editorSaveIndicator!: HTMLElement;
private readonly editorModelChangeDisposables = this._register(new DisposableStore());
private readonly builtinEditingSessions = new Map<string, { model: ITextModel; originalContent: string }>();
private currentEditingUri: URI | undefined;
private currentEditingProjectRoot: URI | undefined;
private currentEditingStorage: AICustomizationPromptsStorage | undefined;
private currentEditingPromptType: PromptsType | undefined;
private currentModelRef: IReference<IResolvedTextEditorModel> | undefined;
private viewMode: 'list' | 'editor' | 'mcpDetail' | 'pluginDetail' = 'list';
// Embedded MCP server detail view
private mcpDetailContainer: HTMLElement | undefined;
private embeddedMcpEditor: McpServerEditor | undefined;
private readonly mcpDetailDisposables = this._register(new DisposableStore());
// Embedded plugin detail view
private pluginDetailContainer: HTMLElement | undefined;
private embeddedPluginEditor: AgentPluginEditor | undefined;
private readonly pluginDetailDisposables = this._register(new DisposableStore());
/** Section to restore when navigating back from plugin detail (when opened from a non-plugin section). */
private pluginDetailReturnSection: AICustomizationManagementSection | undefined;
private dimension: DOM.Dimension | undefined;
private readonly sections: ISectionItem[] = [];
private readonly allSections: ISectionItem[] = [];
private selectedSection: AICustomizationManagementSection | undefined;
// Welcome page
private welcomePage: AICustomizationWelcomePage | undefined;
private readonly editorDisposables = this._register(new DisposableStore());
private readonly promptsSectionCountScheduler = this._register(new RunOnceScheduler(() => this._doRefreshAllPromptsSectionCounts(), 100));
private _editorContentChanged = false;
private _previousActiveHarnessId: string | undefined;
// Harness dropdown
private harnessDropdownContainer: HTMLElement | undefined;
private harnessDropdownButton: HTMLElement | undefined;
private harnessDropdownIcon: HTMLElement | undefined;
private harnessDropdownLabel: HTMLElement | undefined;
private sidebarHeaderContainer: HTMLElement | undefined;
private homeButton: HTMLElement | undefined;
private homeButtonLabel: HTMLElement | undefined;
private readonly inEditorContextKey: IContextKey<boolean>;
private readonly sectionContextKey: IContextKey<string>;
private readonly harnessContextKey: IContextKey<string>;
constructor(
group: IEditorGroup,
@ITelemetryService telemetryService: ITelemetryService,
@IThemeService themeService: IThemeService,
@IStorageService private readonly storageService: IStorageService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IContextKeyService contextKeyService: IContextKeyService,
@IOpenerService private readonly openerService: IOpenerService,
@ICommandService private readonly commandService: ICommandService,
@IAICustomizationWorkspaceService private readonly workspaceService: IAICustomizationWorkspaceService,
@IPromptsService private readonly promptsService: IPromptsService,
@ITextModelService private readonly textModelService: ITextModelService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IWorkingCopyService private readonly workingCopyService: IWorkingCopyService,
@IHoverService private readonly hoverService: IHoverService,
@IModelService private readonly modelService: IModelService,
@IQuickInputService private readonly quickInputService: IQuickInputService,
@IContextMenuService private readonly contextMenuService: IContextMenuService,
@IFileService private readonly fileService: IFileService,
@INotificationService private readonly notificationService: INotificationService,
@ICustomizationHarnessService private readonly harnessService: ICustomizationHarnessService,
@IViewsService private readonly viewsService: IViewsService,
) {
super(AICustomizationManagementEditor.ID, group, telemetryService, themeService, storageService);
this.inEditorContextKey = CONTEXT_AI_CUSTOMIZATION_MANAGEMENT_EDITOR.bindTo(contextKeyService);
this.sectionContextKey = CONTEXT_AI_CUSTOMIZATION_MANAGEMENT_SECTION.bindTo(contextKeyService);
this.harnessContextKey = CONTEXT_AI_CUSTOMIZATION_MANAGEMENT_HARNESS.bindTo(contextKeyService);
// Track workspace changes for embedded editor
this._register(autorun(reader => {
this.workspaceService.activeProjectRoot.read(reader);
if (this.viewMode === 'editor') {
this.currentEditingProjectRoot = this.workspaceService.getActiveProjectRoot();
}
}));
this._register(toDisposable(() => {
this.currentModelRef?.dispose();
this.currentModelRef = undefined;
}));
this._register(toDisposable(() => this.disposeBuiltinEditingSessions()));
// Build sections from the workspace service configuration
const sectionInfo: Record<string, { label: string; icon: ThemeIcon; description: string }> = {
[AICustomizationManagementSection.Agents]: { label: localize('agents', "Agents"), icon: agentIcon, description: localize('agentsDesc', "Define custom agents with specialized personas, tool access, and instructions for specific tasks.") },
[AICustomizationManagementSection.Skills]: { label: localize('skills', "Skills"), icon: skillIcon, description: localize('skillsDesc', "Create reusable skill files that provide domain-specific knowledge and workflows.") },
[AICustomizationManagementSection.Instructions]: { label: localize('instructions', "Instructions"), icon: instructionsIcon, description: localize('instructionsDesc', "Set always-on instructions that guide AI behavior across your workspace or user profile.") },
[AICustomizationManagementSection.Prompts]: { label: localize('prompts', "Prompts"), icon: promptIcon, description: localize('promptsDesc', "Reusable prompt templates that can be invoked as slash commands.") },
[AICustomizationManagementSection.Hooks]: { label: localize('hooks', "Hooks"), icon: hookIcon, description: localize('hooksDesc', "Configure automated actions triggered by events like saving files or running tasks.") },
[AICustomizationManagementSection.McpServers]: { label: localize('mcpServers', "MCP Servers"), icon: Codicon.server, description: localize('mcpServersDesc', "Connect external tool servers that extend AI capabilities with custom tools and data sources.") },
[AICustomizationManagementSection.Plugins]: { label: localize('plugins', "Plugins"), icon: pluginIcon, description: localize('pluginsDesc', "Install and manage agent plugins that add additional tools, skills, and integrations.") },
[AICustomizationManagementSection.Models]: { label: localize('models', "Models"), icon: Codicon.vm, description: localize('modelsDesc', "Configure and manage language models available for use.") },
};
for (const id of this.workspaceService.managementSections) {
const info = sectionInfo[id];
if (info) {
this.allSections.push({ id, ...info, count: 0 });
}
}
this.rebuildVisibleSections();
// Restore selected section from storage, falling back to welcome page
const savedSection = this.storageService.get(AI_CUSTOMIZATION_MANAGEMENT_SELECTED_SECTION_KEY, StorageScope.PROFILE);
if (savedSection && this.sections.some(s => s.id === savedSection)) {
this.selectedSection = savedSection as AICustomizationManagementSection;
} else {
this.selectedSection = undefined; // Show welcome page
}
}
protected override createEditor(parent: HTMLElement): void {
this.editorDisposables.clear();
this.container = DOM.append(parent, $('.ai-customization-management-editor'));
this.createSplitView();
this.updateStyles();
}
private createSplitView(): void {
this.splitViewContainer = DOM.append(this.container, $('.management-split-view'));
this.sidebarContainer = $('.management-sidebar');
this.contentContainer = $('.management-content');
this.createSidebar();
this.createContent();
this.splitView = this.editorDisposables.add(new SplitView(this.splitViewContainer, {
orientation: Orientation.HORIZONTAL,
proportionalLayout: true,
}));
const savedWidth = this.storageService.getNumber(AI_CUSTOMIZATION_MANAGEMENT_SIDEBAR_WIDTH_KEY, StorageScope.PROFILE, SIDEBAR_DEFAULT_WIDTH);
// Sidebar view
this.splitView.addView({
onDidChange: Event.None,
element: this.sidebarContainer,
minimumSize: SIDEBAR_MIN_WIDTH,
maximumSize: SIDEBAR_MAX_WIDTH,
layout: (width, _, height) => {
this.sidebarContainer.style.width = `${width}px`;
if (height !== undefined) {
this.sectionsList.layout(height - 8, width);
}
},
}, savedWidth, undefined, true);
// Content view
this.splitView.addView({
onDidChange: Event.None,
element: this.contentContainer,
minimumSize: CONTENT_MIN_WIDTH,
maximumSize: Number.POSITIVE_INFINITY,
layout: (width, _, height) => {
this.contentContainer.style.width = `${width}px`;
if (height !== undefined) {
this.listWidget.layout(height - 16, width - 24);
this.mcpListWidget?.layout(height - 16, width - 24);
this.pluginListWidget?.layout(height - 16, width - 24);
const modelsFooterHeight = this.modelsFooterElement?.offsetHeight || 80;
this.modelsWidget?.layout(height - 16 - modelsFooterHeight, width);
if (this.viewMode === 'editor' && this.embeddedEditor) {
const editorHeaderHeight = 50;
const padding = 24;
this.embeddedEditor.layout({ width: Math.max(0, width - padding), height: Math.max(0, height - editorHeaderHeight - padding) });
}
if (this.viewMode === 'mcpDetail' && this.embeddedMcpEditor) {
const backHeaderHeight = 40;
this.embeddedMcpEditor.layout(new DOM.Dimension(width, Math.max(0, height - backHeaderHeight)));
}
if (this.viewMode === 'pluginDetail' && this.embeddedPluginEditor) {
const backHeaderHeight = 40;
this.embeddedPluginEditor.layout(new DOM.Dimension(width, Math.max(0, height - backHeaderHeight)));
}
}
},
}, Sizing.Distribute, undefined, true);
// Persist sidebar width
this.editorDisposables.add(this.splitView.onDidSashChange(() => {
const width = this.splitView.getViewSize(0);
this.storageService.store(AI_CUSTOMIZATION_MANAGEMENT_SIDEBAR_WIDTH_KEY, width, StorageScope.PROFILE, StorageTarget.USER);
}));
// Reset on double-click
this.editorDisposables.add(this.splitView.onDidSashReset(() => {
const totalWidth = this.splitView.getViewSize(0) + this.splitView.getViewSize(1);
this.splitView.resizeView(0, SIDEBAR_DEFAULT_WIDTH);
this.splitView.resizeView(1, totalWidth - SIDEBAR_DEFAULT_WIDTH);
}));
}
/**
* Whether the harness selector UI is enabled.
* When disabled, the editor behaves as if "Local" is always selected.
*/
private get isHarnessSelectorEnabled(): boolean {
return this.configurationService.getValue<boolean>(ChatConfiguration.ChatCustomizationHarnessSelectorEnabled) !== false;
}
/**
* Rebuilds the visible sections list based on the active harness's
* `hiddenSections`. If the current selection falls into a hidden
* section, the first visible section is selected instead.
*/
private rebuildVisibleSections(): void {
let hidden: Set<string>;
if (this.isHarnessSelectorEnabled) {
const activeId = this.harnessService.activeHarness.get();
const descriptor = this.harnessService.availableHarnesses.get().find(h => h.id === activeId);
hidden = new Set(descriptor?.hiddenSections ?? []);
} else {
hidden = new Set(); // Local harness has no hidden sections
}
this.sections.length = 0;
for (const s of this.allSections) {
if (!hidden.has(s.id)) {
this.sections.push(s);
}
}
// Update the list widget if it exists
if (this.sectionsList) {
this.sectionsList.splice(0, this.sectionsList.length, this.sections);
}
// Rebuild welcome cards to reflect new visible sections
this.welcomePage?.rebuildCards(new Set(this.sections.map(s => s.id)));
// If the current selection is hidden, fall back to welcome page
if (this.selectedSection !== undefined && !this.sections.some(s => s.id === this.selectedSection) && this.sections.length > 0) {
this.showWelcomePage();
} else {
this.ensureSectionsListReflectsActiveSection();
}
}
private createSidebar(): void {
const sidebarContent = DOM.append(this.sidebarContainer, $('.sidebar-content'));
// Header row with home button and optional harness dropdown
this.createSidebarHeader(sidebarContent);
// Main sections list container (takes remaining space)
const sectionsListContainer = DOM.append(sidebarContent, $('.sidebar-sections-list'));
this.sectionsList = this.editorDisposables.add(this.instantiationService.createInstance(
WorkbenchList<ISectionItem>,
'AICustomizationManagementSections',
sectionsListContainer,
new SectionItemDelegate(),
[new SectionItemRenderer(this.hoverService)],
{
multipleSelectionSupport: false,
setRowLineHeight: false,
horizontalScrolling: false,
accessibilityProvider: {
getAriaLabel: (item: ISectionItem) => item.label,
getWidgetAriaLabel: () => localize('sectionsAriaLabel', "Agent Customization Sections"),
},
openOnSingleClick: true,
identityProvider: {
getId: (item: ISectionItem) => item.id,
},
}
));
this.sectionsList.splice(0, this.sectionsList.length, this.sections);
this.ensureSectionsListReflectsActiveSection();
this.editorDisposables.add(this.sectionsList.onDidChangeSelection(e => {
if (e.elements.length === 0) {
if (this.selectedSection !== undefined) {
this.showWelcomePage();
}
return;
}
this.selectSection(e.elements[0].id);
}));
// React to harness changes — rebuild visible sections and refresh counts.
// Also track availableHarnesses to handle agent registration/unregistration.
this.editorDisposables.add(autorun(reader => {
const available = this.harnessService.availableHarnesses.read(reader);
const activeId = this.harnessService.activeHarness.read(reader);
// If the active harness is no longer available, fall back to the default
if (!available.some(h => h.id === activeId) && available.length > 0) {
this.harnessService.setActiveHarness(available[0].id);
return; // setActiveHarness will trigger another autorun cycle
}
this.harnessContextKey.set(activeId);
this.rebuildVisibleSections();
this.ensureHarnessDropdown();
this.updateHarnessDropdown();
// Reset counts to zero immediately on harness switch to prevent
// stale counts from the previous harness flashing before the async
// count refresh completes. Only reset when the active harness
// actually changed to avoid flicker on harness registration events.
if (this._previousActiveHarnessId !== undefined && this._previousActiveHarnessId !== activeId) {
for (const section of this.sections) {
this.updateSectionCount(section.id, 0);
}
}
this._previousActiveHarnessId = activeId;
this.refreshAllPromptsSectionCounts();
}));
// When the harness selector setting is off, lock to Local harness.
// In Sessions (single CLI harness) the dropdown is already hidden and
// setActiveHarness(VSCode) is a safe no-op since the CLI harness
// remains active — filtering stays correct for that window.
if (!this.isHarnessSelectorEnabled) {
this.harnessService.setActiveHarness(CustomizationHarness.VSCode);
}
this.editorDisposables.add(this.configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration(ChatConfiguration.ChatCustomizationHarnessSelectorEnabled)) {
if (!this.isHarnessSelectorEnabled) {
this.harnessService.setActiveHarness(CustomizationHarness.VSCode);
}
}
}));
}
private createSidebarHeader(sidebarContent: HTMLElement): void {
const headerRow = this.sidebarHeaderContainer = DOM.append(sidebarContent, $('.sidebar-header-row'));
// Home/overview button
const homeButton = this.homeButton = DOM.append(headerRow, $('button.sidebar-home-button'));
homeButton.setAttribute('aria-label', localize('homeButton', "Overview"));
this.editorDisposables.add(this.hoverService.setupManagedHover(getDefaultHoverDelegate('element'), homeButton, localize('homeButtonTooltip', "Back to overview")));
const homeIcon = DOM.append(homeButton, $('span.sidebar-home-icon'));
homeIcon.classList.add(...ThemeIcon.asClassNameArray(Codicon.home));
homeIcon.setAttribute('aria-hidden', 'true');
const homeLabel = this.homeButtonLabel = DOM.append(homeButton, $('span.sidebar-home-label'));
homeLabel.textContent = localize('overview', "Overview");
this.editorDisposables.add(DOM.addDisposableListener(homeButton, 'click', () => {
this.showWelcomePage();
}));
// Harness dropdown (shown when multiple harnesses available)
this.createHarnessDropdown(headerRow);
this.updateHomeButtonStyle();
}
private createHarnessDropdown(parent: HTMLElement): void {
if (!this.isHarnessSelectorEnabled) {
return;
}
const container = this.harnessDropdownContainer = DOM.append(parent, $('.sidebar-harness-dropdown'));
this.harnessDropdownButton = DOM.append(container, $('button.harness-dropdown-button'));
this.harnessDropdownButton.setAttribute('aria-label', localize('selectHarness', "Select customization target"));
this.harnessDropdownButton.setAttribute('aria-haspopup', 'listbox');
this.editorDisposables.add(this.hoverService.setupManagedHover(getDefaultHoverDelegate('element'), this.harnessDropdownButton, () => {
const descriptor = this.harnessService.availableHarnesses.get().find(h => h.id === this.harnessService.activeHarness.get());
return descriptor?.label ?? '';
}));
this.harnessDropdownIcon = DOM.append(this.harnessDropdownButton, $('span.harness-dropdown-icon'));
this.harnessDropdownLabel = DOM.append(this.harnessDropdownButton, $('span.harness-dropdown-label'));
DOM.append(this.harnessDropdownButton, $('span.harness-dropdown-chevron.codicon.codicon-chevron-down'));
this.updateHarnessDropdown();
this.editorDisposables.add(DOM.addDisposableListener(this.harnessDropdownButton, 'click', () => {
this.showHarnessMenu();
}));
}
/**
* Lazily creates the harness dropdown if it doesn't exist but
* multiple harnesses are now available, or hides it if only one
* harness remains (e.g. after an extension-contributed harness is
* unregistered).
*/
private ensureHarnessDropdown(): void {
if (!this.isHarnessSelectorEnabled && this.harnessDropdownContainer) {
// Setting is off — remove the dropdown entirely
this.harnessDropdownContainer.remove();
this.harnessDropdownContainer = undefined;
this.harnessDropdownButton = undefined;
this.harnessDropdownIcon = undefined;
this.harnessDropdownLabel = undefined;
this.updateHomeButtonStyle();
} else if (this.isHarnessSelectorEnabled && !this.harnessDropdownContainer && this.sidebarHeaderContainer) {
this.createHarnessDropdown(this.sidebarHeaderContainer);
this.updateHomeButtonStyle();
}
// Visibility is handled by updateHarnessDropdown based on harness count
}
private updateHomeButtonStyle(): void {
if (!this.homeButtonLabel || !this.homeButton) {
return;
}
// Show full label when harness dropdown is hidden, icon-only when visible
const harnessVisible = this.harnessDropdownContainer && this.harnessDropdownContainer.style.display !== 'none';
this.homeButtonLabel.style.display = harnessVisible ? 'none' : '';
this.homeButton.style.flex = harnessVisible ? '' : '1';
}
private updateHarnessDropdown(): void {
if (!this.harnessDropdownContainer || !this.harnessDropdownIcon || !this.harnessDropdownLabel) {
return;
}
const harnesses = this.harnessService.availableHarnesses.get();
// Hide dropdown when only one harness is available
this.harnessDropdownContainer.style.display = harnesses.length <= 1 ? 'none' : '';
this.updateHomeButtonStyle();
const activeId = this.harnessService.activeHarness.get();
const descriptor = harnesses.find(h => h.id === activeId);
if (descriptor) {
this.harnessDropdownIcon.className = 'harness-dropdown-icon';
this.harnessDropdownIcon.classList.add(...ThemeIcon.asClassNameArray(descriptor.icon));
this.harnessDropdownLabel.textContent = descriptor.label;
}
}
private showHarnessMenu(): void {
if (!this.harnessDropdownButton) {
return;
}
const harnesses = this.harnessService.availableHarnesses.get();
const activeId = this.harnessService.activeHarness.get();
const actions = harnesses.map(h => {
const action = new Action(h.id, h.label, ThemeIcon.asClassName(h.icon), true, () => {
this.harnessService.setActiveHarness(h.id);
});
action.checked = h.id === activeId;
return action;
});
this.contextMenuService.showContextMenu({
getAnchor: () => this.harnessDropdownButton!,
getActions: () => actions,
getCheckedActionsRepresentation: () => 'radio',
});
}
private createWelcomePage(parent: HTMLElement): void {
this.welcomePage = this.editorDisposables.add(new AICustomizationWelcomePage(
parent,
this.workspaceService.welcomePageFeatures,
{
selectSection: (section) => this.selectSection(section),
selectSectionWithMarketplace: (section) => this.selectSection(section, { showMarketplace: true }),
closeEditor: () => {
if (this.input) {
this.group.closeEditor(this.input);
}
},
prefillChat: async (query, options) => {
try {
if (this.workspaceService.isSessionsWindow) {
const sessionsViewId = 'workbench.view.sessions.chat';
if (options?.newChat) {
await this.commandService.executeCommand('workbench.action.sessions.newChat');
}
const view = await this.viewsService.openView(sessionsViewId, true);
const chatView = view as unknown as { prefillInput?(text: string): void; sendQuery?(text: string): void } | undefined;
if (options?.isPartialQuery && chatView?.prefillInput) {
chatView.prefillInput(query);
} else if (chatView?.sendQuery) {
chatView.sendQuery(query);
}
} else {
if (options?.newChat) {
await this.commandService.executeCommand('workbench.action.chat.newChat');
}
await this.commandService.executeCommand('workbench.action.chat.open', { query, isPartialQuery: options?.isPartialQuery ?? false });
}
} catch (err) {
onUnexpectedError(err);
}
},
},
this.commandService,
this.workspaceService,
this.hoverService,
));
this.welcomePage.rebuildCards(new Set(this.sections.map(s => s.id)));
}
private createBackArrowButton(): HTMLButtonElement {
const button = $('button.section-back-arrow-button') as HTMLButtonElement;
button.type = 'button';
button.setAttribute('aria-label', localize('backToOverview', "Back to overview"));
this.editorDisposables.add(this.hoverService.setupManagedHover(getDefaultHoverDelegate('element'), button, localize('backToOverviewTooltip', "Back to overview")));
const icon = DOM.append(button, $('span.section-back-arrow-icon'));
icon.classList.add(...ThemeIcon.asClassNameArray(Codicon.arrowLeft));
icon.setAttribute('aria-hidden', 'true');
this.editorDisposables.add(DOM.addDisposableListener(button, 'click', () => {
this.showWelcomePage();
}));
return button;
}
private injectBackArrowIntoSearchRow(widget: { prependToSearchRow(el: HTMLElement): void }): void {
widget.prependToSearchRow(this.createBackArrowButton());
}
private createContent(): void {
const contentInner = DOM.append(this.contentContainer, $('.content-inner'));
// Welcome page (shown when no section is selected)
this.createWelcomePage(contentInner);
// Container for prompts-based content (Agents, Skills, Instructions, Prompts)
this.promptsContentContainer = DOM.append(contentInner, $('.prompts-content-container'));
this.listWidget = this.editorDisposables.add(this.instantiationService.createInstance(AICustomizationListWidget));
this.promptsContentContainer.appendChild(this.listWidget.element);
this.injectBackArrowIntoSearchRow(this.listWidget);
// Handle item selection
this.editorDisposables.add(this.listWidget.onDidSelectItem(item => {
this.telemetryService.publicLog2<CustomizationEditorItemSelectedEvent, CustomizationEditorItemSelectedClassification>('chatCustomizationEditor.itemSelected', {
section: this.selectedSection ?? 'welcome',
promptType: item.promptType,
storage: item.storage ?? 'external',
});
const storage = item.storage;
const isWorkspaceFile = storage === PromptsStorage.local;
const isReadOnly = !storage || storage === PromptsStorage.extension || storage === PromptsStorage.plugin || storage === BUILTIN_STORAGE;
this.showEmbeddedEditor(item.uri, item.name, item.promptType, storage ?? BUILTIN_STORAGE, isWorkspaceFile, isReadOnly);
}));
// Handle create actions - AI-guided creation
this.editorDisposables.add(this.listWidget.onDidRequestCreate(promptType => {
this.createNewItemWithAI(promptType);
}));
// Handle manual create actions - open editor directly
this.editorDisposables.add(this.listWidget.onDidRequestCreateManual(({ type, target, rootFileName }) => {
this.createNewItemManual(type, target, rootFileName);
}));
// Container for Models content (only in sessions)
const hasSections = new Set(this.workspaceService.managementSections);
if (hasSections.has(AICustomizationManagementSection.Models)) {
this.modelsContentContainer = DOM.append(contentInner, $('.models-content-container'));
const modelsBackBar = DOM.append(this.modelsContentContainer, $('.section-back-bar'));
modelsBackBar.appendChild(this.createBackArrowButton());
this.modelsWidget = this.editorDisposables.add(this.instantiationService.createInstance(ChatModelsWidget));
this.modelsContentContainer.appendChild(this.modelsWidget.element);
this.modelsFooterElement = DOM.append(this.modelsContentContainer, $('.section-footer'));
const modelsDescription = DOM.append(this.modelsFooterElement, $('p.section-footer-description'));
modelsDescription.textContent = localize('modelsDescription', "Browse and manage language models from different providers. Select models for use in chat, code completion, and other AI features.");
const modelsLink = DOM.append(this.modelsFooterElement, $('a.section-footer-link')) as HTMLAnchorElement;
modelsLink.textContent = localize('learnMoreModels', "Learn more about language models");
modelsLink.href = 'https://code.visualstudio.com/docs/copilot/customization/language-models';
this.editorDisposables.add(DOM.addDisposableListener(modelsLink, 'click', (e) => {
e.preventDefault();
this.openerService.open(URI.parse(modelsLink.href));
}));
}
// Container for MCP content
if (hasSections.has(AICustomizationManagementSection.McpServers)) {
this.mcpContentContainer = DOM.append(contentInner, $('.mcp-content-container'));
this.mcpListWidget = this.editorDisposables.add(this.instantiationService.createInstance(McpListWidget));
this.mcpContentContainer.appendChild(this.mcpListWidget.element);
this.injectBackArrowIntoSearchRow(this.mcpListWidget);
// Embedded MCP server detail view
this.mcpDetailContainer = DOM.append(contentInner, $('.mcp-detail-container'));
this.createEmbeddedMcpDetail();
this.editorDisposables.add(this.mcpListWidget.onDidSelectServer(server => {
this.showEmbeddedMcpDetail(server);
}));
this.editorDisposables.add(this.mcpListWidget.onDidRequestShowPlugin(item => {
this.showPluginDetail(item);
}));
}
// Container for Plugins content
if (hasSections.has(AICustomizationManagementSection.Plugins)) {
this.pluginContentContainer = DOM.append(contentInner, $('.plugin-content-container'));
this.pluginListWidget = this.editorDisposables.add(this.instantiationService.createInstance(PluginListWidget));
this.pluginContentContainer.appendChild(this.pluginListWidget.element);
this.injectBackArrowIntoSearchRow(this.pluginListWidget);
// Embedded plugin detail view
this.pluginDetailContainer = DOM.append(contentInner, $('.plugin-detail-container'));
this.createEmbeddedPluginDetail();
this.editorDisposables.add(this.pluginListWidget.onDidSelectPlugin(item => {
this.pluginDetailReturnSection = undefined;
this.showEmbeddedPluginDetail(item);
}));
}
// Embedded editor container
this.editorContentContainer = DOM.append(contentInner, $('.editor-content-container'));
this.createEmbeddedEditor();
// Set initial visibility based on selected section
this.updateContentVisibility();
// Wire up section count updates — active prompts section gets its count
// from the list widget; all prompts sections are also refreshed from
// the prompts service on every change event for consistency.
this.editorDisposables.add(this.listWidget.onDidChangeItemCount(count => {
if (this.isPromptsSection(this.selectedSection)) {
this.updateSectionCount(this.selectedSection, count);
}
}));
if (this.mcpListWidget) {
this.editorDisposables.add(this.mcpListWidget.onDidChangeItemCount(count => {
this.updateSectionCount(AICustomizationManagementSection.McpServers, count);
}));
this.mcpListWidget.fireItemCount();
}
if (this.pluginListWidget) {
this.editorDisposables.add(this.pluginListWidget.onDidChangeItemCount(count => {
this.updateSectionCount(AICustomizationManagementSection.Plugins, count);
}));
this.pluginListWidget.fireItemCount();
}
if (this.modelsWidget) {
this.editorDisposables.add(this.modelsWidget.onDidChangeItemCount(count => {
this.updateSectionCount(AICustomizationManagementSection.Models, count);
}));
this.modelsWidget.fireItemCount();
}
// Any prompts data change → refresh ALL prompts section counts (debounced)
this.editorDisposables.add(this.promptsService.onDidChangeCustomAgents(() => this.refreshAllPromptsSectionCounts()));
this.editorDisposables.add(this.promptsService.onDidChangeSkills(() => this.refreshAllPromptsSectionCounts()));
this.editorDisposables.add(this.promptsService.onDidChangeInstructions(() => this.refreshAllPromptsSectionCounts()));
this.editorDisposables.add(this.promptsService.onDidChangeSlashCommands(() => this.refreshAllPromptsSectionCounts()));
// Load initial counts for all sections
this.refreshAllPromptsSectionCounts();
// Load items for the initial section
if (this.isPromptsSection(this.selectedSection)) {
void this.listWidget.setSection(this.selectedSection);
}
}
private isPromptsSection(section: AICustomizationManagementSection | undefined): section is AICustomizationManagementSection {
return section === AICustomizationManagementSection.Agents ||
section === AICustomizationManagementSection.Skills ||
section === AICustomizationManagementSection.Instructions ||
section === AICustomizationManagementSection.Prompts ||
section === AICustomizationManagementSection.Hooks;
}
//#region Section Counts
/**
* Updates the count for a specific section and re-renders the sidebar.
*/
private updateSectionCount(sectionId: AICustomizationManagementSection, count: number): void {
const section = this.sections.find(s => s.id === sectionId);
if (!section || section.count === count) {
return;
}
section.count = count;
// Re-splice the sections list to trigger re-render
this.sectionsList.splice(0, this.sectionsList.length, this.sections);
this.ensureSectionsListReflectsActiveSection();
}
/**
* Schedules a debounced refresh of all prompts-based section counts.
*/
private refreshAllPromptsSectionCounts(): void {
this.promptsSectionCountScheduler.schedule();
}
/**
* Performs the actual refresh of all prompts-based section counts.
* Uses the list widget's shared item-loading logic so sidebar counts
* match the per-group counts shown inside each section.
*/
private _doRefreshAllPromptsSectionCounts(): void {
for (const section of this.sections) {
if (this.isPromptsSection(section.id)) {
this.listWidget.computeItemCountForSection(section.id).then(count => {
this.updateSectionCount(section.id, count);
}, onUnexpectedError);
}
}
}
//#endregion
/**
* Navigates to the welcome page (no section selected).
*/
public showWelcomePage(): void {
if (this.viewMode === 'editor') {
this.goBackToList();
}
if (this.viewMode === 'mcpDetail') {
this.goBackFromMcpDetail();
}