(transcript: TranscriptMessage[])
| 1881 | } |
| 1882 | |
| 1883 | function extractFirstPrompt(transcript: TranscriptMessage[]): string { |
| 1884 | const textContent = getFirstMeaningfulUserMessageTextContent(transcript) |
| 1885 | if (textContent) { |
| 1886 | let result = textContent.replace(/\n/g, ' ').trim() |
| 1887 | |
| 1888 | // Store a reasonably long version for display-time truncation |
| 1889 | // The actual truncation will be applied at display time based on terminal width |
| 1890 | if (result.length > 200) { |
| 1891 | result = result.slice(0, 200).trim() + '…' |
| 1892 | } |
| 1893 | |
| 1894 | return result |
| 1895 | } |
| 1896 | |
| 1897 | return 'No prompt' |
| 1898 | } |
| 1899 | |
| 1900 | /** |
| 1901 | * Gets the last user message that was processed (i.e., before any non-user message appears). |
no test coverage detected