Render inline visualization links in the TUI (#33925)

## Why

Assistant-authored inline visualizations need a terminal fallback that lets users open generated artifacts in a browser.

## What changed

- Recognize `::codex-inline-vis{file="..."}` directives in assistant Markdown and replace them with browser links during streaming, finalized history rendering, and local transcript previews.
- Materialize visualization fragments in sandboxed viewer documents with a content security policy, while restricting artifacts to HTML files within the thread's visualization directory and limiting their size.
- Show an explicit unavailable message for invalid or missing artifacts, hide incomplete streaming directives, and preserve directive text in code blocks and user Markdown.
- Add a trusted file-link path for generated viewers without enabling arbitrary `file:` links in Markdown.

## Testing

Add coverage for directive rewriting, streaming and replay, artifact validation, sandboxed viewer generation, trusted terminal hyperlinks, and literal preservation.

GitOrigin-RevId: a666b4ebc82bb5798ad45bd137fd815d538e1de2
This commit is contained in:
Felipe Coury authored and copyberry committed 2026-07-17 23:19:12 +00:00
1 parent 97dbd01a3d
commit f896ab9f25
23 files changed
+2123 -106

No files matched your search

+4 -4
View File
@@ -893,10 +893,10 @@ impl HistoryCell for StatusHistoryCell {
if let Some(start_byte) = visible.find(CHATGPT_USAGE_URL) {
let start = visible[..start_byte].width();
line.hyperlinks
.push(crate::terminal_hyperlinks::TerminalHyperlink {
columns: start..start + CHATGPT_USAGE_URL.width(),
destination: CHATGPT_USAGE_URL.to_string(),
});
.push(crate::terminal_hyperlinks::TerminalHyperlink::web(
start..start + CHATGPT_USAGE_URL.width(),
CHATGPT_USAGE_URL.to_string(),
));
}
}
lines