Derive a session title from a user message: first line, truncated.
(text: string)
| 1954 | |
| 1955 | /** Derive a session title from a user message: first line, truncated. */ |
| 1956 | function deriveSessionTitle(text: string): string { |
| 1957 | // Collapse whitespace — newlines/tabs would break the single-line status display. |
| 1958 | const flat = text.replace(/\s+/g, ' ').trim() |
| 1959 | return truncateToWidth(flat, TITLE_MAX_LEN) |
| 1960 | } |
| 1961 | |
| 1962 | /** |
| 1963 | * One-shot fetch of a session's title via GET /v1/sessions/{id}. |
no test coverage detected