(output: unknown)
| 196 | } |
| 197 | |
| 198 | function outputSize(output: unknown): number { |
| 199 | if (typeof output === 'string') return output.length; |
| 200 | if (Array.isArray(output)) { |
| 201 | let n = 0; |
| 202 | for (const part of output) { |
| 203 | const text = (part as { text?: string })?.text; |
| 204 | n += typeof text === 'string' ? text.length : JSON.stringify(part ?? null).length; |
| 205 | } |
| 206 | return n; |
| 207 | } |
| 208 | return 0; |
| 209 | } |
| 210 | |
| 211 | export function analyzeWire(entries: readonly WireEntry[]): Analysis { |
| 212 | const turns: TurnNode[] = []; |