From b4481e10bed5622fced1623e599365e42ba14fc0 Mon Sep 17 00:00:00 2001 From: Andrew Blakeslee Moore Date: Sun, 5 Jul 2026 19:42:59 -0700 Subject: [PATCH] Tool Call Card Alignment Nucleic-Session: FFDE42E0-22AB-4478-B2E2-FF69B2753CEE Co-authored-by: Nucleic --- .../NucleicRemote/Views/TranscriptRow.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/NucleicRemote/NucleicRemote/Views/TranscriptRow.swift b/NucleicRemote/NucleicRemote/Views/TranscriptRow.swift index 09e8ce3..d15743d 100644 --- a/NucleicRemote/NucleicRemote/Views/TranscriptRow.swift +++ b/NucleicRemote/NucleicRemote/Views/TranscriptRow.swift @@ -199,6 +199,19 @@ struct RunFinishedRow: View { } extension JSONValue { + /// Human-readable tool-result text: a plain string, the joined text of an MCP content array, + /// or the canonical JSON as a last resort. Mirrors the Mac's `TranscriptRow.resultText`, so an + /// answered-question card and a git-commit card read the result the same way on both platforms. + var resultText: String { + if let string = stringValue { return string } + if let array = arrayValue { + let texts = array.compactMap { $0["text"]?.stringValue } + if !texts.isEmpty { return texts.joined(separator: "\n") } + } + let canonical = canonicalString() + return canonical == "null" ? "" : canonical + } + /// A one-line gist of a tool input/result for the collapsed row. var compactSummary: String { switch self {