renderToolCard renders a tool call as a single styled line with icon and argument.
(entry LogEntry)
| 388 | |
| 389 | // renderToolCard renders a tool call as a single styled line with icon and argument. |
| 390 | func (l *LogViewer) renderToolCard(entry LogEntry) []string { |
| 391 | toolName := entry.Tool |
| 392 | if toolName == "" { |
| 393 | toolName = "unknown" |
| 394 | } |
| 395 | |
| 396 | // Get icon and argument |
| 397 | icon := getToolIcon(toolName) |
| 398 | arg := getToolArgument(toolName, entry.ToolInput) |
| 399 | |
| 400 | // Style the output |
| 401 | toolNameStyle := lipgloss.NewStyle().Foreground(PrimaryColor).Bold(true) |
| 402 | argStyle := lipgloss.NewStyle().Foreground(TextColor) |
| 403 | |
| 404 | // Build the line: icon + tool name + argument |
| 405 | var line string |
| 406 | if arg != "" { |
| 407 | // Truncate argument if too long |
| 408 | maxArgLen := l.width - len(toolName) - 8 |
| 409 | if maxArgLen > 0 && len(arg) > maxArgLen { |
| 410 | arg = arg[:maxArgLen-3] + "..." |
| 411 | } |
| 412 | line = fmt.Sprintf("%s %s %s", icon, toolNameStyle.Render(toolName), argStyle.Render(arg)) |
| 413 | } else { |
| 414 | line = fmt.Sprintf("%s %s", icon, toolNameStyle.Render(toolName)) |
| 415 | } |
| 416 | |
| 417 | return []string{line} |
| 418 | } |
| 419 | |
| 420 | // renderToolResult renders a tool result. |
| 421 | func (l *LogViewer) renderToolResult(entry LogEntry) []string { |
no test coverage detected