diff --git a/src/vs/workbench/contrib/welcomeAgentSessions/browser/agentSessionsWelcome.ts b/src/vs/workbench/contrib/welcomeAgentSessions/browser/agentSessionsWelcome.ts index e437e7144ef..a94e8202194 100644 --- a/src/vs/workbench/contrib/welcomeAgentSessions/browser/agentSessionsWelcome.ts +++ b/src/vs/workbench/contrib/welcomeAgentSessions/browser/agentSessionsWelcome.ts @@ -40,10 +40,13 @@ import { AgentSessionsWelcomeEditorOptions, AgentSessionsWelcomeInput } from './ import { IChatService } from '../../chat/common/chatService/chatService.js'; import { IChatModel } from '../../chat/common/model/chatModel.js'; import { ISessionTypePickerDelegate } from '../../chat/browser/chat.js'; +import { IChatEntitlementService } from '../../../services/chat/common/chatEntitlementService.js'; import { AgentSessionsControl, IAgentSessionsControlOptions } from '../../chat/browser/agentSessions/agentSessionsControl.js'; import { IAgentSessionsFilter } from '../../chat/browser/agentSessions/agentSessionsViewer.js'; import { HoverPosition } from '../../../../base/browser/ui/hover/hoverWidget.js'; import { IResolvedWalkthrough, IWalkthroughsService } from '../../welcomeGettingStarted/browser/gettingStartedService.js'; +import { IMarkdownRendererService } from '../../../../platform/markdown/browser/markdownRenderer.js'; +import { MarkdownString } from '../../../../base/common/htmlContent.js'; const configurationKey = 'workbench.startupEditor'; const MAX_SESSIONS = 6; @@ -79,6 +82,8 @@ export class AgentSessionsWelcomePage extends EditorPane { @IProductService private readonly productService: IProductService, @IWalkthroughsService private readonly walkthroughsService: IWalkthroughsService, @IChatService private readonly chatService: IChatService, + @IChatEntitlementService private readonly chatEntitlementService: IChatEntitlementService, + @IMarkdownRendererService private readonly markdownRendererService: IMarkdownRendererService, ) { super(AgentSessionsWelcomePage.ID, group, telemetryService, themeService, storageService); @@ -349,7 +354,48 @@ export class AgentSessionsWelcomePage extends EditorPane { } } + private buildPrivacyNotice(container: HTMLElement): void { + // TOS/Privacy notice for users who are not signed in - reusing walkthrough card design + if (!this.chatEntitlementService.anonymous) { + return; + } + + const providers = this.productService.defaultChatAgent?.provider; + if (!providers || !providers.default || !this.productService.defaultChatAgent?.termsStatementUrl || !this.productService.defaultChatAgent?.privacyStatementUrl) { + return; + } + + const tosCard = append(container, $('.agentSessionsWelcome-walkthroughCard.agentSessionsWelcome-tosCard')); + + // Icon + const iconContainer = append(tosCard, $('.agentSessionsWelcome-walkthroughCard-icon')); + iconContainer.appendChild(renderIcon(Codicon.commentDiscussion)); + + // Content + const content = append(tosCard, $('.agentSessionsWelcome-walkthroughCard-content')); + const title = append(content, $('.agentSessionsWelcome-walkthroughCard-title')); + title.textContent = localize('tosTitle', "AI Feature Trial is Active"); + + const desc = append(content, $('.agentSessionsWelcome-walkthroughCard-description')); + const descriptionMarkdown = new MarkdownString( + localize( + { key: 'tosDescription', comment: ['{Locked="]({1})"}', '{Locked="]({2})"}'] }, + "By continuing, you agree to {0}'s [Terms]({1}) and [Privacy Statement]({2}).", + providers.default.name, + this.productService.defaultChatAgent.termsStatementUrl, + this.productService.defaultChatAgent.privacyStatementUrl + ), + { isTrusted: true } + ); + const renderedMarkdown = this.markdownRendererService.render(descriptionMarkdown); + desc.appendChild(renderedMarkdown.element); + } + private buildFooter(container: HTMLElement): void { + + // Privacy notice + this.buildPrivacyNotice(container); + // Learning link const learningLink = append(container, $('button.agentSessionsWelcome-footerLink')); learningLink.appendChild(renderIcon(Codicon.mortarBoard)); diff --git a/src/vs/workbench/contrib/welcomeAgentSessions/browser/media/agentSessionsWelcome.css b/src/vs/workbench/contrib/welcomeAgentSessions/browser/media/agentSessionsWelcome.css index 35d56a9feab..2309a4ba97d 100644 --- a/src/vs/workbench/contrib/welcomeAgentSessions/browser/media/agentSessionsWelcome.css +++ b/src/vs/workbench/contrib/welcomeAgentSessions/browser/media/agentSessionsWelcome.css @@ -358,3 +358,25 @@ width: 16px; height: 16px; } + +/* TOS/Privacy card - extends walkthrough card with TOS-specific overrides */ +.agentSessionsWelcome-tosCard { + width: 100%; + max-width: 800px; + margin-bottom: 16px; + box-sizing: border-box; + cursor: default; +} + +.agentSessionsWelcome-tosCard:hover { + background-color: var(--vscode-welcomePage-tileBackground); +} + +.agentSessionsWelcome-tosLink { + color: var(--vscode-textLink-foreground); + text-decoration: none; +} + +.agentSessionsWelcome-tosLink:hover { + text-decoration: underline; +}