Feat: Render tool metadata after permission rejection. (#1949)
Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
parent
8355ee2061
commit
0befc5d602
6 changed files with 34 additions and 9 deletions
|
|
@ -554,6 +554,17 @@ func renderToolDetails(
|
|||
title := renderToolTitle(toolCall, width)
|
||||
title = style.Render(title)
|
||||
content := title + "\n" + body
|
||||
|
||||
if toolCall.State.Status == opencode.ToolPartStateStatusError {
|
||||
errorStyle := styles.NewStyle().
|
||||
Background(backgroundColor).
|
||||
Foreground(t.Error()).
|
||||
Padding(1, 2).
|
||||
Width(width - 4)
|
||||
errorContent := errorStyle.Render(toolCall.State.Error)
|
||||
content += "\n" + errorContent
|
||||
}
|
||||
|
||||
if permissionContent != "" {
|
||||
permissionContent = styles.NewStyle().
|
||||
Background(backgroundColor).
|
||||
|
|
@ -652,11 +663,17 @@ func renderToolDetails(
|
|||
}
|
||||
|
||||
if error != "" {
|
||||
body = styles.NewStyle().
|
||||
errorContent := styles.NewStyle().
|
||||
Width(width - 6).
|
||||
Foreground(t.Error()).
|
||||
Background(backgroundColor).
|
||||
Render(error)
|
||||
|
||||
if body == "" {
|
||||
body = errorContent
|
||||
} else {
|
||||
body += "\n\n" + errorContent
|
||||
}
|
||||
}
|
||||
|
||||
if body == "" && error == "" && result != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue