Disable Cloud for Free/EDU users#320179
Open
cwebster-99 wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds entitlement-based gating to the chat session target picker so that the Cloud agent option is restricted for Copilot Free and Copilot Student (EDU) users, while also enhancing the Action Widget to support markdown descriptions/hovers (including links) and styling those links consistently.
Changes:
- Gate the Cloud session target based on
IChatEntitlementServiceand show an upgrade prompt/hover when locked. - Extend Action Widget types to allow
IMarkdownStringfor item descriptions and hover content. - Add Action Widget CSS to theme link colors in item descriptions.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.ts | Adds entitlement checks and upgrade messaging for the Cloud session target. |
| src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.ts | Wires IChatEntitlementService through to the base picker for delegation scenarios. |
| src/vs/platform/actionWidget/browser/actionWidgetDropdown.ts | Allows markdown descriptions in dropdown action items. |
| src/vs/platform/actionWidget/browser/actionWidget.css | Styles links inside action descriptions to use theme link colors. |
| src/vs/platform/actionWidget/browser/actionList.ts | Widens hover content typing to accept IMarkdownString. |
Copilot's findings
Comments suppressed due to low confidence (1)
src/vs/platform/actionWidget/browser/actionList.ts:56
IActionListItemHover.contentis widened toIMarkdownString, which can carryisTrusted: { enabledCommands: ... }. However, link activation in ActionList currently opens URIs with{ allowCommands: true }, which ignoresenabledCommandsand can allow arbitrary command URIs whenever a markdown payload is marked trusted. It would be better to threadenabledCommandsthrough and passallowCommands: enabledCommands(orfalse) accordingly.
/**
* Content to display in the hover. Can be a markdown string or an HTMLElement for full DOM control.
*/
readonly content?: string | IMarkdownString | HTMLElement;
/**
* Optional disposable associated with the hover content (e.g. from rendered markdown).
*/
readonly disposable?: IDisposable;
- Files reviewed: 5/5 changed files
- Comments generated: 2
Comment on lines
+73
to
85
| const lockedForEntitlement = this._isLockedForEntitlement(sessionTypeItem.type); | ||
| actions.push({ | ||
| ...action, | ||
| id: sessionTypeItem.commandId, | ||
| label: sessionTypeItem.label, | ||
| checked: currentType === sessionTypeItem.type, | ||
| icon: this._getSessionIcon(sessionTypeItem), | ||
| enabled: this._isSessionTypeEnabled(sessionTypeItem.type), | ||
| enabled: lockedForEntitlement ? false : this._isSessionTypeEnabled(sessionTypeItem.type), | ||
| category: this._getSessionCategory(sessionTypeItem), | ||
| description: this._getSessionDescription(sessionTypeItem), | ||
| description: lockedForEntitlement ? this._getUpgradeDescription() : this._getSessionDescription(sessionTypeItem), | ||
| tooltip: '', | ||
| hover: { content: sessionTypeItem.hoverDescription }, | ||
| hover: { content: lockedForEntitlement ? this._getUpgradeHover() : sessionTypeItem.hoverDescription }, | ||
| run: async () => { |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
# Conflicts: # src/vs/workbench/contrib/chat/browser/widget/input/delegationSessionPickerActionItem.ts # src/vs/workbench/contrib/chat/browser/widget/input/sessionTargetPickerActionItem.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces entitlement-based gating for session types in the chat session picker, specifically restricting access to the cloud agent for users with Free or EDU (Student) plans. It also enhances the UI by providing upgrade prompts and improved link styling within the action widget.
Entitlement-based session gating and upgrade prompts:
SessionTypePickerActionItemto check user entitlement viaIChatEntitlementServiceand disable the cloud agent option for Free and EDU users, displaying an upgrade prompt and hover message instead. [1] [2]DelegationSessionPickerActionItemandSessionTypePickerActionItemto injectIChatEntitlementServicefor entitlement checks. [1] [2] [3] [4]Type improvements for markdown support:
descriptionandhover.contentfields in action widget interfaces to acceptIMarkdownStringin addition to plain strings, enabling richer content and links in descriptions and hovers. [1] [2] [3]UI enhancements: