Files
automaker/apps/ui/src/lib/summary-selection.ts
gsxdsm 9747faf1b9 Fix agent output summary for pipeline steps (#812)
* Changes from fix/agent-output-summary-for-pipeline-steps

* feat: Optimize pipeline summary extraction and fix regex vulnerability

* fix: Use fallback summary for pipeline steps when extraction fails

* fix: Strip follow-up session scaffold from pipeline step fallback summaries
2026-02-25 22:13:38 -08:00

15 lines
469 B
TypeScript

export type SummaryValue = string | null | undefined;
/**
* Returns the first summary candidate that contains non-whitespace content.
* The original string is returned (without trimming) to preserve formatting.
*/
export function getFirstNonEmptySummary(...candidates: SummaryValue[]): string | null {
for (const candidate of candidates) {
if (typeof candidate === 'string' && candidate.trim().length > 0) {
return candidate;
}
}
return null;
}