| 60 | |
| 61 | // Helper to wrap text into lines |
| 62 | function wrapText(text: string, width: number): string[] { |
| 63 | const words = text.split(' '); |
| 64 | const lines: string[] = []; |
| 65 | let currentLine = ''; |
| 66 | |
| 67 | for (const word of words) { |
| 68 | if (currentLine.length + word.length + 1 <= width) { |
| 69 | currentLine += (currentLine ? ' ' : '') + word; |
| 70 | } else { |
| 71 | if (currentLine) lines.push(currentLine); |
| 72 | currentLine = word.slice(0, width); // Truncate very long words |
| 73 | } |
| 74 | } |
| 75 | if (currentLine) lines.push(currentLine); |
| 76 | return lines; |
| 77 | } |
| 78 | |
| 79 | function AgentPanel({ agent, width }: { agent: AgentState; width: number }) { |
| 80 | const maxLines = 15; |