456 lines
29 KiB
Text
456 lines
29 KiB
Text
diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.ts b/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.ts
|
|
index 1f5732b9cd6..3a727822aad 100644
|
|
--- a/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.ts
|
|
+++ b/src/vs/workbench/contrib/chat/browser/actions/chatContinueInAction.ts
|
|
@@ -504,7 +504,9 @@ export class CreateRemoteAgentJobAction {
|
|
);
|
|
|
|
await chatService.removeRequest(sessionResource, addedRequest.id);
|
|
- const sendResult = await chatService.sendRequest(sessionResource, userPrompt, {
|
|
+ const sendResult = await chatService.sendRequest({
|
|
+ sessionResource,
|
|
+ message: userPrompt,
|
|
agentIdSilent: continuationTargetType,
|
|
attachedContext: attachedContext.asArray(),
|
|
userSelectedModelId: widget.input.currentLanguageModel,
|
|
diff --git a/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCreatorService.ts b/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCreatorService.ts
|
|
index cec5c423ff0..f112f9756a2 100644
|
|
--- a/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCreatorService.ts
|
|
+++ b/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCreatorService.ts
|
|
@@ -78,18 +78,20 @@ export class CustomizationCreatorService {
|
|
return;
|
|
}
|
|
|
|
- await this.chatService.sendRequest(sessionResource, userMessage, {
|
|
+ await this.chatService.sendRequest({
|
|
+ sessionResource,
|
|
+ message: userMessage,
|
|
modeInfo: {
|
|
kind: ChatModeKind.Agent,
|
|
- isBuiltin: false,
|
|
modeId: 'custom',
|
|
- applyCodeBlockSuggestionId: undefined,
|
|
+ isBuiltin: false,
|
|
modeInstructions: {
|
|
- name: 'customization-creator',
|
|
- content: systemInstructions,
|
|
- toolReferences: [],
|
|
+ name: 'custom-agent',
|
|
+ value: systemInstructions,
|
|
},
|
|
+ applyCodeBlockSuggestionId: undefined,
|
|
},
|
|
+ location: ChatAgentLocation.Chat,
|
|
});
|
|
}
|
|
|
|
diff --git a/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts b/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts
|
|
index edb32b33b3d..f03ca166927 100644
|
|
--- a/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts
|
|
+++ b/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts
|
|
@@ -563,7 +563,7 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ
|
|
attachedContext = [promptFile, ...(attachedContext ?? [])];
|
|
}
|
|
|
|
- const result = await chatService.sendRequest(resource, chatOptions.prompt, { agentIdSilent: type, attachedContext });
|
|
+ const result = await chatService.sendRequest({ sessionResource: resource, message: chatOptions.prompt, agentIdSilent: type, attachedContext });
|
|
if (result.kind === 'queued') {
|
|
await result.deferred;
|
|
} else if (result.kind === 'sent') {
|
|
@@ -1375,7 +1375,7 @@ async function openChatSession(accessor: ServicesAccessor, openOptions: NewChatS
|
|
if (promptFile) {
|
|
attachedContext = [promptFile, ...(attachedContext ?? [])];
|
|
}
|
|
- await chatService.sendRequest(resource, chatSendOptions.prompt, { agentIdSilent: openOptions.type, attachedContext });
|
|
+ await chatService.sendRequest({ sessionResource: resource, message: chatSendOptions.prompt, agentIdSilent: openOptions.type, attachedContext });
|
|
} catch (e) {
|
|
logService.error(`Failed to send initial request to '${openOptions.type}' chat session with contextOptions: ${JSON.stringify(chatSendOptions)}`, e);
|
|
}
|
|
diff --git a/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.ts b/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.ts
|
|
index e7e7ba79921..27f12b4cd27 100644
|
|
--- a/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.ts
|
|
+++ b/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatConfirmationContentPart.ts
|
|
@@ -54,7 +54,7 @@ export class ChatConfirmationContentPart extends Disposable implements IChatCont
|
|
options.location = widget?.location;
|
|
Object.assign(options, widget?.getModeRequestOptions());
|
|
|
|
- const result = await this.chatService.sendRequest(element.sessionResource, prompt, options);
|
|
+ const result = await this.chatService.sendRequest({ sessionResource: element.sessionResource, message: prompt, ...options });
|
|
if (ChatSendResult.isSent(result)) {
|
|
confirmation.isUsed = true;
|
|
confirmationWidget.setShowButtons(false);
|
|
diff --git a/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.ts b/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.ts
|
|
index fe4903eff3b..feb9e37efee 100644
|
|
--- a/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.ts
|
|
+++ b/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatErrorConfirmationPart.ts
|
|
@@ -60,7 +60,7 @@ export class ChatErrorConfirmationContentPart extends Disposable implements ICha
|
|
options.userSelectedModelId = widget?.input.currentLanguageModel;
|
|
Object.assign(options, widget?.getModeRequestOptions());
|
|
this.chatAccessibilityService.acceptRequest(element.sessionResource);
|
|
- await chatService.sendRequest(element.sessionResource, prompt, options);
|
|
+ await chatService.sendRequest({ sessionResource: element.sessionResource, message: prompt, ...options });
|
|
}));
|
|
});
|
|
}
|
|
diff --git a/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownDecorationsRenderer.ts b/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownDecorationsRenderer.ts
|
|
index 560e9ecf849..f3aeddbf2e1 100644
|
|
--- a/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownDecorationsRenderer.ts
|
|
+++ b/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownDecorationsRenderer.ts
|
|
@@ -186,13 +186,14 @@ export class ChatMarkdownDecorationsRenderer {
|
|
return;
|
|
}
|
|
|
|
- this.chatService.sendRequest(widget.viewModel!.sessionResource, agent.metadata.sampleRequest ?? '',
|
|
- {
|
|
- location: widget.location,
|
|
- agentId: agent.id,
|
|
- userSelectedModelId: widget.input.currentLanguageModel,
|
|
- modeInfo: widget.input.currentModeInfo
|
|
- });
|
|
+ this.chatService.sendRequest({
|
|
+ sessionResource: widget.viewModel!.sessionResource,
|
|
+ message: agent.metadata.sampleRequest ?? '',
|
|
+ location: widget.location,
|
|
+ agentId: agent.id,
|
|
+ userSelectedModelId: widget.input.currentLanguageModel,
|
|
+ modeInfo: widget.input.currentModeInfo
|
|
+ });
|
|
}));
|
|
} else {
|
|
container = this.renderResourceWidget(nameWithLeader, undefined, store);
|
|
@@ -223,7 +224,9 @@ export class ChatMarkdownDecorationsRenderer {
|
|
}
|
|
|
|
const command = agent.slashCommands.find(c => c.name === args.command);
|
|
- this.chatService.sendRequest(widget.viewModel!.sessionResource, command?.sampleRequest ?? '', {
|
|
+ this.chatService.sendRequest({
|
|
+ sessionResource: widget.viewModel!.sessionResource,
|
|
+ message: command?.sampleRequest ?? '',
|
|
location: widget.location,
|
|
agentId: agent.id,
|
|
slashCommand: args.command,
|
|
diff --git a/src/vs/workbench/contrib/chat/browser/widget/chatWidget.ts b/src/vs/workbench/contrib/chat/browser/widget/chatWidget.ts
|
|
index 7689707940f..1181554bad6 100644
|
|
--- a/src/vs/workbench/contrib/chat/browser/widget/chatWidget.ts
|
|
+++ b/src/vs/workbench/contrib/chat/browser/widget/chatWidget.ts
|
|
@@ -2413,7 +2413,9 @@ export class ChatWidget extends Disposable implements IChatWidget {
|
|
const resolvedImageVariables = await this._resolveDirectoryImageAttachments(requestInputs.attachedContext.asArray());
|
|
const submittedSessionResource = this.viewModel.sessionResource;
|
|
|
|
- const result = await this.chatService.sendRequest(this.viewModel.sessionResource, requestInputs.input, {
|
|
+ const result = await this.chatService.sendRequest({
|
|
+ sessionResource: this.viewModel.sessionResource,
|
|
+ message: requestInputs.input,
|
|
userSelectedModelId: this.input.currentLanguageModel,
|
|
location: this.location,
|
|
locationData: this._location.resolveData?.(),
|
|
@@ -2425,7 +2427,6 @@ export class ChatWidget extends Disposable implements IChatWidget {
|
|
modeInfo: this.input.currentModeInfo,
|
|
agentIdSilent: this._lockedAgent?.id,
|
|
queue: options?.queue,
|
|
-
|
|
});
|
|
|
|
if (ChatSendResult.isRejected(result)) {
|
|
diff --git a/src/vs/workbench/contrib/chat/common/chatService/chatService.ts b/src/vs/workbench/contrib/chat/common/chatService/chatService.ts
|
|
index 2fd59394973..e8d340bc651 100644
|
|
--- a/src/vs/workbench/contrib/chat/common/chatService/chatService.ts
|
|
+++ b/src/vs/workbench/contrib/chat/common/chatService/chatService.ts
|
|
@@ -1357,6 +1357,11 @@ export const enum ChatRequestQueueKind {
|
|
Steering = 'steering'
|
|
}
|
|
|
|
+export interface IChatSendRequest extends IChatSendRequestOptions {
|
|
+ sessionResource: URI;
|
|
+ message: string;
|
|
+}
|
|
+
|
|
export interface IChatSendRequestOptions {
|
|
modeInfo?: IChatRequestModeInfo;
|
|
userSelectedModelId?: string;
|
|
@@ -1461,7 +1466,7 @@ export interface IChatService {
|
|
* Sends a chat request for the given session.
|
|
* @returns A result indicating whether the request was sent, queued, or rejected.
|
|
*/
|
|
- sendRequest(sessionResource: URI, message: string, options?: IChatSendRequestOptions): Promise<ChatSendResult>;
|
|
+ sendRequest(request: IChatSendRequest): Promise<ChatSendResult>;
|
|
|
|
getSessionTitle(sessionResource: URI): string | undefined;
|
|
setSessionTitle(sessionResource: URI, title: string): void;
|
|
diff --git a/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts b/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts
|
|
index 387af583779..0bdbe9f96ee 100644
|
|
--- a/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts
|
|
+++ b/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts
|
|
@@ -41,7 +41,7 @@ import { ChatModel, ChatRequestModel, ChatRequestRemovalReason, IChatModel, ICha
|
|
import { ChatModelStore, IStartSessionProps } from '../model/chatModelStore.js';
|
|
import { chatAgentLeader, ChatRequestAgentPart, ChatRequestAgentSubcommandPart, ChatRequestSlashCommandPart, ChatRequestTextPart, chatSubcommandLeader, getPromptText, IParsedChatRequest } from '../requestParser/chatParserTypes.js';
|
|
import { ChatRequestParser } from '../requestParser/chatRequestParser.js';
|
|
-import { ChatMcpServersStarting, ChatPendingRequestChangeClassification, ChatPendingRequestChangeEvent, ChatPendingRequestChangeEventName, ChatRequestQueueKind, ChatSendResult, ChatSendResultQueued, ChatSendResultSent, ChatStopCancellationNoopClassification, ChatStopCancellationNoopEvent, ChatStopCancellationNoopEventName, IChatCompleteResponse, IChatDetail, IChatFollowup, IChatModelReference, IChatProgress, IChatQuestionAnswers, IChatSendRequestOptions, IChatSendRequestResponseState, IChatService, IChatSessionContext, IChatSessionStartOptions, IChatUserActionEvent, ResponseModelState } from './chatService.js';
|
|
+import { ChatMcpServersStarting, ChatPendingRequestChangeClassification, ChatPendingRequestChangeEvent, ChatPendingRequestChangeEventName, ChatRequestQueueKind, ChatSendResult, ChatSendResultQueued, ChatSendResultSent, ChatStopCancellationNoopClassification, ChatStopCancellationNoopEvent, ChatStopCancellationNoopEventName, IChatCompleteResponse, IChatDetail, IChatFollowup, IChatModelReference, IChatProgress, IChatQuestionAnswers, IChatSendRequest, IChatSendRequestOptions, IChatSendRequestResponseState, IChatService, IChatSessionContext, IChatSessionStartOptions, IChatUserActionEvent, ResponseModelState } from './chatService.js';
|
|
import { ChatRequestTelemetry, ChatServiceTelemetry } from './chatServiceTelemetry.js';
|
|
import { IChatSessionsService, localChatSessionType } from '../chatSessionsService.js';
|
|
import { ChatSessionStore, IChatSessionEntryMetadata } from '../model/chatSessionStore.js';
|
|
@@ -885,7 +885,8 @@ export class ChatService extends Disposable implements IChatService {
|
|
return { kind: 'queued', deferred: deferred.p };
|
|
}
|
|
|
|
- async sendRequest(sessionResource: URI, request: string, options?: IChatSendRequestOptions): Promise<ChatSendResult> {
|
|
+ async sendRequest(params: IChatSendRequest): Promise<ChatSendResult> {
|
|
+ let { sessionResource, message: request, ...options } = params;
|
|
this.trace('sendRequest', `sessionResource: ${sessionResource.toString()}, message: ${request.substring(0, 20)}${request.length > 20 ? '[...]' : ''}}`);
|
|
|
|
|
|
@@ -1743,7 +1744,9 @@ export class ChatService extends Disposable implements IChatService {
|
|
|
|
// Re-send remaining queued requests
|
|
for (const pending of pendingRequests) {
|
|
- void this.sendRequest(targetResource, pending.request.message.text, {
|
|
+ void this.sendRequest({
|
|
+ sessionResource: targetResource,
|
|
+ message: pending.request.message.text,
|
|
...pending.sendOptions,
|
|
queue: pending.kind,
|
|
});
|
|
diff --git a/src/vs/workbench/contrib/chat/test/common/chatService/chatService.test.ts b/src/vs/workbench/contrib/chat/test/common/chatService/chatService.test.ts
|
|
index afa76442175..d8bf30796c1 100644
|
|
--- a/src/vs/workbench/contrib/chat/test/common/chatService/chatService.test.ts
|
|
+++ b/src/vs/workbench/contrib/chat/test/common/chatService/chatService.test.ts
|
|
@@ -285,7 +285,7 @@ suite('ChatService', () => {
|
|
|
|
const modelRef = testDisposables.add(startSessionModel(testService));
|
|
const model = modelRef.object;
|
|
- const response = await testService.sendRequest(model.sessionResource, `@${chatAgentWithUsedContextId} test request`);
|
|
+ const response = await testService.sendRequest({ sessionResource: model.sessionResource, message: `@${chatAgentWithUsedContextId} test request` });
|
|
ChatSendResult.assertSent(response);
|
|
await response.data.responseCompletePromise;
|
|
|
|
@@ -311,21 +311,21 @@ suite('ChatService', () => {
|
|
const model = modelRef.object;
|
|
|
|
// Send a request to default agent
|
|
- const response = await testService.sendRequest(model.sessionResource, `test request`, { agentId: 'defaultAgent' });
|
|
+ const response = await testService.sendRequest({ sessionResource: model.sessionResource, message: `test request`, agentId: 'defaultAgent' });
|
|
ChatSendResult.assertSent(response);
|
|
await response.data.responseCompletePromise;
|
|
assert.strictEqual(model.getRequests().length, 1);
|
|
assert.strictEqual(model.getRequests()[0].response?.result?.metadata?.historyLength, 0);
|
|
|
|
// Send a request to agent2- it can't see the default agent's message
|
|
- const response2 = await testService.sendRequest(model.sessionResource, `test request`, { agentId: 'agent2' });
|
|
+ const response2 = await testService.sendRequest({ sessionResource: model.sessionResource, message: `test request`, agentId: 'agent2' });
|
|
ChatSendResult.assertSent(response2);
|
|
await response2.data.responseCompletePromise;
|
|
assert.strictEqual(model.getRequests().length, 2);
|
|
assert.strictEqual(model.getRequests()[1].response?.result?.metadata?.historyLength, 0);
|
|
|
|
// Send a request to defaultAgent - the default agent can see agent2's message
|
|
- const response3 = await testService.sendRequest(model.sessionResource, `test request`, { agentId: 'defaultAgent' });
|
|
+ const response3 = await testService.sendRequest({ sessionResource: model.sessionResource, message: `test request`, agentId: 'defaultAgent' });
|
|
ChatSendResult.assertSent(response3);
|
|
await response3.data.responseCompletePromise;
|
|
assert.strictEqual(model.getRequests().length, 3);
|
|
@@ -343,12 +343,12 @@ suite('ChatService', () => {
|
|
|
|
await assertSnapshot(toSnapshotExportData(model));
|
|
|
|
- const response = await testService.sendRequest(model.sessionResource, `@${chatAgentWithUsedContextId} test request`);
|
|
+ const response = await testService.sendRequest({ sessionResource: model.sessionResource, message: `@${chatAgentWithUsedContextId} test request` });
|
|
ChatSendResult.assertSent(response);
|
|
await response.data.responseCompletePromise;
|
|
assert.strictEqual(model.getRequests().length, 1);
|
|
|
|
- const response2 = await testService.sendRequest(model.sessionResource, `test request 2`);
|
|
+ const response2 = await testService.sendRequest({ sessionResource: model.sessionResource, message: `test request 2` });
|
|
ChatSendResult.assertSent(response2);
|
|
await response2.data.responseCompletePromise;
|
|
assert.strictEqual(model.getRequests().length, 2);
|
|
@@ -368,7 +368,7 @@ suite('ChatService', () => {
|
|
const chatModel1 = chatModel1Ref.object;
|
|
assert.strictEqual(chatModel1.getRequests().length, 0);
|
|
|
|
- const response = await testService.sendRequest(chatModel1.sessionResource, `@${chatAgentWithUsedContextId} test request`);
|
|
+ const response = await testService.sendRequest({ sessionResource: chatModel1.sessionResource, message: `@${chatAgentWithUsedContextId} test request` });
|
|
ChatSendResult.assertSent(response);
|
|
|
|
await response.data.responseCompletePromise;
|
|
@@ -399,7 +399,7 @@ suite('ChatService', () => {
|
|
const chatModel1 = chatModel1Ref.object;
|
|
assert.strictEqual(chatModel1.getRequests().length, 0);
|
|
|
|
- const response = await testService.sendRequest(chatModel1.sessionResource, `@${chatAgentWithUsedContextId} test request`);
|
|
+ const response = await testService.sendRequest({ sessionResource: chatModel1.sessionResource, message: `@${chatAgentWithUsedContextId} test request` });
|
|
ChatSendResult.assertSent(response);
|
|
|
|
await response.data.responseCompletePromise;
|
|
@@ -462,14 +462,16 @@ suite('ChatService', () => {
|
|
const model = modelRef.object;
|
|
|
|
// Start a request that will wait
|
|
- const response = await testService.sendRequest(model.sessionResource, 'first request', { agentId: 'slowAgent' });
|
|
+ const response = await testService.sendRequest({ sessionResource: model.sessionResource, message: 'first request', agentId: 'slowAgent' });
|
|
ChatSendResult.assertSent(response);
|
|
|
|
// Wait for the agent to start processing
|
|
await requestStarted.p;
|
|
|
|
// Queue a steering message while the first request is still in progress
|
|
- const steeringResponse = await testService.sendRequest(model.sessionResource, 'steering message', {
|
|
+ const steeringResponse = await testService.sendRequest({
|
|
+ sessionResource: model.sessionResource,
|
|
+ message: 'steering message',
|
|
agentId: 'slowAgent',
|
|
queue: ChatRequestQueueKind.Steering
|
|
});
|
|
@@ -507,16 +509,16 @@ suite('ChatService', () => {
|
|
const model = modelRef.object;
|
|
|
|
// Start a request that will wait
|
|
- const response = await testService.sendRequest(model.sessionResource, 'first request', { agentId: 'slowAgent' });
|
|
+ const response = await testService.sendRequest({ sessionResource: model.sessionResource, message: 'first request', agentId: 'slowAgent' });
|
|
ChatSendResult.assertSent(response);
|
|
|
|
// Wait for the agent to start processing
|
|
await requestStarted.p;
|
|
|
|
// Queue 3 steering messages while the first request is in progress
|
|
- const steering1 = await testService.sendRequest(model.sessionResource, 'steering1', { agentId: 'slowAgent', queue: ChatRequestQueueKind.Steering });
|
|
- const steering2 = await testService.sendRequest(model.sessionResource, 'steering2', { agentId: 'slowAgent', queue: ChatRequestQueueKind.Steering });
|
|
- const steering3 = await testService.sendRequest(model.sessionResource, 'steering3', { agentId: 'slowAgent', queue: ChatRequestQueueKind.Steering });
|
|
+ const steering1 = await testService.sendRequest({ sessionResource: model.sessionResource, message: 'steering1', agentId: 'slowAgent', queue: ChatRequestQueueKind.Steering });
|
|
+ const steering2 = await testService.sendRequest({ sessionResource: model.sessionResource, message: 'steering2', agentId: 'slowAgent', queue: ChatRequestQueueKind.Steering });
|
|
+ const steering3 = await testService.sendRequest({ sessionResource: model.sessionResource, message: 'steering3', agentId: 'slowAgent', queue: ChatRequestQueueKind.Steering });
|
|
assert.ok(ChatSendResult.isQueued(steering1));
|
|
assert.ok(ChatSendResult.isQueued(steering2));
|
|
assert.ok(ChatSendResult.isQueued(steering3));
|
|
@@ -559,7 +561,7 @@ suite('ChatService', () => {
|
|
const model = modelRef.object;
|
|
|
|
// Disabled hooks are reported for every request, but the hint should only be shown once per workspace.
|
|
- const response = await testService.sendRequest(model.sessionResource, 'test request');
|
|
+ const response = await testService.sendRequest({ sessionResource: model.sessionResource, message: 'test request' });
|
|
ChatSendResult.assertSent(response);
|
|
await response.data.responseCompletePromise;
|
|
|
|
@@ -574,7 +576,7 @@ suite('ChatService', () => {
|
|
assert.ok(hasHookHint, 'Response should contain the disabledClaudeHooks hint');
|
|
|
|
// Sending another request should NOT show the hint again (shown only once per workspace)
|
|
- const response2 = await testService.sendRequest(model.sessionResource, 'second request');
|
|
+ const response2 = await testService.sendRequest({ sessionResource: model.sessionResource, message: 'second request' });
|
|
ChatSendResult.assertSent(response2);
|
|
await response2.data.responseCompletePromise;
|
|
|
|
@@ -607,7 +609,7 @@ suite('ChatService', () => {
|
|
const modelRef = testDisposables.add(startSessionModel(testService));
|
|
const model = modelRef.object;
|
|
|
|
- const response = await testService.sendRequest(model.sessionResource, 'first request');
|
|
+ const response = await testService.sendRequest({ sessionResource: model.sessionResource, message: 'first request' });
|
|
ChatSendResult.assertSent(response);
|
|
await response.data.responseCompletePromise;
|
|
|
|
@@ -653,7 +655,7 @@ suite('ChatService', () => {
|
|
const modelRef = testDisposables.add(startSessionModel(testService));
|
|
const model = modelRef.object;
|
|
|
|
- const response = await testService.sendRequest(model.sessionResource, 'test request', { agentId: 'slowAgent' });
|
|
+ const response = await testService.sendRequest({ sessionResource: model.sessionResource, message: 'test request', agentId: 'slowAgent' });
|
|
ChatSendResult.assertSent(response);
|
|
|
|
await requestStarted.p;
|
|
@@ -687,7 +689,7 @@ suite('ChatService', () => {
|
|
const modelRef = testDisposables.add(startSessionModel(testService));
|
|
const model = modelRef.object;
|
|
|
|
- const response = await testService.sendRequest(model.sessionResource, 'test request', { agentId: 'hangingAgent' });
|
|
+ const response = await testService.sendRequest({ sessionResource: model.sessionResource, message: 'test request', agentId: 'hangingAgent' });
|
|
ChatSendResult.assertSent(response);
|
|
|
|
await requestStarted.p;
|
|
@@ -727,12 +729,12 @@ suite('ChatService', () => {
|
|
const source = sourceRef.object;
|
|
|
|
// Start a blocking request on source
|
|
- const response = await testService.sendRequest(source.sessionResource, 'first request', { agentId: 'slowAgent' });
|
|
+ const response = await testService.sendRequest({ sessionResource: source.sessionResource, message: 'first request', agentId: 'slowAgent' });
|
|
ChatSendResult.assertSent(response);
|
|
await requestStarted.p;
|
|
|
|
// Queue a request while the first is in progress
|
|
- const queued = await testService.sendRequest(source.sessionResource, 'queued request', { agentId: 'slowAgent', queue: ChatRequestQueueKind.Queued });
|
|
+ const queued = await testService.sendRequest({ sessionResource: source.sessionResource, message: 'queued request', agentId: 'slowAgent', queue: ChatRequestQueueKind.Queued });
|
|
assert.ok(ChatSendResult.isQueued(queued));
|
|
|
|
// Remove the queued request from source
|
|
@@ -743,7 +745,7 @@ suite('ChatService', () => {
|
|
// Re-send it on a new target session through the normal queue path
|
|
const targetRef = testDisposables.add(startSessionModel(testService));
|
|
const target = targetRef.object;
|
|
- const resent = await testService.sendRequest(target.sessionResource, 'queued request', { agentId: 'slowAgent', queue: ChatRequestQueueKind.Queued, pauseQueue: true });
|
|
+ const resent = await testService.sendRequest({ sessionResource: target.sessionResource, message: 'queued request', agentId: 'slowAgent', queue: ChatRequestQueueKind.Queued, pauseQueue: true });
|
|
assert.ok(ChatSendResult.isQueued(resent));
|
|
assert.strictEqual(target.getPendingRequests().length, 1);
|
|
|
|
@@ -794,14 +796,14 @@ suite('ChatService', () => {
|
|
const source = sourceRef.object;
|
|
|
|
// Step 1: Send request 1 (blocks on firstRequestGate)
|
|
- const response1 = await testService.sendRequest(source.sessionResource, 'request-1', { agentId: 'slowAgent' });
|
|
+ const response1 = await testService.sendRequest({ sessionResource: source.sessionResource, message: 'request-1', agentId: 'slowAgent' });
|
|
ChatSendResult.assertSent(response1);
|
|
await firstRequestStarted.p;
|
|
|
|
// Step 2: Queue 3 more requests while request 1 is in progress
|
|
- const q1 = await testService.sendRequest(source.sessionResource, 'queued-1', { agentId: 'slowAgent', queue: ChatRequestQueueKind.Queued });
|
|
- const q2 = await testService.sendRequest(source.sessionResource, 'queued-2', { agentId: 'slowAgent', queue: ChatRequestQueueKind.Queued });
|
|
- const q3 = await testService.sendRequest(source.sessionResource, 'queued-3', { agentId: 'slowAgent', queue: ChatRequestQueueKind.Queued });
|
|
+ const q1 = await testService.sendRequest({ sessionResource: source.sessionResource, message: 'queued-1', agentId: 'slowAgent', queue: ChatRequestQueueKind.Queued });
|
|
+ const q2 = await testService.sendRequest({ sessionResource: source.sessionResource, message: 'queued-2', agentId: 'slowAgent', queue: ChatRequestQueueKind.Queued });
|
|
+ const q3 = await testService.sendRequest({ sessionResource: source.sessionResource, message: 'queued-3', agentId: 'slowAgent', queue: ChatRequestQueueKind.Queued });
|
|
assert.ok(ChatSendResult.isQueued(q1));
|
|
assert.ok(ChatSendResult.isQueued(q2));
|
|
assert.ok(ChatSendResult.isQueued(q3));
|
|
@@ -835,9 +837,9 @@ suite('ChatService', () => {
|
|
assert.strictEqual(source.getPendingRequests().length, 0);
|
|
|
|
// Re-send ALL 3 on the target through the normal queue path
|
|
- const resent1 = await testService.sendRequest(target.sessionResource, 'queued-1', { agentId: 'slowAgent', queue: ChatRequestQueueKind.Queued, pauseQueue: true });
|
|
- const resent2 = await testService.sendRequest(target.sessionResource, 'queued-2', { agentId: 'slowAgent', queue: ChatRequestQueueKind.Queued, pauseQueue: true });
|
|
- const resent3 = await testService.sendRequest(target.sessionResource, 'queued-3', { agentId: 'slowAgent', queue: ChatRequestQueueKind.Queued, pauseQueue: true });
|
|
+ const resent1 = await testService.sendRequest({ sessionResource: target.sessionResource, message: 'queued-1', agentId: 'slowAgent', queue: ChatRequestQueueKind.Queued, pauseQueue: true });
|
|
+ const resent2 = await testService.sendRequest({ sessionResource: target.sessionResource, message: 'queued-2', agentId: 'slowAgent', queue: ChatRequestQueueKind.Queued, pauseQueue: true });
|
|
+ const resent3 = await testService.sendRequest({ sessionResource: target.sessionResource, message: 'queued-3', agentId: 'slowAgent', queue: ChatRequestQueueKind.Queued, pauseQueue: true });
|
|
assert.ok(ChatSendResult.isQueued(resent1));
|
|
assert.ok(ChatSendResult.isQueued(resent2));
|
|
assert.ok(ChatSendResult.isQueued(resent3));
|
|
@@ -928,7 +930,7 @@ suite('ChatService', () => {
|
|
testDisposables.add(untitledRef);
|
|
|
|
// Send a request - this triggers the untitled → real session conversion
|
|
- const response = await testService.sendRequest(untitledResource, 'hello', { agentId: remoteScheme });
|
|
+ const response = await testService.sendRequest({ sessionResource: untitledResource, message: 'hello', agentId: remoteScheme });
|
|
ChatSendResult.assertSent(response);
|
|
await response.data.responseCompletePromise;
|
|
|
|
diff --git a/src/vs/workbench/contrib/chat/test/common/chatService/mockChatService.ts b/src/vs/workbench/contrib/chat/test/common/chatService/mockChatService.ts
|
|
index 07e106b2c43..58c675cdc06 100644
|
|
--- a/src/vs/workbench/contrib/chat/test/common/chatService/mockChatService.ts
|
|
+++ b/src/vs/workbench/contrib/chat/test/common/chatService/mockChatService.ts
|
|
@@ -8,7 +8,7 @@ import { Emitter, Event } from '../../../../../../base/common/event.js';
|
|
import { ResourceMap } from '../../../../../../base/common/map.js';
|
|
import { ISettableObservable, observableValue } from '../../../../../../base/common/observable.js';
|
|
import { URI } from '../../../../../../base/common/uri.js';
|
|
-import { ChatRequestQueueKind, ChatSendResult, IChatDetail, IChatModelReference, IChatProgress, IChatSendRequestOptions, IChatService, IChatSessionContext, IChatSessionStartOptions, IChatUserActionEvent } from '../../../common/chatService/chatService.js';
|
|
+import { ChatRequestQueueKind, ChatSendResult, IChatDetail, IChatModelReference, IChatProgress, IChatSendRequest, IChatSendRequestOptions, IChatService, IChatSessionContext, IChatSessionStartOptions, IChatUserActionEvent } from '../../../common/chatService/chatService.js';
|
|
import { ChatAgentLocation } from '../../../common/constants.js';
|
|
import { IChatModel, IChatRequestModel, IExportableChatData, ISerializableChatData } from '../../../common/model/chatModel.js';
|
|
|
|
@@ -112,7 +112,7 @@ export class MockChatService implements IChatService {
|
|
|
|
appendProgress(_request: IChatRequestModel, _progress: IChatProgress): void { }
|
|
|
|
- sendRequest(_sessionResource: URI, _message: string): Promise<ChatSendResult> {
|
|
+ sendRequest(_request: IChatSendRequest): Promise<ChatSendResult> {
|
|
throw new Error('Method not implemented.');
|
|
}
|
|
|