MCPcopy Index your code
hub / github.com/Noumena-Network/code / extractFirstPrompt

Function extractFirstPrompt

src/utils/sessionStorage.ts:1883–1898  ·  view source on GitHub ↗
(transcript: TranscriptMessage[])

Source from the content-addressed store, hash-verified

1881}
1882
1883function 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).

Callers 3

convertToLogOptionFunction · 0.70
loadFullLogFunction · 0.70

Tested by

no test coverage detected