(w io.Writer, raw json.RawMessage, compact bool)
| 194 | } |
| 195 | |
| 196 | func renderAssistantRecord(w io.Writer, raw json.RawMessage, compact bool) { |
| 197 | var msg jsonlMessage |
| 198 | if err := json.Unmarshal(raw, &msg); err != nil { |
| 199 | return |
| 200 | } |
| 201 | |
| 202 | var blocks []contentBlock |
| 203 | if err := json.Unmarshal(msg.Content, &blocks); err != nil { |
| 204 | return |
| 205 | } |
| 206 | |
| 207 | for _, b := range blocks { |
| 208 | switch b.Type { |
| 209 | case "thinking": |
| 210 | if compact { |
| 211 | continue |
| 212 | } |
| 213 | if b.Thinking != "" { |
| 214 | fmt.Fprintln(w, "─── Thinking ───") |
| 215 | fmt.Fprintln(w, b.Thinking) |
| 216 | } |
| 217 | case "text": |
| 218 | if b.Text != "" { |
| 219 | fmt.Fprintln(w, "─── Assistant ───") |
| 220 | fmt.Fprintln(w, b.Text) |
| 221 | } |
| 222 | case "tool_use": |
| 223 | renderToolUse(w, b) |
| 224 | } |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | func renderToolUse(w io.Writer, b contentBlock) { |
| 229 | summary := formatToolInput(b.Name, b.Input) |
no test coverage detected