(raw: unknown)
| 385 | } |
| 386 | |
| 387 | function truncateUserMessagePreview(raw: unknown): string | undefined { |
| 388 | if (typeof raw !== 'string') return undefined |
| 389 | const collapsed = raw.replace(/\s+/g, ' ').trim() |
| 390 | if (!collapsed) return undefined |
| 391 | if (collapsed.length <= USER_MESSAGE_PREVIEW_MAX_CHARS) return collapsed |
| 392 | return `${collapsed.slice(0, USER_MESSAGE_PREVIEW_MAX_CHARS - 1)}…` |
| 393 | } |
| 394 | |
| 395 | // Request-shape metadata known only after branch resolution. Stamped |
| 396 | // on the root span for dashboard filtering. |
no test coverage detected