@@ -11,6 +11,7 @@ import {
1111 onCleanup ,
1212 Index ,
1313 type JSX ,
14+ type ComponentProps ,
1415} from "solid-js"
1516import { createStore } from "solid-js/store"
1617import stripAnsi from "strip-ansi"
@@ -49,6 +50,8 @@ import { getDirectory as _getDirectory, getFilename } from "@opencode-ai/core/ut
4950import { checksum } from "@opencode-ai/core/util/encode"
5051import { Tooltip } from "@opencode-ai/ui/tooltip"
5152import { IconButton } from "@opencode-ai/ui/icon-button"
53+ import { IconButtonV2 } from "@opencode-ai/ui/v2/icon-button-v2"
54+ import { TooltipV2 } from "@opencode-ai/ui/v2/tooltip-v2"
5255import { Spinner } from "@opencode-ai/ui/spinner"
5356import { TextShimmer } from "@opencode-ai/ui/text-shimmer"
5457import { AnimatedCountList } from "./tool-count-summary"
@@ -161,6 +164,7 @@ export interface MessageProps {
161164 actions ?: UserActions
162165 showAssistantCopyPartID ?: string | null
163166 showReasoningSummaries ?: boolean
167+ useV2Actions ?: boolean
164168}
165169
166170export type SessionAction = ( input : { sessionID : string ; messageID : string } ) => Promise < void > | void
@@ -182,6 +186,46 @@ export interface MessagePartProps {
182186 onContentRendered ?: ( ) => void
183187 showAssistantCopyPartID ?: string | null
184188 turnDurationMs ?: number
189+ useV2Actions ?: boolean
190+ }
191+
192+ function MessageActionButton (
193+ props : Pick < ComponentProps < "button" > , "disabled" | "onMouseDown" | "onClick" | "aria-label" > & {
194+ icon : "check" | "copy" | "reset"
195+ label : JSX . Element
196+ useV2 ?: boolean
197+ } ,
198+ ) {
199+ return (
200+ < Show
201+ when = { props . useV2 }
202+ fallback = {
203+ < Tooltip value = { props . label } placement = "top" gutter = { 4 } >
204+ < IconButton
205+ icon = { props . icon }
206+ size = "normal"
207+ variant = "ghost"
208+ disabled = { props . disabled }
209+ onMouseDown = { props . onMouseDown }
210+ onClick = { props . onClick }
211+ aria-label = { props [ "aria-label" ] }
212+ />
213+ </ Tooltip >
214+ }
215+ >
216+ < TooltipV2 value = { props . label } placement = "top" gutter = { 4 } >
217+ < IconButtonV2
218+ icon = { < Icon name = { props . icon } size = "small" /> }
219+ size = "normal"
220+ variant = "ghost-muted"
221+ disabled = { props . disabled }
222+ onMouseDown = { props . onMouseDown }
223+ onClick = { props . onClick }
224+ aria-label = { props [ "aria-label" ] }
225+ />
226+ </ TooltipV2 >
227+ </ Show >
228+ )
185229}
186230
187231export type PartComponent = Component < MessagePartProps >
@@ -640,6 +684,7 @@ export function AssistantParts(props: {
640684 messages : AssistantMessage [ ]
641685 showAssistantCopyPartID ?: string | null
642686 turnDurationMs ?: number
687+ useV2Actions ?: boolean
643688 working ?: boolean
644689 showReasoningSummaries ?: boolean
645690 shellToolDefaultOpen ?: boolean
@@ -724,6 +769,7 @@ export function AssistantParts(props: {
724769 message = { message ( ) ! }
725770 showAssistantCopyPartID = { props . showAssistantCopyPartID }
726771 turnDurationMs = { props . turnDurationMs }
772+ useV2Actions = { props . useV2Actions }
727773 defaultOpen = { partDefaultOpen ( item ( ) ! , props . shellToolDefaultOpen , props . editToolDefaultOpen ) }
728774 />
729775 </ Show >
@@ -851,7 +897,12 @@ export function Message(props: MessageProps) {
851897 < Switch >
852898 < Match when = { props . message . role === "user" && props . message } >
853899 { ( userMessage ) => (
854- < UserMessageDisplay message = { userMessage ( ) as UserMessage } parts = { props . parts } actions = { props . actions } />
900+ < UserMessageDisplay
901+ message = { userMessage ( ) as UserMessage }
902+ parts = { props . parts }
903+ actions = { props . actions }
904+ useV2Actions = { props . useV2Actions }
905+ />
855906 ) }
856907 </ Match >
857908 < Match when = { props . message . role === "assistant" && props . message } >
@@ -861,6 +912,7 @@ export function Message(props: MessageProps) {
861912 parts = { props . parts }
862913 showAssistantCopyPartID = { props . showAssistantCopyPartID }
863914 showReasoningSummaries = { props . showReasoningSummaries }
915+ useV2Actions = { props . useV2Actions }
864916 />
865917 ) }
866918 </ Match >
@@ -873,6 +925,7 @@ export function AssistantMessageDisplay(props: {
873925 parts : PartType [ ]
874926 showAssistantCopyPartID ?: string | null
875927 showReasoningSummaries ?: boolean
928+ useV2Actions ?: boolean
876929} ) {
877930 const emptyTools : ToolPart [ ] = [ ]
878931 const part = createMemo ( ( ) => index ( props . parts ) )
@@ -932,6 +985,7 @@ export function AssistantMessageDisplay(props: {
932985 part = { item ( ) ! }
933986 message = { props . message }
934987 showAssistantCopyPartID = { props . showAssistantCopyPartID }
988+ useV2Actions = { props . useV2Actions }
935989 />
936990 </ Show >
937991 )
@@ -1052,7 +1106,12 @@ export function ContextToolGroup(props: { parts: ToolPart[]; busy?: boolean; onS
10521106 )
10531107}
10541108
1055- export function UserMessageDisplay ( props : { message : UserMessage ; parts : PartType [ ] ; actions ?: UserActions } ) {
1109+ export function UserMessageDisplay ( props : {
1110+ message : UserMessage
1111+ parts : PartType [ ]
1112+ actions ?: UserActions
1113+ useV2Actions ?: boolean
1114+ } ) {
10561115 const data = useData ( )
10571116 const dialog = useDialog ( )
10581117 const i18n = useI18n ( )
@@ -1191,38 +1250,30 @@ export function UserMessageDisplay(props: { message: UserMessage; parts: PartTyp
11911250 </ span >
11921251 </ Show >
11931252 < Show when = { props . actions ?. revert } >
1194- < Tooltip value = { i18n . t ( "ui.message.revertMessage" ) } placement = "top" gutter = { 4 } >
1195- < IconButton
1196- icon = "reset"
1197- size = "normal"
1198- variant = "ghost"
1199- disabled = { ! ! busy ( ) }
1200- onMouseDown = { ( e ) => e . preventDefault ( ) }
1201- onClick = { ( event ) => {
1202- event . stopPropagation ( )
1203- revert ( )
1204- } }
1205- aria-label = { i18n . t ( "ui.message.revertMessage" ) }
1206- />
1207- </ Tooltip >
1208- </ Show >
1209- < Tooltip
1210- value = { copied ( ) ? i18n . t ( "ui.message.copied" ) : i18n . t ( "ui.message.copyMessage" ) }
1211- placement = "top"
1212- gutter = { 4 }
1213- >
1214- < IconButton
1215- icon = { copied ( ) ? "check" : "copy" }
1216- size = "normal"
1217- variant = "ghost"
1218- onMouseDown = { ( e ) => e . preventDefault ( ) }
1253+ < MessageActionButton
1254+ icon = "reset"
1255+ label = { i18n . t ( "ui.message.revertMessage" ) }
1256+ useV2 = { props . useV2Actions }
1257+ disabled = { ! ! busy ( ) }
1258+ onMouseDown = { ( event ) => event . preventDefault ( ) }
12191259 onClick = { ( event ) => {
12201260 event . stopPropagation ( )
1221- void handleCopy ( )
1261+ revert ( )
12221262 } }
1223- aria-label = { copied ( ) ? i18n . t ( "ui.message.copied" ) : i18n . t ( "ui.message.copyMessage ") }
1263+ aria-label = { i18n . t ( "ui.message.revertMessage " ) }
12241264 />
1225- </ Tooltip >
1265+ </ Show >
1266+ < MessageActionButton
1267+ icon = { copied ( ) ? "check" : "copy" }
1268+ label = { copied ( ) ? i18n . t ( "ui.message.copied" ) : i18n . t ( "ui.message.copyMessage" ) }
1269+ useV2 = { props . useV2Actions }
1270+ onMouseDown = { ( event ) => event . preventDefault ( ) }
1271+ onClick = { ( event ) => {
1272+ event . stopPropagation ( )
1273+ void handleCopy ( )
1274+ } }
1275+ aria-label = { copied ( ) ? i18n . t ( "ui.message.copied" ) : i18n . t ( "ui.message.copyMessage" ) }
1276+ />
12261277 </ div >
12271278 </ >
12281279 </ Show >
@@ -1286,6 +1337,7 @@ export function Part(props: MessagePartProps) {
12861337 onContentRendered = { props . onContentRendered }
12871338 showAssistantCopyPartID = { props . showAssistantCopyPartID }
12881339 turnDurationMs = { props . turnDurationMs }
1340+ useV2Actions = { props . useV2Actions }
12891341 />
12901342 </ Show >
12911343 )
@@ -1566,20 +1618,14 @@ PART_MAPPING["text"] = function TextPartDisplay(props) {
15661618 </ div >
15671619 < Show when = { showCopy ( ) } >
15681620 < div data-slot = "text-part-copy-wrapper" data-interrupted = { interrupted ( ) ? "" : undefined } >
1569- < Tooltip
1570- value = { copied ( ) ? i18n . t ( "ui.message.copied" ) : i18n . t ( "ui.message.copyResponse" ) }
1571- placement = "top"
1572- gutter = { 4 }
1573- >
1574- < IconButton
1575- icon = { copied ( ) ? "check" : "copy" }
1576- size = "normal"
1577- variant = "ghost"
1578- onMouseDown = { ( e ) => e . preventDefault ( ) }
1579- onClick = { handleCopy }
1580- aria-label = { copied ( ) ? i18n . t ( "ui.message.copied" ) : i18n . t ( "ui.message.copyResponse" ) }
1581- />
1582- </ Tooltip >
1621+ < MessageActionButton
1622+ icon = { copied ( ) ? "check" : "copy" }
1623+ label = { copied ( ) ? i18n . t ( "ui.message.copied" ) : i18n . t ( "ui.message.copyResponse" ) }
1624+ useV2 = { props . useV2Actions }
1625+ onMouseDown = { ( event ) => event . preventDefault ( ) }
1626+ onClick = { handleCopy }
1627+ aria-label = { copied ( ) ? i18n . t ( "ui.message.copied" ) : i18n . t ( "ui.message.copyResponse" ) }
1628+ />
15831629 < Show when = { meta ( ) } >
15841630 < span data-slot = "text-part-meta" class = "text-12-regular text-text-weak cursor-default" >
15851631 { meta ( ) }
0 commit comments