( agentBlock: AgentContentBlock, maxLength = DEFAULT_BASHER_OUTPUT_PREVIEW_MAX_LENGTH, )
| 45 | } |
| 46 | |
| 47 | export function getBasherFinishedOutputPreview( |
| 48 | agentBlock: AgentContentBlock, |
| 49 | maxLength = DEFAULT_BASHER_OUTPUT_PREVIEW_MAX_LENGTH, |
| 50 | ): string | undefined { |
| 51 | if ( |
| 52 | getAgentBaseName(agentBlock.agentType) !== 'basher' || |
| 53 | agentBlock.status === 'running' |
| 54 | ) { |
| 55 | return undefined |
| 56 | } |
| 57 | |
| 58 | const blocks = agentBlock.blocks ?? [] |
| 59 | return ( |
| 60 | truncateToSingleLinePreview(getTextOutput(blocks), maxLength) ?? |
| 61 | truncateToSingleLinePreview(getCommandOutput(blocks), maxLength) |
| 62 | ) |
| 63 | } |
| 64 | |
| 65 | function getTextOutput( |
| 66 | blocks: NonNullable<AgentContentBlock['blocks']>, |
no test coverage detected