|
5 | 5 |
|
6 | 6 | import { RequestMetadata, RequestType } from '@vscode/copilot-api';
|
7 | 7 | import { AssistantMessage, BasePromptElementProps, PromptRenderer as BasePromptRenderer, Chunk, IfEmpty, Image, JSONTree, PromptElement, PromptElementProps, PromptMetadata, PromptPiece, PromptSizing, TokenLimit, ToolCall, ToolMessage, useKeepWith, UserMessage } from '@vscode/prompt-tsx';
|
8 |
| -import type { ChatParticipantToolToken, LanguageModelToolResult2, LanguageModelToolTokenizationOptions } from 'vscode'; |
| 8 | +import type { ChatParticipantToolToken, LanguageModelToolInvocationOptions, LanguageModelToolResult2, LanguageModelToolTokenizationOptions } from 'vscode'; |
9 | 9 | import { IAuthenticationService } from '../../../../platform/authentication/common/authentication';
|
10 | 10 | import { ConfigKey, IConfigurationService } from '../../../../platform/configuration/common/configurationService';
|
11 | 11 | import { modelCanUseMcpResultImageURL } from '../../../../platform/endpoint/common/chatModelCapabilities';
|
@@ -213,7 +213,17 @@ class ToolResultElement extends PromptElement<ToolResultElementProps, void> {
|
213 | 213 | inputObj = await copilotTool.resolveInput(inputObj, this.props.promptContext, this.props.toolCallMode);
|
214 | 214 | }
|
215 | 215 |
|
216 |
| - toolResult = await this.toolsService.invokeTool(this.props.toolCall.name, { input: inputObj, toolInvocationToken: this.props.toolInvocationToken, tokenizationOptions, chatRequestId: this.props.requestId }, CancellationToken.None); |
| 216 | + const invocationOptions: LanguageModelToolInvocationOptions<unknown> = { |
| 217 | + input: inputObj, |
| 218 | + toolInvocationToken: this.props.toolInvocationToken, |
| 219 | + tokenizationOptions, |
| 220 | + chatRequestId: this.props.requestId |
| 221 | + }; |
| 222 | + if (this.props.promptContext.tools?.inSubAgent) { |
| 223 | + invocationOptions.fromSubAgent = true; |
| 224 | + } |
| 225 | + |
| 226 | + toolResult = await this.toolsService.invokeTool(this.props.toolCall.name, invocationOptions, CancellationToken.None); |
217 | 227 | sendInvokedToolTelemetry(this.promptEndpoint.acquireTokenizer(), this.telemetryService, this.props.toolCall.name, toolResult);
|
218 | 228 | } catch (err) {
|
219 | 229 | const errResult = toolCallErrorToResult(err);
|
|
0 commit comments