79
80
constructor(
82
>
toolData: IToolData,
83
>
public readonly toolCallId: string,
84
>
subAgentInvocationId: string | undefined,
85
>
parameters: unknown,
86
>
startOptions: { startInStreaming?: boolean; startInCancelled?: boolean; cancelReason?: ToolConfirmKind.Denied | ToolConfirmKind.Skipped; cancelReasonMessage?: string | IMarkdownString } = {},
87
>
chatRequestId?: string
88
>
) {
89
>
// For streaming invocations, use a default message until handleToolStream provides one
90
>
let defaultMessage: string | IMarkdownString = '';
91
>
if (startOptions.startInStreaming) {
92
defaultMessage = toolData.displayName;
94
defaultMessage = startOptions.cancelReasonMessage ?? localize('toolDeniedMessage', "Tool \"{0}\" was denied", toolData.displayName);
95
}
96
>
this.invocationMessage = preparedInvocation?.invocationMessage ?? defaultMessage;
chatToolInvocation.ts
97
>
this.pastTenseMessage = preparedInvocation?.pastTenseMessage;
98
>
this.originMessage = preparedInvocation?.originMessage;
99
>
this.confirmationMessages = preparedInvocation?.confirmationMessages;
100
>
this.presentation = preparedInvocation?.presentation;
101
>
this.toolSpecificData = preparedInvocation?.toolSpecificData;
102
>
this.toolId = toolData.id;
103
>
this.icon = preparedInvocation?.icon ?? (toolData.icon && ThemeIcon.isThemeIcon(toolData.icon) ? toolData.icon : undefined);
104
>
this.source = toolData.source;
105
>
this.subAgentInvocationId = subAgentInvocationId;
106
>
this.parameters = parameters;
107
>
this.chatRequestId = chatRequestId;
108
>
109
>
if (startOptions.startInCancelled) {
110
// Start directly in cancelled state (e.g., when a hook denies execution)
111
this._state = observableValue(this, {