@codingame/monaco-vscode-walkthrough-service-override 36.2.7 → 37.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/package.json +2 -3
  2. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.d.ts +1 -1
  3. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.contribution.js +24 -24
  4. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.d.ts +1 -1
  5. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.js +42 -42
  6. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedAccessibleView.js +3 -3
  7. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedColors.js +7 -7
  8. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedExtensionPoint.js +37 -37
  9. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedIcons.js +2 -2
  10. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService._contribution.js +3 -3
  11. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService.js +2 -2
  12. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/startupPage.js +3 -3
  13. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent.js +151 -151
  14. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/media/notebookProfile.d.ts +1 -1
  15. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/media/notebookProfile.js +3 -3
  16. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker.d.ts +1 -1
  17. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker.js +5 -5
  18. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker_small.d.ts +1 -1
  19. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/common/media/theme_picker_small.js +4 -4
  20. package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/editor/editorWalkThrough.js +3 -3
  21. package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThrough.contribution.js +2 -2
  22. package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/browser/walkThroughPart.js +2 -2
  23. package/vscode/src/vs/workbench/contrib/welcomeWalkthrough/common/walkThroughUtils.js +1 -1
  24. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsBanner.d.ts +0 -30
  25. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsBanner.js +0 -38
  26. package/vscode/src/vs/workbench/contrib/welcomeAgentSessions/browser/agentSessionsWelcome.d.ts +0 -105
  27. package/vscode/src/vs/workbench/contrib/welcomeAgentSessions/browser/agentSessionsWelcome.js +0 -744
  28. package/vscode/src/vs/workbench/contrib/welcomeAgentSessions/browser/agentSessionsWelcomeInput.d.ts +0 -33
  29. package/vscode/src/vs/workbench/contrib/welcomeAgentSessions/browser/agentSessionsWelcomeInput.js +0 -71
  30. package/vscode/src/vs/workbench/contrib/welcomeAgentSessions/browser/media/agentSessionsWelcome.css +0 -553
  31. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedInput.d.ts +0 -44
  32. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedInput.js +0 -96
  33. package/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/media/gettingStarted.css +0 -1140
@@ -1,744 +0,0 @@
1
-
2
- import { registerCss } from '@codingame/monaco-vscode-api/css';
3
- import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
4
- import * as agentSessionsWelcome from './media/agentSessionsWelcome.css';
5
- import { $, clearNode, append, createTextNode, getWindow, scheduleAtNextAnimationFrame, addDisposableListener } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
6
- import { renderIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/iconLabel/iconLabels';
7
- import { DomScrollableElement } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/scrollbar/scrollableElement';
8
- import { Toggle } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/toggle/toggle';
9
- import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
10
- import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
11
- import { DisposableStore, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
12
- import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
13
- import { ScrollbarVisibility } from '@codingame/monaco-vscode-api/vscode/vs/base/common/scrollable';
14
- import { basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
15
- import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
16
- import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
17
- import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
18
- import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
19
- import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
20
- import { ServiceCollection } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/serviceCollection';
21
- import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
22
- import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
23
- import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
24
- import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
25
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colorUtils';
26
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/baseColors';
27
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/chartsColors';
28
- import { editorBackground } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/editorColors';
29
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/inputColors';
30
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/listColors';
31
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/menuColors';
32
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/minimapColors';
33
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/miscColors';
34
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/quickpickColors';
35
- import '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/colors/searchColors';
36
- import { getListStyles, getToggleStyles } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/defaultStyles';
37
- import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
38
- import { EditorPane } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/parts/editor/editorPane';
39
- import { SIDE_BAR_FOREGROUND } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/theme';
40
- import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
41
- import { IWorkbenchLayoutService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/layout/browser/layoutService.service';
42
- import { ChatAgentLocation, ChatModeKind, ChatConfiguration } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
43
- import { ChatContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/actions/chatContextKeys';
44
- import { ChatWidget } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/chat/browser/widget/chatWidget';
45
- import { IAgentSessionsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.service';
46
- import { AgentSessionProviders } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessions';
47
- import './agentSessionsWelcomeInput.js';
48
- import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
49
- import { ChatViewId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat';
50
- import { IChatWidgetService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chat.service';
51
- import { getResourceForNewChatSession, ChatSessionPosition } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution';
52
- import { IChatEntitlementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService.service';
53
- import { AgentSessionsControl } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsControl';
54
- import { AgentSessionsFilter } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsFilter';
55
- import { AgentSessionsListDelegate } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsViewer';
56
- import { HoverPosition } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverWidget';
57
- import { IWalkthroughsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedService.service';
58
- import { GettingStartedInput } from '../../welcomeGettingStarted/browser/gettingStartedInput.js';
59
- import { IMarkdownRendererService } from '@codingame/monaco-vscode-api/vscode/vs/platform/markdown/browser/markdownRenderer.service';
60
- import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
61
- import { WorkbenchState } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace';
62
- import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
63
- import { isRecentFolder, isRecentWorkspace } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspaces/common/workspaces';
64
- import { IWorkspacesService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspaces/common/workspaces.service';
65
- import { IHostService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/host/browser/host.service';
66
- import { IWorkspaceTrustManagementService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspaceTrust.service';
67
- import { ViewContainerLocation } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views';
68
- import { IViewDescriptorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/views.service';
69
- import { toErrorMessage } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errorMessage';
70
- import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
71
- import { canShowAgentsBanner, createAgentsBanner } from '../../chat/browser/agentSessions/agentSessionsBanner.js';
72
-
73
- var AgentSessionsWelcomePage_1;
74
- registerCss(agentSessionsWelcome);
75
- const configurationKey = "workbench.startupEditor";
76
- const MAX_SESSIONS = 6;
77
- const MAX_REPO_PICKS = 10;
78
- const MAX_WALKTHROUGHS = 10;
79
- const WELCOME_CHAT_INPUT_LAYOUT_HEIGHT = 150;
80
- const WELCOME_CHAT_INPUT_RESERVED_LIST_HEIGHT = 50;
81
- const WELCOME_CHAT_INPUT_RESERVED_CHROME_HEIGHT = 72;
82
- const WELCOME_CHAT_INPUT_MAX_HEIGHT_OVERRIDE = WELCOME_CHAT_INPUT_LAYOUT_HEIGHT + WELCOME_CHAT_INPUT_RESERVED_LIST_HEIGHT + WELCOME_CHAT_INPUT_RESERVED_CHROME_HEIGHT;
83
- let AgentSessionsWelcomePage = class AgentSessionsWelcomePage extends EditorPane {
84
- static {
85
- AgentSessionsWelcomePage_1 = this;
86
- }
87
- static {
88
- this.ID = "agentSessionsWelcomePage";
89
- }
90
- static {
91
- this.COMMAND_ID = "workbench.action.openAgentSessionsWelcome";
92
- }
93
- constructor(
94
- group,
95
- telemetryService,
96
- themeService,
97
- storageService,
98
- instantiationService,
99
- contextKeyService,
100
- layoutService,
101
- commandService,
102
- editorService,
103
- agentSessionsService,
104
- configurationService,
105
- productService,
106
- walkthroughsService,
107
- chatService,
108
- chatEntitlementService,
109
- markdownRendererService,
110
- workspaceContextService,
111
- workspacesService,
112
- hostService,
113
- workspaceTrustManagementService,
114
- viewDescriptorService,
115
- chatWidgetService,
116
- logService
117
- ) {
118
- super(
119
- AgentSessionsWelcomePage_1.ID,
120
- group,
121
- telemetryService,
122
- themeService,
123
- storageService
124
- );
125
- this.storageService = storageService;
126
- this.instantiationService = instantiationService;
127
- this.layoutService = layoutService;
128
- this.commandService = commandService;
129
- this.editorService = editorService;
130
- this.agentSessionsService = agentSessionsService;
131
- this.configurationService = configurationService;
132
- this.productService = productService;
133
- this.walkthroughsService = walkthroughsService;
134
- this.chatService = chatService;
135
- this.chatEntitlementService = chatEntitlementService;
136
- this.markdownRendererService = markdownRendererService;
137
- this.workspaceContextService = workspaceContextService;
138
- this.workspacesService = workspacesService;
139
- this.hostService = hostService;
140
- this.workspaceTrustManagementService = workspaceTrustManagementService;
141
- this.viewDescriptorService = viewDescriptorService;
142
- this.chatWidgetService = chatWidgetService;
143
- this.logService = logService;
144
- this.sessionsControlDisposables = this._register(( new DisposableStore()));
145
- this.contentDisposables = this._register(( new DisposableStore()));
146
- this.walkthroughs = [];
147
- this._selectedSessionProvider = AgentSessionProviders.Local;
148
- this._recentTrustedWorkspaces = [];
149
- this._isEmptyWorkspace = false;
150
- this._workspaceKind = "empty";
151
- this._openedAt = 0;
152
- this.container = $(".agentSessionsWelcome", {
153
- role: "document",
154
- tabindex: 0,
155
- "aria-label": ( localize(16689, "Overview of agent sessions and how to get started."))
156
- });
157
- this.contextService = this._register(contextKeyService.createScoped(this.container));
158
- ChatContextKeys.inAgentSessionsWelcome.bindTo(this.contextService).set(true);
159
- this._register(this.chatEntitlementService.onDidChangeSentiment(() => {
160
- const input = this.input || this._storedInput;
161
- if (this.chatEntitlementService.sentiment.hidden && input) {
162
- this._closedBy = "chatHidden";
163
- this.group.closeEditor(input);
164
- }
165
- }));
166
- }
167
- createEditor(parent) {
168
- parent.appendChild(this.container);
169
- this.contentContainer = $(".agentSessionsWelcome-content");
170
- this.scrollableElement = this._register(( new DomScrollableElement(this.contentContainer, {
171
- className: "agentSessionsWelcome-scrollable",
172
- vertical: ScrollbarVisibility.Auto
173
- })));
174
- this.container.appendChild(this.scrollableElement.getDomNode());
175
- }
176
- async setInput(input, options, context, token) {
177
- this._storedInput = input;
178
- this._openedAt = Date.now();
179
- await super.setInput(input, options, context, token);
180
- this._workspaceKind = input.workspaceKind ?? "empty";
181
- await this.buildContent();
182
- }
183
- clearInput() {
184
- if (this._openedAt > 0) {
185
- const visibleDurationMs = Date.now() - this._openedAt;
186
- this.telemetryService.publicLog2("agentSessionsWelcome.closed", {
187
- visibleDurationMs,
188
- closedBy: this._closedBy ?? "disposed"
189
- });
190
- this._openedAt = 0;
191
- this._closedBy = undefined;
192
- }
193
- super.clearInput();
194
- }
195
- async buildContent() {
196
- this.contentDisposables.clear();
197
- this.sessionsControlDisposables.clear();
198
- this.sessionsControl = undefined;
199
- clearNode(this.contentContainer);
200
- this._isEmptyWorkspace = this.workspaceContextService.getWorkbenchState() === WorkbenchState.EMPTY;
201
- if (this._isEmptyWorkspace) {
202
- const recentlyOpened = await this.getRecentlyOpenedWorkspaces(true);
203
- this._recentTrustedWorkspaces = recentlyOpened.slice(0, MAX_REPO_PICKS);
204
- }
205
- this.walkthroughs = this.walkthroughsService.getWalkthroughs();
206
- const header = append(this.contentContainer, $(".agentSessionsWelcome-header"));
207
- append(header, $("h1.product-name", {}, this.productService.nameLong));
208
- const startEntries = append(header, $(".agentSessionsWelcome-startEntries"));
209
- await this.buildStartEntries(startEntries);
210
- const chatSection = append(this.contentContainer, $(".agentSessionsWelcome-chatSection"));
211
- this.buildChatWidget(chatSection);
212
- const sessionsSection = append(this.contentContainer, $(".agentSessionsWelcome-sessionsSection"));
213
- this.buildSessionsOrPrompts(sessionsSection);
214
- const footer = append(this.contentContainer, $(".agentSessionsWelcome-footer"));
215
- this.buildFooter(footer);
216
- let originalSessions = this.agentSessionsService.model.sessions.length > 0;
217
- this.contentDisposables.add(this.agentSessionsService.model.onDidChangeSessions(() => {
218
- const hasSessions = this.agentSessionsService.model.sessions.length > 0;
219
- if (hasSessions !== originalSessions) {
220
- originalSessions = hasSessions;
221
- clearNode(sessionsSection);
222
- this.buildSessionsOrPrompts(sessionsSection);
223
- }
224
- this.layoutSessionsControl();
225
- }));
226
- this.scrollableElement?.scanDomNode();
227
- }
228
- async buildStartEntries(container) {
229
- const workspaces = await this.getRecentlyOpenedWorkspaces(false);
230
- const openEntry = workspaces.length > 0 ? {
231
- icon: Codicon.folderOpened,
232
- label: ( localize(16690, "Open Recent...")),
233
- command: "workbench.action.openRecent"
234
- } : {
235
- icon: Codicon.folderOpened,
236
- label: ( localize(16691, "Open Folder...")),
237
- command: "workbench.action.files.openFolder"
238
- };
239
- const entries = [openEntry, {
240
- icon: Codicon.newFile,
241
- label: ( localize(16692, "New file...")),
242
- command: "welcome.showNewFileEntries"
243
- }, {
244
- icon: Codicon.repoClone,
245
- label: ( localize(16693, "Clone Git Repository...")),
246
- command: "git.clone"
247
- }];
248
- for (const entry of entries) {
249
- const button = append(container, $("button.agentSessionsWelcome-startEntry"));
250
- button.appendChild(renderIcon(entry.icon));
251
- button.appendChild(createTextNode(entry.label));
252
- button.onclick = () => {
253
- this.telemetryService.publicLog2("agentSessionsWelcome.ActionExecuted", {
254
- welcomeKind: "agentSessionsWelcomePage",
255
- action: "executeCommand",
256
- actionId: entry.command
257
- });
258
- this.commandService.executeCommand(entry.command);
259
- };
260
- }
261
- }
262
- buildChatWidget(container) {
263
- const chatWidgetContainer = append(container, $(".agentSessionsWelcome-chatWidget"));
264
- const editorOverflowWidgetsDomNode = this.layoutService.getContainer(getWindow(chatWidgetContainer)).appendChild($(".chat-editor-overflow.monaco-editor"));
265
- this.contentDisposables.add(toDisposable(() => editorOverflowWidgetsDomNode.remove()));
266
- const scopedContextKeyService = this.contentDisposables.add(this.contextService.createScoped(chatWidgetContainer));
267
- const scopedInstantiationService = this.contentDisposables.add(this.instantiationService.createChild(( new ServiceCollection([IContextKeyService, scopedContextKeyService]))));
268
- const onDidChangeActiveSessionProvider = this.contentDisposables.add(( new Emitter()));
269
- const recreateSessionForProvider = async provider => {
270
- if (this.chatWidget && this.chatModelRef) {
271
- this.chatWidget.setModel(undefined);
272
- this.chatModelRef.dispose();
273
- const newResource = getResourceForNewChatSession({
274
- type: provider,
275
- position: ChatSessionPosition.Sidebar});
276
- const ref = await this.chatService.acquireOrLoadSession(newResource, ChatAgentLocation.Chat, CancellationToken.None);
277
- this.chatModelRef = ref ?? this.chatService.startNewLocalSession(ChatAgentLocation.Chat);
278
- this.contentDisposables.add(this.chatModelRef);
279
- if (this.chatModelRef.object) {
280
- this.chatWidget.setModel(this.chatModelRef.object);
281
- }
282
- }
283
- };
284
- const sessionTypePickerDelegate = {
285
- getActiveSessionProvider: () => this._selectedSessionProvider,
286
- setActiveSessionProvider: provider => {
287
- this._selectedSessionProvider = provider;
288
- onDidChangeActiveSessionProvider.fire(provider);
289
- try {
290
- recreateSessionForProvider(provider);
291
- } catch {}
292
- },
293
- onDidChangeActiveSessionProvider: onDidChangeActiveSessionProvider.event
294
- };
295
- const onDidChangeSelectedWorkspace = this.contentDisposables.add(( new Emitter()));
296
- const onDidChangeWorkspaces = this.contentDisposables.add(( new Emitter()));
297
- const workspacePickerDelegate = this._isEmptyWorkspace ? {
298
- getWorkspaces: () => ( this._recentTrustedWorkspaces.map(w => ({
299
- uri: this.getWorkspaceUri(w),
300
- label: this.getWorkspaceLabel(w),
301
- isFolder: isRecentFolder(w)
302
- }))),
303
- getSelectedWorkspace: () => this._selectedWorkspace,
304
- setSelectedWorkspace: workspace => {
305
- this._selectedWorkspace = workspace;
306
- onDidChangeSelectedWorkspace.fire(workspace);
307
- },
308
- onDidChangeSelectedWorkspace: onDidChangeSelectedWorkspace.event,
309
- onDidChangeWorkspaces: onDidChangeWorkspaces.event,
310
- openFolderCommand: "workbench.action.files.openFolder"
311
- } : undefined;
312
- this.chatWidget = this.contentDisposables.add(scopedInstantiationService.createInstance(
313
- ChatWidget,
314
- ChatAgentLocation.Chat,
315
- {},
316
- {
317
- autoScroll: mode => mode !== ChatModeKind.Ask,
318
- renderFollowups: false,
319
- supportsFileReferences: true,
320
- renderInputOnTop: true,
321
- rendererOptions: {
322
- renderTextEditsAsSummary: () => true,
323
- referencesExpandedWhenEmptyResponse: false,
324
- progressMessageAtBottomOfResponse: mode => mode !== ChatModeKind.Ask
325
- },
326
- editorOverflowWidgetsDomNode,
327
- enableImplicitContext: true,
328
- enableWorkingSet: "explicit",
329
- supportsChangingModes: true,
330
- sessionTypePickerDelegate,
331
- workspacePickerDelegate,
332
- submitHandler: this._isEmptyWorkspace ? (query, mode) => this.handleWorkspaceSubmission(query, mode) : undefined
333
- },
334
- {
335
- listForeground: SIDE_BAR_FOREGROUND,
336
- listBackground: editorBackground,
337
- overlayBackground: editorBackground,
338
- inputEditorBackground: editorBackground,
339
- resultEditorBackground: editorBackground
340
- }
341
- ));
342
- this.chatWidget.render(chatWidgetContainer);
343
- this.chatWidget.setVisible(true);
344
- this.contentDisposables.add(scheduleAtNextAnimationFrame(getWindow(chatWidgetContainer), () => {
345
- this.layoutChatWidget();
346
- }));
347
- this.chatModelRef = this.chatService.startNewLocalSession(ChatAgentLocation.Chat);
348
- this.contentDisposables.add(this.chatModelRef);
349
- if (this.chatModelRef.object) {
350
- this.chatWidget.setModel(this.chatModelRef.object);
351
- }
352
- this.contentDisposables.add(addDisposableListener(chatWidgetContainer, "mousedown", () => {
353
- this.chatWidget?.focusInput();
354
- }));
355
- this.contentDisposables.add(this.chatService.onDidSubmitRequest((
356
- {
357
- chatSessionResource
358
- }
359
- ) => {
360
- if (this.chatModelRef?.object?.sessionResource.toString() === ( chatSessionResource.toString())) {
361
- const mode = this.chatWidget?.input.currentModeObs.get().name.get() || "unknown";
362
- this.telemetryService.publicLog2("agentSessionsWelcome.chatSubmitted", {
363
- mode,
364
- provider: this._selectedSessionProvider,
365
- workspaceKind: this._workspaceKind,
366
- selectedRecentWorkspace: this._selectedWorkspace !== undefined
367
- });
368
- this._closedBy = "chatSubmission";
369
- this.openSessionInChat(chatSessionResource);
370
- }
371
- }));
372
- this.applyPrefillData();
373
- }
374
- getWorkspaceLabel(workspace) {
375
- if (isRecentFolder(workspace)) {
376
- return workspace.label || basename(workspace.folderUri);
377
- } else if (isRecentWorkspace(workspace)) {
378
- return workspace.label || basename(workspace.workspace.configPath);
379
- }
380
- return "";
381
- }
382
- getWorkspaceUri(workspace) {
383
- if (isRecentFolder(workspace)) {
384
- return workspace.folderUri;
385
- } else if (isRecentWorkspace(workspace)) {
386
- return workspace.workspace.configPath;
387
- }
388
- throw ( new Error("Invalid workspace type"));
389
- }
390
- async handleWorkspaceSubmission(query, mode) {
391
- if (!this._selectedWorkspace) {
392
- return false;
393
- }
394
- if (!query.trim()) {
395
- return false;
396
- }
397
- const prefillData = {
398
- query,
399
- mode,
400
- timestamp: Date.now()
401
- };
402
- this.storageService.store(
403
- "chat.welcomeViewPrefill",
404
- JSON.stringify(prefillData),
405
- StorageScope.APPLICATION,
406
- StorageTarget.MACHINE
407
- );
408
- const workspace = this._recentTrustedWorkspaces.find(w => ( this.getWorkspaceUri(w).toString()) === this._selectedWorkspace?.uri.toString());
409
- if (workspace) {
410
- try {
411
- if (isRecentFolder(workspace)) {
412
- await this.hostService.openWindow([{
413
- folderUri: workspace.folderUri
414
- }]);
415
- } else if (isRecentWorkspace(workspace)) {
416
- await this.hostService.openWindow([{
417
- workspaceUri: workspace.workspace.configPath
418
- }]);
419
- }
420
- return true;
421
- } catch (e) {}
422
- }
423
- this.storageService.remove("chat.welcomeViewPrefill", StorageScope.APPLICATION);
424
- return false;
425
- }
426
- applyPrefillData() {
427
- const prefillData = this.storageService.get("chat.welcomeViewPrefill", StorageScope.APPLICATION);
428
- if (prefillData) {
429
- this.storageService.remove("chat.welcomeViewPrefill", StorageScope.APPLICATION);
430
- try {
431
- const {
432
- query,
433
- mode,
434
- timestamp
435
- } = JSON.parse(prefillData);
436
- if (timestamp && Date.now() - timestamp > 60 * 1000) {
437
- return;
438
- }
439
- if (query && this.chatWidget) {
440
- this.chatWidget.setInput(query);
441
- }
442
- if (mode !== undefined && this.chatWidget) {
443
- this.chatWidget.input.setChatMode(mode, false);
444
- }
445
- this.chatWidget?.focusInput();
446
- } catch {}
447
- }
448
- }
449
- buildSessionsOrPrompts(container) {
450
- this.sessionsControlDisposables.clear();
451
- this.sessionsControl = undefined;
452
- const sessions = this.agentSessionsService.model.sessions.filter(s => !s.isArchived());
453
- if (sessions.length > 0) {
454
- this.buildSessionsGrid(container, sessions);
455
- } else {
456
- this.buildWalkthroughs(container);
457
- }
458
- }
459
- buildSessionsGrid(container, _sessions) {
460
- this.sessionsControlContainer = append(container, $(".agentSessionsWelcome-sessionsGrid"));
461
- const options = {
462
- overrideStyles: getListStyles({
463
- listBackground: editorBackground
464
- }),
465
- filter: this.sessionsControlDisposables.add(this.instantiationService.createInstance(AgentSessionsFilter, {
466
- limitResults: () => MAX_SESSIONS,
467
- overrideExclude: session => session.isArchived() ? true : undefined
468
- })),
469
- getHoverPosition: () => HoverPosition.BELOW,
470
- trackActiveEditorSession: () => false,
471
- source: "welcomeView",
472
- notifySessionOpened: () => {
473
- const isProjectionEnabled = this.configurationService.getValue(ChatConfiguration.AgentSessionProjectionEnabled);
474
- if (!isProjectionEnabled) {
475
- this._closedBy = "sessionClicked";
476
- this.revealMaximizedChat();
477
- }
478
- }
479
- };
480
- this.sessionsControl = this.sessionsControlDisposables.add(
481
- this.instantiationService.createInstance(AgentSessionsControl, this.sessionsControlContainer, options)
482
- );
483
- this.sessionsControlDisposables.add(this.agentSessionsService.model.onDidResolve(() => {
484
- this.layoutSessionsControl();
485
- }));
486
- if (this.agentSessionsService.model.resolved) {
487
- this.layoutSessionsControl();
488
- }
489
- this.sessionsControlDisposables.add(
490
- scheduleAtNextAnimationFrame(getWindow(this.sessionsControlContainer), () => {
491
- this.layoutSessionsControl();
492
- })
493
- );
494
- if (canShowAgentsBanner(this.chatEntitlementService)) {
495
- const agentsBanner = createAgentsBanner({
496
- cssClass: "agentSessionsWelcome-agentsBanner",
497
- source: "agentSessionsWelcome",
498
- label: ( localize(16694, "View All Sessions")),
499
- onButtonClick: () => {
500
- this._closedBy = "viewAllSessions";
501
- }
502
- }, this.commandService, this.telemetryService);
503
- this.sessionsControlDisposables.add(agentsBanner.disposables);
504
- append(container, agentsBanner.element);
505
- }
506
- }
507
- buildWalkthroughs(container) {
508
- const activeWalkthroughs = this.walkthroughs.filter(w => !w.when || this.contextService.contextMatchesRules(w.when)).slice(0, MAX_WALKTHROUGHS);
509
- if (activeWalkthroughs.length === 0) {
510
- return;
511
- }
512
- let currentIndex = 0;
513
- const card = append(container, $(".agentSessionsWelcome-walkthroughCard"));
514
- const iconContainer = append(card, $(".agentSessionsWelcome-walkthroughCard-icon"));
515
- const content = append(card, $(".agentSessionsWelcome-walkthroughCard-content"));
516
- const title = append(content, $(".agentSessionsWelcome-walkthroughCard-title"));
517
- const desc = append(content, $(".agentSessionsWelcome-walkthroughCard-description"));
518
- const navContainer = append(card, $(".agentSessionsWelcome-walkthroughCard-nav"));
519
- const prevButton = append(navContainer, $("button.nav-button"));
520
- prevButton.appendChild(renderIcon(Codicon.chevronLeft));
521
- prevButton.title = ( localize(16695, "Previous"));
522
- const nextButton = append(navContainer, $("button.nav-button"));
523
- nextButton.appendChild(renderIcon(Codicon.chevronRight));
524
- nextButton.title = ( localize(16696, "Next"));
525
- const updateContent = () => {
526
- const walkthrough = activeWalkthroughs[currentIndex];
527
- clearNode(iconContainer);
528
- if (walkthrough.icon.type === "icon") {
529
- iconContainer.appendChild(renderIcon(walkthrough.icon.icon));
530
- }
531
- title.textContent = walkthrough.title;
532
- desc.textContent = walkthrough.description || "";
533
- prevButton.disabled = currentIndex === 0;
534
- nextButton.disabled = currentIndex === activeWalkthroughs.length - 1;
535
- };
536
- updateContent();
537
- card.onclick = () => {
538
- const walkthrough = activeWalkthroughs[currentIndex];
539
- this.telemetryService.publicLog2("agentSessionsWelcome.ActionExecuted", {
540
- welcomeKind: "agentSessionsWelcomePage",
541
- action: "openWalkthrough",
542
- actionId: walkthrough.id
543
- });
544
- const options = {
545
- selectedCategory: walkthrough.id,
546
- returnToCommand: AgentSessionsWelcomePage_1.COMMAND_ID
547
- };
548
- this.editorService.openEditor({
549
- resource: GettingStartedInput.RESOURCE,
550
- options
551
- });
552
- };
553
- prevButton.onclick = e => {
554
- e.stopPropagation();
555
- if (currentIndex > 0) {
556
- currentIndex--;
557
- updateContent();
558
- }
559
- };
560
- nextButton.onclick = e => {
561
- e.stopPropagation();
562
- if (currentIndex < activeWalkthroughs.length - 1) {
563
- currentIndex++;
564
- updateContent();
565
- }
566
- };
567
- }
568
- static {
569
- this.PRIVACY_NOTICE_DISMISSED_KEY = "agentSessionsWelcome.privacyNoticeDismissed";
570
- }
571
- buildPrivacyNotice(container) {
572
- if (!this.chatEntitlementService.anonymous) {
573
- return;
574
- }
575
- if (this.storageService.getBoolean(
576
- AgentSessionsWelcomePage_1.PRIVACY_NOTICE_DISMISSED_KEY,
577
- StorageScope.APPLICATION,
578
- false
579
- )) {
580
- return;
581
- }
582
- const providers = this.productService.defaultChatAgent?.provider;
583
- if (!providers || !providers.default || !this.productService.defaultChatAgent?.termsStatementUrl || !this.productService.defaultChatAgent?.privacyStatementUrl) {
584
- return;
585
- }
586
- const tosCard = append(
587
- container,
588
- $(".agentSessionsWelcome-walkthroughCard.agentSessionsWelcome-tosCard")
589
- );
590
- const dismissNotice = () => {
591
- this.storageService.store(
592
- AgentSessionsWelcomePage_1.PRIVACY_NOTICE_DISMISSED_KEY,
593
- true,
594
- StorageScope.APPLICATION,
595
- StorageTarget.USER
596
- );
597
- tosCard.remove();
598
- };
599
- this.contentDisposables.add(this.chatService.onDidSubmitRequest(() => dismissNotice()));
600
- const iconContainer = append(tosCard, $(".agentSessionsWelcome-walkthroughCard-icon"));
601
- iconContainer.appendChild(renderIcon(Codicon.chatSparkle));
602
- const content = append(tosCard, $(".agentSessionsWelcome-walkthroughCard-content"));
603
- const title = append(content, $(".agentSessionsWelcome-walkthroughCard-title"));
604
- title.textContent = ( localize(16697, "Try GitHub Copilot for free, no sign-in required!"));
605
- const desc = append(content, $(".agentSessionsWelcome-walkthroughCard-description"));
606
- const descriptionMarkdown = ( new MarkdownString(( localize(
607
- 16698,
608
- "By continuing, you agree to {0}'s [Terms]({1}) and [Privacy Statement]({2}).",
609
- providers.default.name,
610
- this.productService.defaultChatAgent.termsStatementUrl,
611
- this.productService.defaultChatAgent.privacyStatementUrl
612
- )), {
613
- isTrusted: true
614
- }));
615
- const renderedMarkdown = this.markdownRendererService.render(descriptionMarkdown);
616
- desc.appendChild(renderedMarkdown.element);
617
- const dismissButton = append(tosCard, $("button.agentSessionsWelcome-tosCard-dismiss"));
618
- dismissButton.appendChild(renderIcon(Codicon.close));
619
- dismissButton.title = ( localize(16699, "Dismiss"));
620
- dismissButton.onclick = e => {
621
- e.stopPropagation();
622
- dismissNotice();
623
- };
624
- }
625
- buildFooter(container) {
626
- this.buildPrivacyNotice(container);
627
- const showOnStartupContainer = append(container, $(".agentSessionsWelcome-showOnStartup"));
628
- const showOnStartupCheckbox = this.contentDisposables.add(( new Toggle({
629
- icon: Codicon.check,
630
- actionClassName: "agentSessionsWelcome-checkbox",
631
- isChecked: this.configurationService.getValue(configurationKey) === "agentSessionsWelcomePage",
632
- title: ( localize(16700, "When checked, this page will be shown on startup.")),
633
- ...getToggleStyles({
634
- inputActiveOptionBackground: "var(--vscode-descriptionForeground)",
635
- inputActiveOptionForeground: "var(--vscode-editor-background)",
636
- inputActiveOptionBorder: "var(--vscode-descriptionForeground)"
637
- })
638
- })));
639
- showOnStartupCheckbox.domNode.id = "showOnStartup";
640
- const showOnStartupLabel = $("label.caption", {
641
- for: "showOnStartup"
642
- }, ( localize(16701, "Show welcome page on startup")));
643
- const onShowOnStartupChanged = () => {
644
- if (showOnStartupCheckbox.checked) {
645
- this.configurationService.updateValue(configurationKey, "agentSessionsWelcomePage");
646
- } else {
647
- this.configurationService.updateValue(configurationKey, "none");
648
- }
649
- };
650
- this.contentDisposables.add(showOnStartupCheckbox.onChange(() => onShowOnStartupChanged()));
651
- this.contentDisposables.add(addDisposableListener(showOnStartupLabel, "click", () => {
652
- showOnStartupCheckbox.checked = !showOnStartupCheckbox.checked;
653
- onShowOnStartupChanged();
654
- }));
655
- showOnStartupContainer.appendChild(showOnStartupCheckbox.domNode);
656
- showOnStartupContainer.appendChild(showOnStartupLabel);
657
- }
658
- layout(dimension) {
659
- this.lastDimension = dimension;
660
- this.container.style.height = `${dimension.height}px`;
661
- this.container.style.width = `${dimension.width}px`;
662
- this.layoutChatWidget();
663
- this.layoutSessionsControl();
664
- this.scrollableElement?.scanDomNode();
665
- }
666
- layoutChatWidget() {
667
- if (!this.chatWidget || !this.lastDimension) {
668
- return;
669
- }
670
- const chatWidth = Math.min(800, this.lastDimension.width - 80);
671
- this.chatWidget.setInputPartMaxHeightOverride(WELCOME_CHAT_INPUT_MAX_HEIGHT_OVERRIDE);
672
- this.chatWidget.layout(WELCOME_CHAT_INPUT_LAYOUT_HEIGHT, chatWidth);
673
- }
674
- layoutSessionsControl() {
675
- if (!this.sessionsControl || !this.sessionsControlContainer || !this.lastDimension) {
676
- return;
677
- }
678
- const sessionsWidth = Math.min(800, this.lastDimension.width - 80);
679
- const visibleSessions = Math.min(
680
- this.agentSessionsService.model.sessions.filter(s => !s.isArchived()).length,
681
- MAX_SESSIONS
682
- );
683
- const sessionsHeight = visibleSessions * AgentSessionsListDelegate.ITEM_HEIGHT;
684
- this.sessionsControl.layout(sessionsHeight, sessionsWidth);
685
- const marginOffset = Math.floor(visibleSessions / 2) * AgentSessionsListDelegate.ITEM_HEIGHT;
686
- this.sessionsControl.element.style.marginBottom = `-${marginOffset}px`;
687
- }
688
- focus() {
689
- super.focus();
690
- this.chatWidget?.focusInput();
691
- }
692
- async revealMaximizedChat() {
693
- try {
694
- await this.closeEditorAndMaximizeAuxiliaryBar();
695
- } catch (error) {
696
- this.logService.error("Failed to open maximized chat: {0}", toErrorMessage(error));
697
- }
698
- }
699
- async openSessionInChat(sessionResource) {
700
- try {
701
- await this.closeEditorAndMaximizeAuxiliaryBar(sessionResource);
702
- } catch (error) {
703
- this.logService.error("Failed to open agent session: {0}", toErrorMessage(error));
704
- }
705
- }
706
- async closeEditorAndMaximizeAuxiliaryBar(sessionResource) {
707
- const editorToClose = this.input || this._storedInput;
708
- if (editorToClose && this.group.contains(editorToClose)) {
709
- await ( new Promise(resolve => {
710
- const disposable = this.group.onDidActiveEditorChange(e => {
711
- disposable.dispose();
712
- resolve();
713
- });
714
- this.group.closeEditor(editorToClose);
715
- }));
716
- }
717
- if (sessionResource) {
718
- await this.chatWidgetService.openSession(sessionResource);
719
- } else {
720
- await this.commandService.executeCommand("workbench.action.chat.open");
721
- }
722
- const chatViewLocation = this.viewDescriptorService.getViewLocationById(ChatViewId);
723
- if (chatViewLocation === ViewContainerLocation.AuxiliaryBar) {
724
- this.layoutService.setAuxiliaryBarMaximized(true);
725
- }
726
- }
727
- async getRecentlyOpenedWorkspaces(onlyTrusted = false) {
728
- const workspaces = await this.workspacesService.getRecentlyOpened();
729
- const trustInfoPromises = ( workspaces.workspaces.map(async ws => {
730
- const uri = isRecentWorkspace(ws) ? ws.workspace.configPath : ws.folderUri;
731
- const trustInfo = await this.workspaceTrustManagementService.getUriTrustInfo(uri);
732
- return {
733
- workspace: ws,
734
- trusted: trustInfo.trusted
735
- };
736
- }));
737
- const trustInfoResults = await Promise.all(trustInfoPromises);
738
- const filteredWorkspaces = ( trustInfoResults.filter(result => onlyTrusted ? result.trusted : true).map(result => result.workspace));
739
- return filteredWorkspaces;
740
- }
741
- };
742
- AgentSessionsWelcomePage = AgentSessionsWelcomePage_1 = ( __decorate([( __param(1, ITelemetryService)), ( __param(2, IThemeService)), ( __param(3, IStorageService)), ( __param(4, IInstantiationService)), ( __param(5, IContextKeyService)), ( __param(6, IWorkbenchLayoutService)), ( __param(7, ICommandService)), ( __param(8, IEditorService)), ( __param(9, IAgentSessionsService)), ( __param(10, IConfigurationService)), ( __param(11, IProductService)), ( __param(12, IWalkthroughsService)), ( __param(13, IChatService)), ( __param(14, IChatEntitlementService)), ( __param(15, IMarkdownRendererService)), ( __param(16, IWorkspaceContextService)), ( __param(17, IWorkspacesService)), ( __param(18, IHostService)), ( __param(19, IWorkspaceTrustManagementService)), ( __param(20, IViewDescriptorService)), ( __param(21, IChatWidgetService)), ( __param(22, ILogService))], AgentSessionsWelcomePage));
743
-
744
- export { AgentSessionsWelcomePage };