* Render MCP text output. Tries three strategies in order: * 1. If JSON wraps a single dominant text payload (e.g. slack's * {"messages":"line1\nline2..."}), unwrap and let OutputLine truncate. * 2. If JSON is a small flat-ish object, render as aligned key: value. * 3. Otherwise fall through
(t0)
| 157 | * 3. Otherwise fall through to OutputLine (pretty-print + truncate). |
| 158 | */ |
| 159 | function MCPTextOutput(t0) { |
| 160 | const $ = _c(18); |
| 161 | const { |
| 162 | content, |
| 163 | verbose |
| 164 | } = t0; |
| 165 | let t1; |
| 166 | if ($[0] !== content || $[1] !== verbose) { |
| 167 | t1 = Symbol.for("react.early_return_sentinel"); |
| 168 | bb0: { |
| 169 | const unwrapped = tryUnwrapTextPayload(content); |
| 170 | if (unwrapped !== null) { |
| 171 | const t2 = unwrapped.extras.length > 0 && <Text dimColor={true}>{unwrapped.extras.map(_temp).join(" \xB7 ")}</Text>; |
| 172 | let t3; |
| 173 | if ($[3] !== unwrapped || $[4] !== verbose) { |
| 174 | t3 = <OutputLine content={unwrapped.body} verbose={verbose} linkifyUrls={true} />; |
| 175 | $[3] = unwrapped; |
| 176 | $[4] = verbose; |
| 177 | $[5] = t3; |
| 178 | } else { |
| 179 | t3 = $[5]; |
| 180 | } |
| 181 | let t4; |
| 182 | if ($[6] !== t2 || $[7] !== t3) { |
| 183 | t4 = <MessageResponse><Box flexDirection="column">{t2}{t3}</Box></MessageResponse>; |
| 184 | $[6] = t2; |
| 185 | $[7] = t3; |
| 186 | $[8] = t4; |
| 187 | } else { |
| 188 | t4 = $[8]; |
| 189 | } |
| 190 | t1 = t4; |
| 191 | break bb0; |
| 192 | } |
| 193 | } |
| 194 | $[0] = content; |
| 195 | $[1] = verbose; |
| 196 | $[2] = t1; |
| 197 | } else { |
| 198 | t1 = $[2]; |
| 199 | } |
| 200 | if (t1 !== Symbol.for("react.early_return_sentinel")) { |
| 201 | return t1; |
| 202 | } |
| 203 | let t2; |
| 204 | if ($[9] !== content) { |
| 205 | t2 = Symbol.for("react.early_return_sentinel"); |
| 206 | bb1: { |
| 207 | const flat = tryFlattenJson(content); |
| 208 | if (flat !== null) { |
| 209 | const maxKeyWidth = Math.max(...flat.map(_temp2)); |
| 210 | let t3; |
| 211 | if ($[11] !== maxKeyWidth) { |
| 212 | t3 = (t4, i) => { |
| 213 | const [key, value] = t4; |
| 214 | return <Text key={i}><Text dimColor={true}>{key.padEnd(maxKeyWidth)}: </Text><Ansi>{linkifyUrlsInText(value)}</Ansi></Text>; |
| 215 | }; |
| 216 | $[11] = maxKeyWidth; |
nothing calls this directly
no test coverage detected