@@ -11,7 +11,7 @@ import { useDiffComponent } from "../context/diff"
1111import { getDirectory , getFilename } from "@opencode-ai/util/path"
1212
1313import { Binary } from "@opencode-ai/util/binary"
14- import { createEffect , createMemo , For , Match , on , onCleanup , ParentProps , Show , Switch } from "solid-js"
14+ import { createEffect , createMemo , createSignal , For , Match , on , onCleanup , ParentProps , Show , Switch } from "solid-js"
1515import { createResizeObserver } from "@solid-primitives/resize-observer"
1616import { DiffChanges } from "./diff-changes"
1717import { Typewriter } from "./typewriter"
@@ -21,6 +21,8 @@ import { Accordion } from "./accordion"
2121import { StickyAccordionHeader } from "./sticky-accordion-header"
2222import { FileIcon } from "./file-icon"
2323import { Icon } from "./icon"
24+ import { IconButton } from "./icon-button"
25+ import { Tooltip } from "./tooltip"
2426import { Card } from "./card"
2527import { Dynamic } from "solid-js/web"
2628import { Button } from "./button"
@@ -328,6 +330,15 @@ export function SessionTurn(
328330 const hasDiffs = createMemo ( ( ) => message ( ) ?. summary ?. diffs ?. length )
329331 const hideResponsePart = createMemo ( ( ) => ! working ( ) && ! ! responsePartId ( ) )
330332
333+ const [ responseCopied , setResponseCopied ] = createSignal ( false )
334+ const handleCopyResponse = async ( ) => {
335+ const content = response ( )
336+ if ( ! content ) return
337+ await navigator . clipboard . writeText ( content )
338+ setResponseCopied ( true )
339+ setTimeout ( ( ) => setResponseCopied ( false ) , 2000 )
340+ }
341+
331342 function duration ( ) {
332343 const msg = message ( )
333344 if ( ! msg ) return ""
@@ -556,6 +567,15 @@ export function SessionTurn(
556567 { /* Response */ }
557568 < Show when = { ! working ( ) && ( response ( ) || hasDiffs ( ) ) } >
558569 < div data-slot = "session-turn-summary-section" >
570+ < div data-slot = "session-turn-summary-copy" >
571+ < Tooltip value = { responseCopied ( ) ? "Copied!" : "Copy" } placement = "top" gutter = { 8 } >
572+ < IconButton
573+ icon = { responseCopied ( ) ? "check" : "copy" }
574+ variant = "secondary"
575+ onClick = { handleCopyResponse }
576+ />
577+ </ Tooltip >
578+ </ div >
559579 < div data-slot = "session-turn-summary-header" >
560580 < h2 data-slot = "session-turn-summary-title" > Response</ h2 >
561581 < Markdown
0 commit comments