( text: string, maxLength = DEFAULT_BASHER_OUTPUT_PREVIEW_MAX_LENGTH, )
| 10 | const PREVIEW_ELLIPSIS = '...' |
| 11 | |
| 12 | export function truncateToSingleLinePreview( |
| 13 | text: string, |
| 14 | maxLength = DEFAULT_BASHER_OUTPUT_PREVIEW_MAX_LENGTH, |
| 15 | ): string | undefined { |
| 16 | const singleLine = text.replace(/\s+/g, ' ').trim() |
| 17 | if (!singleLine) { |
| 18 | return undefined |
| 19 | } |
| 20 | |
| 21 | if (singleLine.length <= maxLength) { |
| 22 | return singleLine |
| 23 | } |
| 24 | |
| 25 | const previewLength = Math.max(0, maxLength - PREVIEW_ELLIPSIS.length) |
| 26 | return `${singleLine.slice(0, previewLength).trimEnd()}${PREVIEW_ELLIPSIS}` |
| 27 | } |
| 28 | |
| 29 | export function getAgentDisplayPrompt( |
| 30 | agentBlock: AgentContentBlock, |
no outgoing calls
no test coverage detected