userPromptDisplayText function
Projects a persisted user message into the same privacy-safe text shown by the chat UI. Attachment envelopes and local image markers are metadata, not user-visible prompt content.
Implementation
String userPromptDisplayText(String text) {
const marker = '## My request for Codex:';
final markerIndex = text.indexOf(marker);
final display = markerIndex < 0
? text.trim()
: text.substring(markerIndex + marker.length).trim();
return display.replaceAll(_textImageMarkerPattern, '').trim();
}