Let users copy the current chat session as markdown

The conversation header menu gets a Copy chat row that puts the active
session on the clipboard as one markdown document: a summary, then each
message under its author and time, with quotes, attachments and
reactions. Bot and workspace refs read as names, message headings drop
below the message headings and code blocks stay untouched. The clipboard
write starts on the click with a pending ClipboardItem so Safari allows
it after the fetch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-25 11:49:46 +01:00
co-authored by Claude Opus 5.5
parent d7f88d8dd3
commit 84f8c0cac8
12 changed files with 641 additions and 2 deletions
+32
View File
@@ -1326,6 +1326,38 @@ export type ConversationHistory = {
* where to go instead when the user can't chat with the bot there any
* more.
*/
/**
* A conversation's active session for "Copy chat"
* (`grabConversationExport`): its messages, oldest first, and the names of
* the bots and workspaces they mention.
*/
export type ConversationExport = {
bot_name: string;
workspace_name: string | null;
/**
* Who the user messages are from.
*/
user_name: string;
/**
* Null while the conversation has no session yet.
*/
session: ConversationExportSession | null;
messages: BotMessageWithAttachments[];
/**
* Names by id, only for what the user reaches.
*/
ref_names: {
bots: Record<number, string>;
workspaces: Record<number, string>;
};
};
export type ConversationExportSession = {
id: number;
title: string | null;
created_at: number;
};
export type ConversationHistoryPayload = {
history?: ConversationHistory;
redirect?: string;