View renders the tool confirmation dialog
()
| 350 | |
| 351 | // View renders the tool confirmation dialog |
| 352 | func (d *toolConfirmationDialog) View() string { |
| 353 | dialogWidth, contentWidth := d.dialogDimensions() |
| 354 | |
| 355 | dialogStyle := styles.DialogStyle.Width(dialogWidth) |
| 356 | |
| 357 | titleStyle := styles.DialogTitleStyle.Width(contentWidth) |
| 358 | title := titleStyle.Render(toolconfirm.Title) |
| 359 | |
| 360 | // Separator |
| 361 | separator := d.renderSeparator(contentWidth) |
| 362 | |
| 363 | // Get scrollable tool call view |
| 364 | argumentsSection := d.scrollView.View() |
| 365 | |
| 366 | // Combine all parts with proper spacing |
| 367 | parts := []string{title, separator} |
| 368 | |
| 369 | if argumentsSection != "" { |
| 370 | parts = append(parts, "", argumentsSection) |
| 371 | } |
| 372 | |
| 373 | if warning := d.renderSafetyWarning(contentWidth); warning != "" { |
| 374 | parts = append(parts, "", warning) |
| 375 | } |
| 376 | |
| 377 | if metadata := d.renderMetadata(contentWidth); metadata != "" { |
| 378 | parts = append(parts, "", metadata) |
| 379 | } |
| 380 | |
| 381 | // Confirmation prompt |
| 382 | question := styles.DialogQuestionStyle.Width(contentWidth).Render(toolconfirm.Question) |
| 383 | options := d.renderOptions(contentWidth) |
| 384 | |
| 385 | parts = append(parts, "", question, "", options) |
| 386 | |
| 387 | content := lipgloss.JoinVertical(lipgloss.Left, parts...) |
| 388 | |
| 389 | return dialogStyle.Render(content) |
| 390 | } |
| 391 | |
| 392 | // Position calculates the position to center the dialog |
| 393 | func (d *toolConfirmationDialog) Position() (row, col int) { |
no test coverage detected