MCPcopy Index your code
hub / github.com/braintrustdata/bash-agent-evals / wrapText

Function wrapText

src/cli.tsx:62–77  ·  view source on GitHub ↗
(text: string, width: number)

Source from the content-addressed store, hash-verified

60
61// Helper to wrap text into lines
62function 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
79function AgentPanel({ agent, width }: { agent: AgentState; width: number }) {
80 const maxLines = 15;

Callers 1

AgentPanelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected