@codingame/monaco-vscode-walkthrough-service-override 25.1.2 → 26.0.1

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