@@ -43,6 +43,8 @@ export interface ParsedTerminalContextEntry {
4343}
4444
4545export const INLINE_TERMINAL_CONTEXT_PLACEHOLDER = "\uFFFC" ;
46+ export const IMAGE_ONLY_BOOTSTRAP_PROMPT =
47+ "[User attached one or more images without additional text. Respond using the conversation context and the attached image(s).]" ;
4648
4749const TRAILING_TERMINAL_CONTEXT_BLOCK_PATTERN =
4850 / \n * < t e r m i n a l _ c o n t e x t > \n ( [ \s \S ] * ?) \n < \/ t e r m i n a l _ c o n t e x t > \s * $ / ;
@@ -245,15 +247,23 @@ export function extractTrailingTerminalContexts(prompt: string): ExtractedTermin
245247 } ;
246248}
247249
248- export function deriveDisplayedUserMessageState ( prompt : string ) : DisplayedUserMessageState {
250+ export function deriveDisplayedUserMessageState (
251+ prompt : string ,
252+ options ?: { readonly hasImageAttachments ?: boolean } ,
253+ ) : DisplayedUserMessageState {
249254 // Order matters: send-time appends `<terminal_context>` first, then
250255 // `<element_context>` last. Strip element first so the (now-trailing)
251256 // terminal block can be matched by `extractTrailingTerminalContexts`.
252257 const extractedElement = extractTrailingElementContexts ( prompt ) ;
253258 const extractedTerminal = extractTrailingTerminalContexts ( extractedElement . promptText ) ;
259+ const normalizedVisibleText = extractedTerminal . promptText . trim ( ) ;
260+ const hideImageOnlyBootstrapPrompt =
261+ options ?. hasImageAttachments === true &&
262+ ( normalizedVisibleText === IMAGE_ONLY_BOOTSTRAP_PROMPT ||
263+ normalizedVisibleText === `Ultrathink:\n${ IMAGE_ONLY_BOOTSTRAP_PROMPT } ` ) ;
254264 return {
255- visibleText : extractedTerminal . promptText ,
256- copyText : prompt ,
265+ visibleText : hideImageOnlyBootstrapPrompt ? "" : extractedTerminal . promptText ,
266+ copyText : hideImageOnlyBootstrapPrompt ? "" : prompt ,
257267 contextCount : extractedTerminal . contextCount ,
258268 previewTitle : extractedTerminal . previewTitle ,
259269 contexts : extractedTerminal . contexts ,
0 commit comments