Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ export function createUpdateURL(baseUpdateUrl: string, platform: string, quality
url.searchParams.set('bg', 'true');
}

if (options?.internalOrg) {
url.searchParams.set('org', options.internalOrg);
}
url.searchParams.set('u', options?.internalOrg ?? 'none');

return url.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ export class SessionsAICustomizationWorkspaceService implements IAICustomization
PromptsStorage.user,
];

getVisibleStorageSources(type: PromptsType): readonly PromptsStorage[] {
if (type === PromptsType.hook) {
return [PromptsStorage.local];
}
return this.visibleStorageSources;
}

readonly preferManualCreation = true;

async commitFiles(projectRoot: URI, fileUris: URI[]): Promise<void> {
Expand Down
14 changes: 7 additions & 7 deletions src/vs/sessions/contrib/sessions/browser/customizationCounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const storageToCountKey: Partial<Record<PromptsStorage, keyof ISourceCounts>> =
[PromptsStorage.extension]: 'extension',
};

export function getSourceCountsTotal(counts: ISourceCounts, workspaceService: IAICustomizationWorkspaceService): number {
export function getSourceCountsTotal(counts: ISourceCounts, workspaceService: IAICustomizationWorkspaceService, type: PromptsType): number {
let total = 0;
for (const storage of workspaceService.visibleStorageSources) {
for (const storage of workspaceService.getVisibleStorageSources(type)) {
const key = storageToCountKey[storage];
if (key) {
total += counts[key];
Expand Down Expand Up @@ -84,10 +84,10 @@ export async function getCustomizationTotalCount(promptsService: IPromptsService
getPromptSourceCounts(promptsService, PromptsType.hook, excluded),
]);

return getSourceCountsTotal(agentCounts, workspaceService)
+ getSourceCountsTotal(skillCounts, workspaceService)
+ getSourceCountsTotal(instructionCounts, workspaceService)
+ getSourceCountsTotal(promptCounts, workspaceService)
+ getSourceCountsTotal(hookCounts, workspaceService)
return getSourceCountsTotal(agentCounts, workspaceService, PromptsType.agent)
+ getSourceCountsTotal(skillCounts, workspaceService, PromptsType.skill)
+ getSourceCountsTotal(instructionCounts, workspaceService, PromptsType.instructions)
+ getSourceCountsTotal(promptCounts, workspaceService, PromptsType.prompt)
+ getSourceCountsTotal(hookCounts, workspaceService, PromptsType.hook)
+ mcpService.servers.get().length;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { IWorkbenchContribution, registerWorkbenchContribution2, WorkbenchPhase
import { AICustomizationManagementEditor } from '../../../../workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.js';
import { AICustomizationManagementSection } from '../../../../workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.js';
import { AICustomizationManagementEditorInput } from '../../../../workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditorInput.js';
import { IPromptsService } from '../../../../workbench/contrib/chat/common/promptSyntax/service/promptsService.js';
import { IPromptsService, PromptsStorage } from '../../../../workbench/contrib/chat/common/promptSyntax/service/promptsService.js';
import { PromptsType } from '../../../../workbench/contrib/chat/common/promptSyntax/promptTypes.js';
import { ILanguageModelsService } from '../../../../workbench/contrib/chat/common/languageModels.js';
import { IMcpService } from '../../../../workbench/contrib/mcp/common/mcpTypes.js';
Expand All @@ -40,6 +40,7 @@ interface ICustomizationItemConfig {
readonly label: string;
readonly icon: ThemeIcon;
readonly section: AICustomizationManagementSection;
readonly promptType?: PromptsType;
readonly getSourceCounts?: (promptsService: IPromptsService, excludedUserFileRoots: readonly URI[]) => Promise<ISourceCounts>;
readonly getCount?: (languageModelsService: ILanguageModelsService, mcpService: IMcpService) => Promise<number>;
}
Expand All @@ -50,34 +51,39 @@ const CUSTOMIZATION_ITEMS: ICustomizationItemConfig[] = [
label: localize('agents', "Agents"),
icon: agentIcon,
section: AICustomizationManagementSection.Agents,
promptType: PromptsType.agent,
getSourceCounts: (ps, ex) => getPromptSourceCounts(ps, PromptsType.agent, ex),
},
{
id: 'sessions.customization.skills',
label: localize('skills', "Skills"),
icon: skillIcon,
section: AICustomizationManagementSection.Skills,
promptType: PromptsType.skill,
getSourceCounts: (ps, ex) => getSkillSourceCounts(ps, ex),
},
{
id: 'sessions.customization.instructions',
label: localize('instructions', "Instructions"),
icon: instructionsIcon,
section: AICustomizationManagementSection.Instructions,
promptType: PromptsType.instructions,
getSourceCounts: (ps, ex) => getPromptSourceCounts(ps, PromptsType.instructions, ex),
},
{
id: 'sessions.customization.prompts',
label: localize('prompts', "Prompts"),
icon: promptIcon,
section: AICustomizationManagementSection.Prompts,
promptType: PromptsType.prompt,
getSourceCounts: (ps, ex) => getPromptSourceCounts(ps, PromptsType.prompt, ex),
},
{
id: 'sessions.customization.hooks',
label: localize('hooks', "Hooks"),
icon: hookIcon,
section: AICustomizationManagementSection.Hooks,
promptType: PromptsType.hook,
getSourceCounts: (ps, ex) => getPromptSourceCounts(ps, PromptsType.hook, ex),
},
// TODO: Re-enable MCP Servers once CLI MCP configuration is unified with VS Code
Expand Down Expand Up @@ -172,19 +178,22 @@ class CustomizationLinkViewItem extends ActionViewItem {

private _renderSourceCounts(container: HTMLElement, counts: ISourceCounts): void {
container.textContent = '';
const total = getSourceCountsTotal(counts, this._workspaceService);
const type = this._config.promptType;
const visibleSources = type ? this._workspaceService.getVisibleStorageSources(type) : this._workspaceService.visibleStorageSources;
const total = getSourceCountsTotal(counts, this._workspaceService, type ?? PromptsType.prompt);
container.classList.toggle('hidden', total === 0);
if (total === 0) {
return;
}

const sources: { count: number; icon: ThemeIcon; title: string }[] = [
{ count: counts.workspace, icon: workspaceIcon, title: localize('workspaceCount', "{0} from workspace", counts.workspace) },
{ count: counts.user, icon: userIcon, title: localize('userCount', "{0} from user", counts.user) },
const visibleSourcesSet = new Set(visibleSources);
const sources: { storage: PromptsStorage; count: number; icon: ThemeIcon; title: string }[] = [
{ storage: PromptsStorage.local, count: counts.workspace, icon: workspaceIcon, title: localize('workspaceCount', "{0} from workspace", counts.workspace) },
{ storage: PromptsStorage.user, count: counts.user, icon: userIcon, title: localize('userCount', "{0} from user", counts.user) },
];

for (const source of sources) {
if (source.count === 0) {
if (source.count === 0 || !visibleSourcesSet.has(source.storage)) {
continue;
}
const badge = append(container, $('span.source-count-badge'));
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/browser/workbench.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ const registry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Con
localize('useModal.all', "All editors open in a centered modal overlay."),
],
'description': localize('useModal', "Controls whether editors open in a modal overlay."),
'default': 'off', // TODO@bpasero figure out the default
'default': product.quality !== 'stable' ? 'some' : 'off', // TODO@bpasero figure out the default
tags: ['experimental'],
experiment: {
mode: 'auto'
Expand Down
82 changes: 64 additions & 18 deletions src/vs/workbench/contrib/chat/browser/actions/chatActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ export const CHAT_SETUP_ACTION_ID = 'workbench.action.chat.triggerSetup';
export const CHAT_SETUP_SUPPORT_ANONYMOUS_ACTION_ID = 'workbench.action.chat.triggerSetupSupportAnonymousAction';
const TOGGLE_CHAT_ACTION_ID = 'workbench.action.chat.toggle';

export const GENERATE_INSTRUCTIONS_COMMAND_ID = 'workbench.action.chat.generateInstructions';
export const GENERATE_INSTRUCTION_COMMAND_ID = 'workbench.action.chat.generateInstruction';
export const GENERATE_AGENT_INSTRUCTIONS_COMMAND_ID = 'workbench.action.chat.generateAgentInstructions';
export const GENERATE_ON_DEMAND_INSTRUCTIONS_COMMAND_ID = 'workbench.action.chat.generateOnDemandInstructions';
export const GENERATE_PROMPT_COMMAND_ID = 'workbench.action.chat.generatePrompt';
export const GENERATE_SKILL_COMMAND_ID = 'workbench.action.chat.generateSkill';
export const GENERATE_AGENT_COMMAND_ID = 'workbench.action.chat.generateAgent';
Expand Down Expand Up @@ -679,7 +679,55 @@ export function registerChatActions() {
}, {
id: MenuId.EditorTitle,
group: 'navigation',
when: ActiveEditorContext.isEqualTo(ChatEditorInput.EditorID),
when: ContextKeyExpr.and(ActiveEditorContext.isEqualTo(ChatEditorInput.EditorID), ChatContextKeys.newChatButtonExperimentIcon.notEqualsTo('copilot'), ChatContextKeys.newChatButtonExperimentIcon.notEqualsTo('sparkle')),
order: 1
}],
});
}

async run(accessor: ServicesAccessor) {
const widgetService = accessor.get(IChatWidgetService);
await widgetService.openSession(LocalChatSessionUri.getNewSessionUri(), ACTIVE_GROUP, { pinned: true } satisfies IChatEditorOptions);
}
});

registerAction2(class NewChatEditorCopilotIconAction extends Action2 {
constructor() {
super({
id: ACTION_ID_OPEN_CHAT + '.copilotIcon',
title: localize2('interactiveSession.open', "New Chat Editor"),
icon: Codicon.copilot,
f1: false,
category: CHAT_CATEGORY,
precondition: ChatContextKeys.enabled,
menu: [{
id: MenuId.EditorTitle,
group: 'navigation',
when: ContextKeyExpr.and(ActiveEditorContext.isEqualTo(ChatEditorInput.EditorID), ChatContextKeys.newChatButtonExperimentIcon.isEqualTo('copilot')),
order: 1
}],
});
}

async run(accessor: ServicesAccessor) {
const widgetService = accessor.get(IChatWidgetService);
await widgetService.openSession(LocalChatSessionUri.getNewSessionUri(), ACTIVE_GROUP, { pinned: true } satisfies IChatEditorOptions);
}
});

registerAction2(class NewChatEditorSparkleIconAction extends Action2 {
constructor() {
super({
id: ACTION_ID_OPEN_CHAT + '.sparkleIcon',
title: localize2('interactiveSession.open', "New Chat Editor"),
icon: Codicon.chatSparkle,
f1: false,
category: CHAT_CATEGORY,
precondition: ChatContextKeys.enabled,
menu: [{
id: MenuId.EditorTitle,
group: 'navigation',
when: ContextKeyExpr.and(ActiveEditorContext.isEqualTo(ChatEditorInput.EditorID), ChatContextKeys.newChatButtonExperimentIcon.isEqualTo('sparkle')),
order: 1
}],
});
Expand Down Expand Up @@ -1187,9 +1235,8 @@ export function registerChatActions() {
registerAction2(class GenerateInstructionsAction extends Action2 {
constructor() {
super({
id: GENERATE_INSTRUCTIONS_COMMAND_ID,
title: localize2('generateInstructions', "Generate Workspace Instructions with Agent"),
shortTitle: localize2('generateInstructions.short', "Generate Instructions with Agent"),
id: GENERATE_AGENT_INSTRUCTIONS_COMMAND_ID,
title: localize2('generateInstructions', "Generate Agent Instructions"),
category: CHAT_CATEGORY,
icon: Codicon.sparkle,
f1: true,
Expand All @@ -1210,9 +1257,8 @@ export function registerChatActions() {
registerAction2(class GenerateInstructionAction extends Action2 {
constructor() {
super({
id: GENERATE_INSTRUCTION_COMMAND_ID,
title: localize2('generateInstruction', "Generate On-demand Instruction with Agent"),
shortTitle: localize2('generateInstruction.short', "Generate Instruction with Agent"),
id: GENERATE_ON_DEMAND_INSTRUCTIONS_COMMAND_ID,
title: localize2('generateOnDemandInstructions', "Generate On-Demand Instructions"),
category: CHAT_CATEGORY,
icon: Codicon.sparkle,
f1: true,
Expand All @@ -1224,7 +1270,7 @@ export function registerChatActions() {
const commandService = accessor.get(ICommandService);
await commandService.executeCommand('workbench.action.chat.open', {
mode: 'agent',
query: '/create-instruction ',
query: '/create-instructions ',
isPartialQuery: true,
});
}
Expand All @@ -1234,8 +1280,8 @@ export function registerChatActions() {
constructor() {
super({
id: GENERATE_PROMPT_COMMAND_ID,
title: localize2('generatePrompt', "Generate Prompt File with Agent"),
shortTitle: localize2('generatePrompt.short', "Generate Prompt with Agent"),
title: localize2('generatePrompt', "Generate Prompt File"),
shortTitle: localize2('generatePrompt.short', "Generate Prompt"),
category: CHAT_CATEGORY,
icon: Codicon.sparkle,
f1: true,
Expand All @@ -1257,8 +1303,8 @@ export function registerChatActions() {
constructor() {
super({
id: GENERATE_SKILL_COMMAND_ID,
title: localize2('generateSkill', "Generate Skill with Agent"),
shortTitle: localize2('generateSkill.short', "Generate Skill with Agent"),
title: localize2('generateSkill', "Generate Skill"),
shortTitle: localize2('generateSkill.short', "Generate Skill"),
category: CHAT_CATEGORY,
icon: Codicon.sparkle,
f1: true,
Expand All @@ -1280,8 +1326,8 @@ export function registerChatActions() {
constructor() {
super({
id: GENERATE_AGENT_COMMAND_ID,
title: localize2('generateAgent', "Generate Custom Agent with Agent"),
shortTitle: localize2('generateAgent.short', "Generate Agent with Agent"),
title: localize2('generateAgent', "Generate Custom Agent"),
shortTitle: localize2('generateAgent.short', "Generate Agent"),
category: CHAT_CATEGORY,
icon: Codicon.sparkle,
f1: true,
Expand All @@ -1303,8 +1349,8 @@ export function registerChatActions() {
constructor() {
super({
id: GENERATE_HOOK_COMMAND_ID,
title: localize2('generateHook', "Generate Hook with Agent"),
shortTitle: localize2('generateHook.short', "Generate Hook with Agent"),
title: localize2('generateHook', "Generate Hook"),
shortTitle: localize2('generateHook.short', "Generate Hook"),
category: CHAT_CATEGORY,
icon: Codicon.sparkle,
f1: true,
Expand Down
Loading
Loading