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
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ russh-keys = { git = "https://github.com/microsoft/vscode-russh", branch = "main

[profile.release]
strip = true
lto = true
lto = "thin"

[features]
default = []
Expand Down
3 changes: 2 additions & 1 deletion src/vs/workbench/api/browser/mainThreadChatSessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ export class ObservableChatSession extends Disposable implements IChatSession {
participant: turn.participant,
command: turn.command,
variableData: variables ? { variables } : undefined,
id: turn.id
id: turn.id,
modelId: turn.modelId,
};
}

Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/api/common/extHost.protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3385,6 +3385,7 @@ export type IChatSessionHistoryItemDto = {
participant: string;
command?: string;
variableData?: Dto<IChatRequestVariableData>;
modelId?: string;
} | {
type: 'response';
parts: IChatProgressDto[];
Expand Down
3 changes: 2 additions & 1 deletion src/vs/workbench/api/common/extHostChatSessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,8 @@ export class ExtHostChatSessions extends Disposable implements ExtHostChatSessio
prompt: turn.prompt,
participant: turn.participant,
command: turn.command,
variableData: variables.length > 0 ? { variables } : undefined
variableData: variables.length > 0 ? { variables } : undefined,
modelId: turn.modelId,
};
}

Expand Down
3 changes: 2 additions & 1 deletion src/vs/workbench/api/common/extHostTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3518,7 +3518,8 @@ export class ChatRequestTurn implements vscode.ChatRequestTurn2 {
readonly participant: string,
readonly toolReferences: vscode.ChatLanguageModelToolReference[],
readonly editedFileEvents?: vscode.ChatRequestEditedFileEvent[],
readonly id?: string
readonly id?: string,
readonly modelId?: string,
) { }
}

Expand Down
23 changes: 23 additions & 0 deletions src/vs/workbench/contrib/chat/browser/actions/chatActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,29 @@ export function registerChatActions() {
}
});

registerAction2(class ToggleShowContextUsageAction extends Action2 {
constructor() {
super({
id: 'workbench.action.chat.toggleShowContextUsage',
title: localize2('chat.showContextUsage', "Show Context Usage"),
category: CHAT_CATEGORY,
toggled: ContextKeyExpr.equals(`config.${ChatConfiguration.ChatContextUsageEnabled}`, true),
menu: {
id: MenuId.ChatWelcomeContext,
group: '1_display',
order: 1,
when: ChatContextKeys.inChatEditor.negate()
}
});
}

async run(accessor: ServicesAccessor): Promise<void> {
const configurationService = accessor.get(IConfigurationService);
const currentValue = configurationService.getValue<boolean>(ChatConfiguration.ChatContextUsageEnabled);
await configurationService.updateValue(ChatConfiguration.ChatContextUsageEnabled, !currentValue);
}
});

const nonEnterpriseCopilotUsers = ContextKeyExpr.and(ChatContextKeys.enabled, ContextKeyExpr.notEquals(`config.${defaultChat.completionsAdvancedSetting}.authProvider`, defaultChat.provider.enterprise.id));
registerAction2(class extends Action2 {
constructor() {
Expand Down
5 changes: 5 additions & 0 deletions src/vs/workbench/contrib/chat/browser/chat.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,11 @@ configurationRegistry.registerConfiguration({
default: false,
description: nls.localize('chat.viewProgressBadge.enabled', "Show a progress badge on the chat view when an agent session is in progress that is opened in that view."),
},
[ChatConfiguration.ChatContextUsageEnabled]: {
type: 'boolean',
default: true,
description: nls.localize('chat.contextUsage.enabled', "Show the context window usage indicator in the chat input."),
},
[ChatConfiguration.NotifyWindowOnResponseReceived]: {
type: 'boolean',
default: true,
Expand Down
15 changes: 15 additions & 0 deletions src/vs/workbench/contrib/chat/browser/chatSlashCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ICommandService } from '../../../../platform/commands/common/commands.j
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
import { IChatAgentService } from '../common/participants/chatAgents.js';
import { IChatSlashCommandService } from '../common/participants/chatSlashCommands.js';
import { IChatService } from '../common/chatService/chatService.js';
import { ChatAgentLocation, ChatModeKind } from '../common/constants.js';
import { ACTION_ID_NEW_CHAT } from './actions/chatActions.js';
import { ChatSubmitAction, OpenModelPickerAction } from './actions/chatExecuteActions.js';
Expand All @@ -31,6 +32,7 @@ export class ChatSlashCommandsContribution extends Disposable {
@IChatWidgetService chatWidgetService: IChatWidgetService,
@IInstantiationService instantiationService: IInstantiationService,
@IAgentSessionsService agentSessionsService: IAgentSessionsService,
@IChatService chatService: IChatService,
) {
super();
this._store.add(slashCommandService.registerSlashCommand({
Expand Down Expand Up @@ -123,6 +125,19 @@ export class ChatSlashCommandsContribution extends Disposable {
}, async () => {
await commandService.executeCommand('workbench.action.chat.configure.prompts');
}));
this._store.add(slashCommandService.registerSlashCommand({
command: 'rename',
detail: nls.localize('rename', "Rename this chat"),
sortText: 'z2_rename',
executeImmediately: false,
silent: true,
locations: [ChatAgentLocation.Chat]
}, async (prompt, _progress, _history, _location, sessionResource) => {
const title = prompt.trim();
if (title) {
chatService.setChatSessionTitle(sessionResource, title);
}
}));
this._store.add(slashCommandService.registerSlashCommand({
command: 'help',
detail: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ import { IHoverService } from '../../../../../../platform/hover/browser/hover.js
import { IInstantiationService } from '../../../../../../platform/instantiation/common/instantiation.js';
import { IContextKey, IContextKeyService } from '../../../../../../platform/contextkey/common/contextkey.js';
import { IStorageService, StorageScope, StorageTarget } from '../../../../../../platform/storage/common/storage.js';
import { IConfigurationService } from '../../../../../../platform/configuration/common/configuration.js';
import { ChatContextKeys } from '../../../common/actions/chatContextKeys.js';
import { ChatConfiguration } from '../../../common/constants.js';
import { IChatRequestModel, IChatResponseModel } from '../../../common/model/chatModel.js';
import { ILanguageModelsService } from '../../../common/languageModels.js';
import { ChatContextUsageDetails, IChatContextUsageData } from './chatContextUsageDetails.js';
Expand Down Expand Up @@ -121,12 +123,15 @@ export class ChatContextUsageWidget extends Disposable {

private readonly _contextUsageOpenedKey: IContextKey<boolean>;

private _enabled: boolean;

constructor(
@IHoverService private readonly hoverService: IHoverService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@ILanguageModelsService private readonly languageModelsService: ILanguageModelsService,
@IContextKeyService private readonly contextKeyService: IContextKeyService,
@IStorageService private readonly storageService: IStorageService,
@IConfigurationService private readonly configurationService: IConfigurationService,
) {
super();

Expand All @@ -149,6 +154,19 @@ export class ChatContextUsageWidget extends Disposable {
this._contextUsageOpenedKey.set(true);
}

// Track enabled state from configuration
this._enabled = this.configurationService.getValue<boolean>(ChatConfiguration.ChatContextUsageEnabled) !== false;
this._register(this.configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration(ChatConfiguration.ChatContextUsageEnabled)) {
this._enabled = this.configurationService.getValue<boolean>(ChatConfiguration.ChatContextUsageEnabled) !== false;
if (!this._enabled) {
this.hide();
} else if (this.currentData) {
this.show();
}
}
}));

// Set up hover - will be configured when data is available
this.setupHover();
}
Expand Down Expand Up @@ -294,6 +312,9 @@ export class ChatContextUsageWidget extends Disposable {
}

private show(): void {
if (!this._enabled) {
return;
}
if (this.domNode.style.display === 'none') {
this.domNode.style.display = '';
this._isVisible.set(true, undefined);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ export class ChatService extends Disposable implements IChatService {
undefined, // locationData
undefined, // attachments
false, // Do not treat as requests completed, else edit pills won't show.
undefined,
message.modelId,
undefined,
message.id
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export type IChatSessionHistoryItem = {
participant: string;
command?: string;
variableData?: IChatRequestVariableData;
modelId?: string;
} | {
type: 'response';
parts: IChatProgress[];
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/contrib/chat/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export enum ChatConfiguration {
ChatViewSessionsGrouping = 'chat.viewSessions.grouping',
ChatViewSessionsOrientation = 'chat.viewSessions.orientation',
ChatViewProgressBadgeEnabled = 'chat.viewProgressBadge.enabled',
ChatContextUsageEnabled = 'chat.contextUsage.enabled',
SubagentToolCustomAgents = 'chat.customAgentInSubagent.enabled',
ShowCodeBlockProgressAnimation = 'chat.agent.codeBlockProgress',
RestoreLastPanelSession = 'chat.restoreLastPanelSession',
Expand Down
22 changes: 14 additions & 8 deletions src/vs/workbench/contrib/update/browser/updateStatusBarEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export class UpdateStatusBarEntryContribution extends Disposable implements IWor
return;
}

const productIcon = this.productService.quality === 'insider' ? '$(vscode-insiders)' : '$(vscode)';
switch (state.type) {
case StateType.Uninitialized:
case StateType.Idle:
Expand All @@ -90,15 +91,16 @@ export class UpdateStatusBarEntryContribution extends Disposable implements IWor
text: nls.localize('updateStatus.checkingForUpdates', "$(sync~spin) Checking for updates..."),
ariaLabel: nls.localize('updateStatus.checkingForUpdatesAria', "Checking for updates"),
tooltip: this.getCheckingTooltip(),
command: ShowTooltipCommand
command: ShowTooltipCommand,
});
break;

case StateType.AvailableForDownload:
this.updateStatusBarEntry({
kind: 'prominent',
name: UpdateStatusBarEntryContribution.NAME,
text: nls.localize('updateStatus.updateAvailableStatus', "$(cloud-download) Update is available. Click here to download."),
ariaLabel: nls.localize('updateStatus.updateAvailableAria', "Update available. Click here to download."),
text: nls.localize('updateStatus.updateAvailableStatus', "{0} Update available, click to download.", productIcon),
ariaLabel: nls.localize('updateStatus.updateAvailableAria', "Update available, click to download."),
tooltip: this.getAvailableTooltip(state.update),
command: 'update.downloadNow'
});
Expand All @@ -116,9 +118,10 @@ export class UpdateStatusBarEntryContribution extends Disposable implements IWor

case StateType.Downloaded:
this.updateStatusBarEntry({
kind: 'prominent',
name: UpdateStatusBarEntryContribution.NAME,
text: nls.localize('updateStatus.updateReadyStatus', "$(package) Downloaded update. Click here to install."),
ariaLabel: nls.localize('updateStatus.updateReadyAria', "Downloaded update. Click here to install."),
text: nls.localize('updateStatus.updateReadyStatus', "{0} Update downloaded, click to install.", productIcon),
ariaLabel: nls.localize('updateStatus.updateReadyAria', "Update downloaded, click to install."),
tooltip: this.getReadyToInstallTooltip(state.update),
command: 'update.install'
});
Expand All @@ -134,15 +137,18 @@ export class UpdateStatusBarEntryContribution extends Disposable implements IWor
});
break;

case StateType.Ready:
case StateType.Ready: {

this.updateStatusBarEntry({
kind: 'prominent',
name: UpdateStatusBarEntryContribution.NAME,
text: nls.localize('updateStatus.restartToUpdateStatus', "$(debug-restart) Update is ready. Click here to restart."),
ariaLabel: nls.localize('updateStatus.restartToUpdateAria', "Update is ready. Click here to restart."),
text: nls.localize('updateStatus.restartToUpdateStatus', "{0} Update is ready, click to restart.", productIcon),
ariaLabel: nls.localize('updateStatus.restartToUpdateAria', "Update is ready, click to restart."),
tooltip: this.getRestartToUpdateTooltip(state.update),
command: 'update.restart'
});
break;
}

case StateType.Overwriting:
this.updateStatusBarEntry({
Expand Down
7 changes: 6 additions & 1 deletion src/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,15 @@ declare module 'vscode' {
*/
readonly editedFileEvents?: ChatRequestEditedFileEvent[];

/**
* The identifier of the language model that was used for this request, if known.
*/
readonly modelId?: string;

/**
* @hidden
*/
constructor(prompt: string, command: string | undefined, references: ChatPromptReference[], participant: string, toolReferences: ChatLanguageModelToolReference[], editedFileEvents: ChatRequestEditedFileEvent[] | undefined, id: string | undefined);
constructor(prompt: string, command: string | undefined, references: ChatPromptReference[], participant: string, toolReferences: ChatLanguageModelToolReference[], editedFileEvents: ChatRequestEditedFileEvent[] | undefined, id: string | undefined, modelId: string | undefined);
}

export class ChatResponseTurn2 {
Expand Down
Loading