Files
oh-my-pi/packages/coding-agent/src/utils/thinking-display.ts
T
can1357 e8ef706abf fix: filtered out whitespace-only assistant and thinking blocks from output
- Canonicalized assistant and thinking messages by trimming and collapsing dot text.
- Skipped rendering assistant and thinking blocks when canonicalized content was empty.
- Filtered ACP thinking notifications and session outputs to ignore placeholder content.
- Added canonicalizeMessage tests for undefined, blank, whitespace, and dot-only inputs.
2026-06-15 12:40:00 +02:00

12 lines
364 B
TypeScript

export function canonicalizeMessage(text: string | null | undefined): string {
if (!text) return "";
const trimmed = text.trim();
for (let i = 0; i < trimmed.length; i++) {
const code = trimmed.charCodeAt(i);
if (code !== 0x2e && code !== 0x2026 && code !== 0x20 && code !== 0x09 && code !== 0x0a && code !== 0x0d) {
return trimmed;
}
}
return "";
}