Files
vscode/src/vs/workbench/contrib/chat/test/common/mockChatModeService.ts
Copilot 61915ccbab Show disabled Agent mode with policy indicator instead of hiding it (#278650)
* Initial plan

* Add support for showing disabled Agent mode with policy indicator

- Extended IChatModeService with isAgentModeDisabledByPolicy() method
- Added IConfigurationService to ChatModeService to check policy values
- Updated getBuiltinModes() to always include Agent mode
- Modified ModePickerActionItem to show lock icon and "Managed by your organization" tooltip for disabled Agent mode
- Disabled modes are greyed out and cannot be selected

Co-authored-by: cwebster-99 <60238438+cwebster-99@users.noreply.github.com>

* Filter out disabled Agent mode from mode cycling

- Updated getNextMode() to skip Agent mode when disabled by policy
- Prevents users from accidentally switching to disabled mode via keyboard shortcuts

Co-authored-by: cwebster-99 <60238438+cwebster-99@users.noreply.github.com>

* Update tests for Agent mode policy handling

- Updated test to expect Agent mode always present in builtin modes
- Added test for isAgentModeDisabledByPolicy() method
- Added IConfigurationService to test setup

Co-authored-by: cwebster-99 <60238438+cwebster-99@users.noreply.github.com>

* Fixing lock and grey rendering for agent

* Disabled custom agents and refactor

* polish

* code dupe

* revert test

* Update src/vs/workbench/contrib/chat/test/common/mockChatModeService.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/vs/workbench/contrib/chat/browser/chatInputPart.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* thanks copilot suggest edit

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: cwebster-99 <60238438+cwebster-99@users.noreply.github.com>
Co-authored-by: cwebster-99 <cowebster@microsoft.com>
Co-authored-by: Josh Spicer <23246594+joshspicer@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-21 17:51:50 -08:00

32 lines
1.2 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Event } from '../../../../../base/common/event.js';
import { ChatMode, IChatMode, IChatModeService } from '../../common/chatModes.js';
export class MockChatModeService implements IChatModeService {
declare readonly _serviceBrand: undefined;
public readonly onDidChangeChatModes = Event.None;
constructor(
private readonly _modes: { builtin: readonly IChatMode[]; custom: readonly IChatMode[] } = { builtin: [ChatMode.Ask], custom: [] }
) { }
getModes(): { builtin: readonly IChatMode[]; custom: readonly IChatMode[] } {
return this._modes;
}
findModeById(id: string): IChatMode | undefined {
return this._modes.builtin.find(mode => mode.id === id) ?? this._modes.custom.find(mode => mode.id === id);
}
findModeByName(name: string): IChatMode | undefined {
return this._modes.builtin.find(mode => mode.name.get() === name) ?? this._modes.custom.find(mode => mode.name.get() === name);
}
}