feat(flow-chat): add full-process / result-only scopes to copy and session export - #1765
Merged
Merged
Conversation
…ssion export Copying a dialog turn always included thinking and tool calls, so archiving a clean answer meant hand-editing the clipboard. Sessions had no Markdown export at all. - Copy dialog (round footer + context menu) now offers "full process" and "result only". - Session list menu gains "Export as Markdown", with the same two scopes at a second menu level. Turns are read from persistence, so a partially hydrated history session still exports in full. - Both paths share one formatter that normalizes the runtime and persisted turn shapes; the extraction logic previously existed in three near-identical copies, one of which was dead code (flow_chat/hooks/useCopyDialog.ts). The persisted path also gains behavior the old copy lacked: items are ordered by orderIndex, and superseded retry attempts are dropped. Tool payloads are wrapped in width-adjusted code fences so content containing ``` cannot break out of the block. Fixes GCWing#1657 Fixes GCWing#1506 Fixes GCWing#1495
This was referenced Jul 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a "full process" / "result only" choice everywhere a transcript leaves the app, and adds Markdown export for a whole session.
Both paths share one formatter. The turn-extraction logic previously existed in three near-identical copies —
ModelRoundItem.tsx,useFlowChatCopyDialog.ts, andflow_chat/hooks/useCopyDialog.ts(dead code, exported but never imported; now deleted) — which is why #1657 reproduced regardless of entry point.Fixes #1657
Fixes #1506
Fixes #1495
Type and Areas
Type: Feature (with a bug fix for #1657) + small refactor to remove duplication.
Areas: web UI (
flow_chat, NavPanel sessions section, context menu provider), locales.Motivation / Impact
Users copying a reply got the whole reasoning trace and every tool call, so archiving a clean answer meant editing the clipboard by hand (#1657, #1506). Sessions had no Markdown export at all (#1495).
New shared module
flow_chat/utils/dialogTranscriptExport.tsnormalizes the runtime (DialogTurn) and persisted (DialogTurnData) shapes into one intermediate form, then renders either clipboard text or a Markdown document per scope.Session export reads turns from persistence rather than the in-memory store, so a history session that has only hydrated its tail still exports in full. Desktop saves through the Tauri save dialog; the browser build falls back to a download.
Two correctness improvements the old copy path lacked, now applied on the persisted side:
orderIndexinstead of being grouped text → tool → thinking.Tool payloads are wrapped in width-adjusted code fences, so a result containing ``` can no longer break out of its block.
Exported Markdown
Verification
20 new unit tests cover both scopes,
orderIndexordering, retry-attempt filtering,<user_query>unwrapping, export file-name sanitization, and fence widening.Manually verified in the desktop app: both copy scopes from the round footer, and both export scopes from the session menu.
Testing level: fully tested (automated + manual desktop run). AI-assisted change.
Reviewer Notes
cleanRemoteUserInputwas byte-identical inFlowChatStoreandEventHandlerModule; extracted toflow_chat/utils/userInputText.tsso the exporter did not become a third copy.downloadMarkdownInBrowserwas copied fromCodeReviewReportExportActions.tsx; extracted toshared/utils/browserDownload.tsand both now import it.contextMenu.copyDialogwas replaced bycopyDialogFull/copyDialogResultin all three locales.'__TAURI__' in windowcheck is duplicated locally (as it is in ~20 other places in this repo); left alone to keep the PR focused.export_session_transcriptcommand is a different feature (agent-facing transcript for the session-history tool) and is untouched.