343
344
private _openToolUse(toolUseId: string, toolName: string, input: unknown): void {
346
return;
347
}
349
>
const parsedInput = input !== null && typeof input === 'object' ? input as Record<string, unknown> : undefined;
350
>
const meta = buildClaudeToolMeta(toolName);
351
>
// Build a placeholder Cancelled state by default; replaced with Completed when the tool_result lands.
352
>
const placeholder: ToolCallCancelledState = {
353
>
status: ToolCallStatus.Cancelled,
354
>
toolCallId: toolUseId,
355
>
toolName,
356
>
displayName,
357
>
invocationMessage: getClaudeInvocationMessage(toolName, displayName, parsedInput),
358
>
toolInput: parsedInput !== undefined ? getClaudeToolInputString(toolName, parsedInput) : (typeof input === 'string' ? input : input !== undefined ? safeStringify(input) : undefined),
359
>
reason: ToolCallCancellationReason.Skipped,
360
>
...(meta ? { _meta: meta } : {}),
361
>
};
362
>
const part: ToolCallResponsePart = {
363
>
kind: ResponsePartKind.ToolCall,
364
>
toolCall: placeholder,
365
>
};
366
>
this._active.responseParts.push(part);
367
>
this._active.toolCallParts.set(toolUseId, part);
368
>
this._active.pendingToolUseIds.add(toolUseId);
369
>
this._toolUses.set(toolUseId, { turnId: this._active.id, parsedInput });
370
>
}
371
372
private _attachToolResult(block: UserToolResultBlock): string | undefined {