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 .vscode/notebooks/my-work.github-issues
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
"kind": 2,
"language": "github-issues",
"value": "// list of repos we work in\n$REPOS=repo:microsoft/lsprotocol repo:microsoft/monaco-editor repo:microsoft/vscode repo:microsoft/vscode-anycode repo:microsoft/vscode-autopep8 repo:microsoft/vscode-black-formatter repo:microsoft/vscode-copilot repo:microsoft/vscode-copilot-release repo:microsoft/vscode-dev repo:microsoft/vscode-dev-chrome-launcher repo:microsoft/vscode-emmet-helper repo:microsoft/vscode-extension-telemetry repo:microsoft/vscode-flake8 repo:microsoft/vscode-github-issue-notebooks repo:microsoft/vscode-hexeditor repo:microsoft/vscode-internalbacklog repo:microsoft/vscode-isort repo:microsoft/vscode-js-debug repo:microsoft/vscode-jupyter repo:microsoft/vscode-jupyter-internal repo:microsoft/vscode-l10n repo:microsoft/vscode-livepreview repo:microsoft/vscode-markdown-languageservice repo:microsoft/vscode-markdown-tm-grammar repo:microsoft/vscode-mypy repo:microsoft/vscode-pull-request-github repo:microsoft/vscode-pylint repo:microsoft/vscode-python repo:microsoft/vscode-python-debugger repo:microsoft/vscode-python-tools-extension-template repo:microsoft/vscode-references-view repo:microsoft/vscode-remote-release repo:microsoft/vscode-remote-repositories-github repo:microsoft/vscode-remote-tunnels repo:microsoft/vscode-remotehub repo:microsoft/vscode-settings-sync-server repo:microsoft/vscode-unpkg repo:microsoft/vscode-vsce repo:microsoft/vscode-copilot-issues repo:microsoft/vscode-extension-samples\n\n// current milestone name\n$MILESTONE=milestone:\"February 2026\"\n"
"value": "// list of repos we work in\n$REPOS=repo:microsoft/lsprotocol repo:microsoft/monaco-editor repo:microsoft/vscode repo:microsoft/vscode-anycode repo:microsoft/vscode-autopep8 repo:microsoft/vscode-black-formatter repo:microsoft/vscode-copilot repo:microsoft/vscode-copilot-release repo:microsoft/vscode-dev repo:microsoft/vscode-dev-chrome-launcher repo:microsoft/vscode-emmet-helper repo:microsoft/vscode-extension-telemetry repo:microsoft/vscode-flake8 repo:microsoft/vscode-github-issue-notebooks repo:microsoft/vscode-hexeditor repo:microsoft/vscode-internalbacklog repo:microsoft/vscode-isort repo:microsoft/vscode-js-debug repo:microsoft/vscode-jupyter repo:microsoft/vscode-jupyter-internal repo:microsoft/vscode-l10n repo:microsoft/vscode-livepreview repo:microsoft/vscode-markdown-languageservice repo:microsoft/vscode-markdown-tm-grammar repo:microsoft/vscode-mypy repo:microsoft/vscode-pull-request-github repo:microsoft/vscode-pylint repo:microsoft/vscode-python repo:microsoft/vscode-python-debugger repo:microsoft/vscode-python-tools-extension-template repo:microsoft/vscode-references-view repo:microsoft/vscode-remote-release repo:microsoft/vscode-remote-repositories-github repo:microsoft/vscode-remote-tunnels repo:microsoft/vscode-remotehub repo:microsoft/vscode-settings-sync-server repo:microsoft/vscode-unpkg repo:microsoft/vscode-vsce repo:microsoft/vscode-copilot-issues repo:microsoft/vscode-extension-samples\n\n// current milestone name\n$MILESTONE=milestone:\"March 2026\"\n"
},
{
"kind": 1,
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHost.protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ export interface MainThreadLanguageModelsShape extends IDisposable {
export interface ExtHostLanguageModelsShape {
$provideLanguageModelChatInfo(vendor: string, options: ILanguageModelChatInfoOptions, token: CancellationToken): Promise<ILanguageModelChatMetadataAndIdentifier[]>;
$updateModelAccesslist(data: { from: ExtensionIdentifier; to: ExtensionIdentifier; enabled: boolean }[]): void;
$startChatRequest(modelId: string, requestId: number, from: ExtensionIdentifier, messages: SerializableObjectWithBuffers<IChatMessage[]>, options: { [name: string]: any }, token: CancellationToken): Promise<void>;
$startChatRequest(modelId: string, requestId: number, from: ExtensionIdentifier | undefined, messages: SerializableObjectWithBuffers<IChatMessage[]>, options: { [name: string]: any }, token: CancellationToken): Promise<void>;
$acceptResponsePart(requestId: number, chunk: SerializableObjectWithBuffers<IChatResponsePart | IChatResponsePart[]>): Promise<void>;
$acceptResponseDone(requestId: number, error: SerializedError | undefined): Promise<void>;
$provideTokenLength(modelId: string, value: string | IChatMessage, token: CancellationToken): Promise<number>;
Expand Down
5 changes: 3 additions & 2 deletions src/vs/workbench/api/common/extHostLanguageModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export class ExtHostLanguageModels implements ExtHostLanguageModelsShape {
return modelMetadataAndIdentifier;
}

async $startChatRequest(modelId: string, requestId: number, from: ExtensionIdentifier, messages: SerializableObjectWithBuffers<IChatMessage[]>, options: vscode.LanguageModelChatRequestOptions, token: CancellationToken): Promise<void> {
async $startChatRequest(modelId: string, requestId: number, from: ExtensionIdentifier | undefined, messages: SerializableObjectWithBuffers<IChatMessage[]>, options: vscode.LanguageModelChatRequestOptions, token: CancellationToken): Promise<void> {
const knownModel = this._localModels.get(modelId);
if (!knownModel) {
throw new Error('Model not found');
Expand Down Expand Up @@ -319,7 +319,8 @@ export class ExtHostLanguageModels implements ExtHostLanguageModelsShape {
value = data.provider.provideLanguageModelChatResponse(
knownModel.info,
messages.value.map(typeConvert.LanguageModelChatMessage2.to),
{ ...options, modelOptions: options.modelOptions ?? {}, requestInitiator: ExtensionIdentifier.toKey(from), toolMode: options.toolMode ?? extHostTypes.LanguageModelChatToolMode.Auto },
// todo@connor4312: move `core` -> `undefined` after 1.111 Insiders is out
{ ...options, modelOptions: options.modelOptions ?? {}, requestInitiator: from ? ExtensionIdentifier.toKey(from) : 'core', toolMode: options.toolMode ?? extHostTypes.LanguageModelChatToolMode.Auto },
Comment thread
connor4312 marked this conversation as resolved.
progress,
token
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { DetailedLineRangeMapping, LineRangeMapping } from '../../../../../edito
import { createDecorator } from '../../../../../platform/instantiation/common/instantiation.js';
import { InstantiationType, registerSingleton } from '../../../../../platform/instantiation/common/extensions.js';
import { ChatMessageRole, ILanguageModelsService } from '../../common/languageModels.js';
import { ExtensionIdentifier } from '../../../../../platform/extensions/common/extensions.js';
import * as nls from '../../../../../nls.js';

/**
Expand Down Expand Up @@ -284,7 +283,7 @@ Example response format:

const response = await this._languageModelsService.sendChatRequest(
models[0],
new ExtensionIdentifier('core'),
undefined,
[{ role: ChatMessageRole.User, content: [{ type: 'text', value: prompt }] }],
{},
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { autorun } from '../../../../../../base/common/observable.js';
import { CancellationTokenSource } from '../../../../../../base/common/cancellation.js';
import { IChatMarkdownAnchorService } from './chatMarkdownAnchorService.js';
import { ChatMessageRole, ILanguageModelsService } from '../../../common/languageModels.js';
import { ExtensionIdentifier } from '../../../../../../platform/extensions/common/extensions.js';
import './media/chatThinkingContent.css';
import { IHoverService } from '../../../../../../platform/hover/browser/hover.js';

Expand Down Expand Up @@ -958,7 +957,7 @@ ${this.hookCount > 0 ? `EXAMPLES WITH BLOCKED CONTENT (from hooks):

const response = await this.languageModelsService.sendChatRequest(
models[0],
new ExtensionIdentifier('core'),
undefined,
[{ role: ChatMessageRole.User, content: [{ type: 'text', value: prompt }] }],
{},
cts.token
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { hasKey } from '../../../../../base/common/types.js';
import { localize } from '../../../../../nls.js';
import { IConfigurationService } from '../../../../../platform/configuration/common/configuration.js';
import { IDialogService } from '../../../../../platform/dialogs/common/dialogs.js';
import { ExtensionIdentifier } from '../../../../../platform/extensions/common/extensions.js';
import { ILogService } from '../../../../../platform/log/common/log.js';
import { IStorageService, StorageScope, StorageTarget } from '../../../../../platform/storage/common/storage.js';
import { IChatQuestion, IChatQuestionCarousel } from '../../common/chatService/chatService.js';
Expand Down Expand Up @@ -191,7 +190,7 @@ export class ChatQuestionCarouselAutoReply extends Disposable {
const prompt = this.buildPrompt(carousel, requestMessageText, false);
const response = await this.languageModelsService.sendChatRequest(
modelId,
new ExtensionIdentifier('core'),
undefined,
[{ role: ChatMessageRole.User, content: [{ type: 'text', value: prompt }] }],
{},
token,
Expand All @@ -205,7 +204,7 @@ export class ChatQuestionCarouselAutoReply extends Disposable {
const retryPrompt = this.buildPrompt(carousel, requestMessageText, true);
const retryResponse = await this.languageModelsService.sendChatRequest(
modelId,
new ExtensionIdentifier('core'),
undefined,
[{ role: ChatMessageRole.User, content: [{ type: 'text', value: retryPrompt }] }],
{},
token,
Expand Down
8 changes: 4 additions & 4 deletions src/vs/workbench/contrib/chat/common/languageModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,13 @@ export async function getTextResponseFromStream(response: ILanguageModelChatResp
export interface ILanguageModelChatProvider {
readonly onDidChange: Event<void>;
provideLanguageModelChatInfo(options: ILanguageModelChatInfoOptions, token: CancellationToken): Promise<ILanguageModelChatMetadataAndIdentifier[]>;
sendChatRequest(modelId: string, messages: IChatMessage[], from: ExtensionIdentifier, options: { [name: string]: unknown }, token: CancellationToken): Promise<ILanguageModelChatResponse>;
sendChatRequest(modelId: string, messages: IChatMessage[], from: ExtensionIdentifier | undefined, options: { [name: string]: unknown }, token: CancellationToken): Promise<ILanguageModelChatResponse>;
provideTokenCount(modelId: string, message: string | IChatMessage, token: CancellationToken): Promise<number>;
}

export interface ILanguageModelChat {
metadata: ILanguageModelChatMetadata;
sendChatRequest(messages: IChatMessage[], from: ExtensionIdentifier, options: { [name: string]: unknown }, token: CancellationToken): Promise<ILanguageModelChatResponse>;
sendChatRequest(messages: IChatMessage[], from: ExtensionIdentifier | undefined, options: { [name: string]: unknown }, token: CancellationToken): Promise<ILanguageModelChatResponse>;
provideTokenCount(message: string | IChatMessage, token: CancellationToken): Promise<number>;
}

Expand Down Expand Up @@ -355,7 +355,7 @@ export interface ILanguageModelsService {
deltaLanguageModelChatProviderDescriptors(added: IUserFriendlyLanguageModel[], removed: IUserFriendlyLanguageModel[]): void;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
sendChatRequest(modelId: string, from: ExtensionIdentifier, messages: IChatMessage[], options: { [name: string]: any }, token: CancellationToken): Promise<ILanguageModelChatResponse>;
sendChatRequest(modelId: string, from: ExtensionIdentifier | undefined, messages: IChatMessage[], options: { [name: string]: any }, token: CancellationToken): Promise<ILanguageModelChatResponse>;

computeTokenLength(modelId: string, message: string | IChatMessage, token: CancellationToken): Promise<number>;

Expand Down Expand Up @@ -927,7 +927,7 @@ export class LanguageModelsService implements ILanguageModelsService {
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
async sendChatRequest(modelId: string, from: ExtensionIdentifier, messages: IChatMessage[], options: { [name: string]: any }, token: CancellationToken): Promise<ILanguageModelChatResponse> {
async sendChatRequest(modelId: string, from: ExtensionIdentifier | undefined, messages: IChatMessage[], options: { [name: string]: any }, token: CancellationToken): Promise<ILanguageModelChatResponse> {
const provider = this._providers.get(this._modelCache.get(modelId)?.vendor || '');
if (!provider) {
throw new Error(`Chat provider for model ${modelId} is not registered.`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ suite('LanguageModels', function () {
}));
return modelMetadataAndIdentifier;
},
sendChatRequest: async (modelId: string, messages: IChatMessage[], _from: ExtensionIdentifier, _options: { [name: string]: any }, token: CancellationToken) => {
sendChatRequest: async (modelId: string, messages: IChatMessage[], _from: ExtensionIdentifier | undefined, _options: { [name: string]: any }, token: CancellationToken) => {
// const message = messages.at(-1);

const defer = new DeferredPromise();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class NullLanguageModelsService implements ILanguageModelsService {
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
sendChatRequest(identifier: string, from: ExtensionIdentifier, messages: IChatMessage[], options: { [name: string]: any }, token: CancellationToken): Promise<ILanguageModelChatResponse> {
sendChatRequest(identifier: string, from: ExtensionIdentifier | undefined, messages: IChatMessage[], options: { [name: string]: any }, token: CancellationToken): Promise<ILanguageModelChatResponse> {
throw new Error('Method not implemented.');
}

Expand Down
4 changes: 1 addition & 3 deletions src/vs/workbench/contrib/mcp/common/mcpSamplingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { localize } from '../../../../nls.js';
import { ICommandService } from '../../../../platform/commands/common/commands.js';
import { ConfigurationTarget, getConfigValueInTarget, IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
import { IDialogService } from '../../../../platform/dialogs/common/dialogs.js';
import { ExtensionIdentifier } from '../../../../platform/extensions/common/extensions.js';
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
import { INotificationService, Severity } from '../../../../platform/notification/common/notification.js';
import { ChatAgentLocation, ChatConfiguration } from '../../chat/common/constants.js';
Expand Down Expand Up @@ -80,8 +79,7 @@ export class McpSamplingService extends Disposable implements IMcpSamplingServic
}

const model = await this._modelSequencer.queue(() => this._getMatchingModel(opts));
// todo@connor4312: nullExtensionDescription.identifier -> undefined with API update
const response = await this._languageModelsService.sendChatRequest(model, new ExtensionIdentifier('core'), messages, {}, token);
const response = await this._languageModelsService.sendChatRequest(model, undefined, messages, {}, token);

let responseText = '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { Disposable, MutableDisposable, type IDisposable } from '../../../../../
import { isObject, isString } from '../../../../../../../base/common/types.js';
import { URI } from '../../../../../../../base/common/uri.js';
import { localize } from '../../../../../../../nls.js';
import { ExtensionIdentifier } from '../../../../../../../platform/extensions/common/extensions.js';
import { IChatWidgetService } from '../../../../../chat/browser/chat.js';
import { ChatElicitationRequestPart } from '../../../../../chat/common/model/chatProgressTypes/chatElicitationRequestPart.js';
import { ChatModel } from '../../../../../chat/common/model/chatModel.js';
Expand Down Expand Up @@ -473,7 +472,7 @@ export class OutputMonitor extends Disposable implements IOutputMonitor {

const response = await this._languageModelsService.sendChatRequest(
model,
new ExtensionIdentifier('core'),
undefined,
[{ role: ChatMessageRole.User, content: [{ type: 'text', value: `Evaluate this terminal output to determine if there were errors. If there are errors, return them. Otherwise, return undefined: ${buffer}.` }] }],
{},
token
Expand Down Expand Up @@ -546,7 +545,7 @@ export class OutputMonitor extends Disposable implements IOutputMonitor {
${lastLines}
`;

const response = await this._languageModelsService.sendChatRequest(model, new ExtensionIdentifier('core'), [{ role: ChatMessageRole.User, content: [{ type: 'text', value: promptText }] }], {}, token);
const response = await this._languageModelsService.sendChatRequest(model, undefined, [{ role: ChatMessageRole.User, content: [{ type: 'text', value: promptText }] }], {}, token);
const responseText = await getTextResponseFromStream(response);
try {
const match = responseText.match(/\{[\s\S]*\}/);
Expand Down Expand Up @@ -652,7 +651,7 @@ export class OutputMonitor extends Disposable implements IOutputMonitor {
if (model) {
try {
const promptText = `Given the following confirmation prompt and options from a terminal output, which option is the default?\nPrompt: "${prompt}"\nOptions: ${JSON.stringify(options)}\nRespond with only the option string.`;
const response = await this._languageModelsService.sendChatRequest(model, new ExtensionIdentifier('core'), [
const response = await this._languageModelsService.sendChatRequest(model, undefined, [
{ role: ChatMessageRole.User, content: [{ type: 'text', value: promptText }] }
], {}, token);

Expand Down
3 changes: 2 additions & 1 deletion src/vscode-dts/vscode.proposed.chatProvider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ declare module 'vscode' {
export interface ProvideLanguageModelChatResponseOptions {

/**
* What extension initiated the request to the language model
* What extension initiated the request to the language model, or
* `undefined` if the request was initiated by other functionality in the editor.
*/
readonly requestInitiator: string;
}
Expand Down
Loading