Add Markdown conversation export to the TUI (#37358)

## What changed

- Add `/export` with clipboard and file destinations, including a default filename prompt and support for an explicit path argument.
- Export the complete conversation history as structured Markdown, preserving user and assistant messages, plans, reasoning, activity, image labels, file changes, and MCP tool details while honoring reasoning visibility.
- Fall back to legacy history loading when pagination is unavailable, and use the visible transcript for ephemeral sessions.
- Resolve relative and home-relative paths without overwriting an existing file, and report export or copy results in the conversation.

## Testing

- Cover Markdown rendering, hidden review prompts, activity details, complete paginated and legacy history loading, destination prompts, status messages, path resolution, and overwrite protection.

GitOrigin-RevId: c2815fc2430d7a555da75d7038cc1ac08157b82e
This commit is contained in:
Eric Traut authored and copyberry committed 2026-08-07 02:45:35 +00:00
1 parent 4d7e3e90d9
commit 2801d12661
19 files changed
+795 -3

No files matched your search

+5
View File
@@ -44,6 +44,7 @@ pub enum SlashCommand {
Side,
Btw,
Copy,
Export,
Raw,
Diff,
Mention,
@@ -96,6 +97,7 @@ impl SlashCommand {
SlashCommand::App => "continue this session in the Desktop app",
SlashCommand::Quit | SlashCommand::Exit => "exit Codex",
SlashCommand::Copy => "copy last response as markdown",
SlashCommand::Export => "export the conversation as markdown",
SlashCommand::Raw => "toggle raw scrollback mode for copy-friendly terminal selection",
SlashCommand::Diff => "show git diff (including untracked files)",
SlashCommand::Mention => "mention a file",
@@ -163,6 +165,7 @@ impl SlashCommand {
| SlashCommand::Ide
| SlashCommand::Keymap
| SlashCommand::Mcp
| SlashCommand::Export
| SlashCommand::Raw
| SlashCommand::Usage
| SlashCommand::Pets
@@ -178,6 +181,7 @@ impl SlashCommand {
matches!(
self,
SlashCommand::Copy
| SlashCommand::Export
| SlashCommand::Raw
| SlashCommand::Diff
| SlashCommand::Mention
@@ -196,6 +200,7 @@ impl SlashCommand {
| SlashCommand::Fork
| SlashCommand::Init
| SlashCommand::Compact
| SlashCommand::Export
| SlashCommand::Keymap
| SlashCommand::Vim
| SlashCommand::ElevateSandbox