-// eventText returns the text that the client shows for event, or "" for none.
-// The client shows a user message only from another source, such as telegram,
-// because the user typed the others. A tool result shows its first resultLines
-// lines.
-func eventText(event Event) string {
+// terminalCmpError returns err, or fallback when err is nil.
+func terminalCmpError(err, fallback error) error {
+ if err == nil {
+ return fallback
+ }
+
+ return err
+}
+
+// terminalEventText returns the text that the client shows for event, or "" for
+// none. The client shows a user message only from another source, such as
+// telegram, because the user typed the others. A tool result shows its first
+// terminalResultLines lines.
+func terminalEventText(event Event) string {