Derive a session title from a user message: first line, truncated.
(text: string)
| 1971 | |
| 1972 | /** Derive a session title from a user message: first line, truncated. */ |
| 1973 | function deriveSessionTitle(text: string): string { |
| 1974 | // Collapse whitespace — newlines/tabs would break the single-line status display. |
| 1975 | const flat = text.replace(/\s+/g, ' ').trim() |
| 1976 | return truncateToWidth(flat, TITLE_MAX_LEN) |
| 1977 | } |
| 1978 | |
| 1979 | /** |
| 1980 | * One-shot fetch of a session's title via GET /v1/sessions/{id}. |
no test coverage detected