@@ -18,7 +18,14 @@ import { SplitBorder } from "@tui/component/border"
1818import { syntaxTheme , Theme } from "@tui/context/theme"
1919import { BoxRenderable , ScrollBoxRenderable , addDefaultParsers } from "@opentui/core"
2020import { Prompt , type PromptRef } from "@tui/component/prompt"
21- import type { AssistantMessage , Part , ToolPart , UserMessage , TextPart , ReasoningPart } from "@opencode-ai/sdk"
21+ import type {
22+ AssistantMessage ,
23+ Part ,
24+ ToolPart ,
25+ UserMessage ,
26+ TextPart ,
27+ ReasoningPart ,
28+ } from "@opencode-ai/sdk"
2229import { useLocal } from "@tui/context/local"
2330import { Locale } from "@/util/locale"
2431import type { Tool } from "@/tool/tool"
@@ -177,19 +184,18 @@ export function Session() {
177184 disabled : ! ! session ( ) ?. share ?. url ,
178185 category : "Session" ,
179186 onSelect : async ( dialog ) => {
180- await sdk . client . session . share ( {
181- path : {
182- id : route . sessionID ,
183- } ,
184- } )
187+ await sdk . client . session
188+ . share ( {
189+ path : {
190+ id : route . sessionID ,
191+ } ,
192+ } )
185193 . then ( ( res ) =>
186194 Clipboard . copy ( res . data ! . share ! . url ) . catch ( ( ) =>
187- toast . show ( { message : "Failed to copy URL to clipboard" , type : "error" } )
188- )
189- )
190- . then ( ( ) =>
191- toast . show ( { message : "Share URL copied to clipboard!" , type : "success" } )
195+ toast . show ( { message : "Failed to copy URL to clipboard" , type : "error" } ) ,
196+ ) ,
192197 )
198+ . then ( ( ) => toast . show ( { message : "Share URL copied to clipboard!" , type : "success" } ) )
193199 . catch ( ( ) => toast . show ( { message : "Failed to share session" , type : "error" } ) )
194200 dialog . clear ( )
195201 } ,
@@ -399,7 +405,14 @@ export function Session() {
399405 } ,
400406 } }
401407 >
402- < box flexDirection = "row" paddingBottom = { 1 } paddingTop = { 1 } paddingLeft = { 2 } paddingRight = { 2 } gap = { 2 } >
408+ < box
409+ flexDirection = "row"
410+ paddingBottom = { 1 }
411+ paddingTop = { 1 }
412+ paddingLeft = { 2 }
413+ paddingRight = { 2 }
414+ gap = { 2 }
415+ >
403416 < box flexGrow = { 1 } gap = { 1 } >
404417 < Show when = { session ( ) } >
405418 < Show when = { ! sidebarVisible ( ) } >
@@ -447,12 +460,18 @@ export function Session() {
447460 paddingTop = { 1 }
448461 paddingBottom = { 1 }
449462 paddingLeft = { 2 }
450- backgroundColor = { hover ( ) ? Theme . backgroundElement : Theme . backgroundPanel }
463+ backgroundColor = {
464+ hover ( ) ? Theme . backgroundElement : Theme . backgroundPanel
465+ }
451466 >
452- < text fg = { Theme . textMuted } > { revert ( ) ! . reverted . length } message reverted</ text >
453467 < text fg = { Theme . textMuted } >
454- < span style = { { fg : Theme . text } } > { keybind . print ( "messages_redo" ) } </ span > or /redo to
455- restore
468+ { revert ( ) ! . reverted . length } message reverted
469+ </ text >
470+ < text fg = { Theme . textMuted } >
471+ < span style = { { fg : Theme . text } } >
472+ { keybind . print ( "messages_redo" ) }
473+ </ span > { " " }
474+ or /redo to restore
456475 </ text >
457476 < Show when = { revert ( ) ! . diffFiles ?. length } >
458477 < box marginTop = { 1 } >
@@ -461,10 +480,16 @@ export function Session() {
461480 < text >
462481 { file . filename }
463482 < Show when = { file . additions > 0 } >
464- < span style = { { fg : Theme . diffAdded } } > +{ file . additions } </ span >
483+ < span style = { { fg : Theme . diffAdded } } >
484+ { " " }
485+ +{ file . additions }
486+ </ span >
465487 </ Show >
466488 < Show when = { file . deletions > 0 } >
467- < span style = { { fg : Theme . diffRemoved } } > -{ file . deletions } </ span >
489+ < span style = { { fg : Theme . diffRemoved } } >
490+ { " " }
491+ -{ file . deletions }
492+ </ span >
468493 </ Show >
469494 </ text >
470495 ) }
@@ -483,7 +508,9 @@ export function Session() {
483508 < UserMessage
484509 index = { index ( ) }
485510 onMouseUp = { ( ) =>
486- dialog . replace ( ( ) => < DialogMessage messageID = { message . id } sessionID = { route . sessionID } /> )
511+ dialog . replace ( ( ) => (
512+ < DialogMessage messageID = { message . id } sessionID = { route . sessionID } />
513+ ) )
487514 }
488515 message = { message as UserMessage }
489516 parts = { sync . data . part [ message . id ] ?? [ ] }
@@ -539,7 +566,9 @@ function UserMessage(props: {
539566 index : number
540567 pending ?: string
541568} ) {
542- const text = createMemo ( ( ) => props . parts . flatMap ( ( x ) => ( x . type === "text" && ! x . synthetic ? [ x ] : [ ] ) ) [ 0 ] )
569+ const text = createMemo (
570+ ( ) => props . parts . flatMap ( ( x ) => ( x . type === "text" && ! x . synthetic ? [ x ] : [ ] ) ) [ 0 ] ,
571+ )
543572 const files = createMemo ( ( ) => props . parts . flatMap ( ( x ) => ( x . type === "file" ? [ x ] : [ ] ) ) )
544573 const sync = useSync ( )
545574 const [ hover , setHover ] = createSignal ( false )
@@ -579,8 +608,14 @@ function UserMessage(props: {
579608 } )
580609 return (
581610 < text >
582- < span style = { { bg : bg ( ) , fg : Theme . background } } > { MIME_BADGE [ file . mime ] ?? file . mime } </ span >
583- < span style = { { bg : Theme . backgroundElement , fg : Theme . textMuted } } > { file . filename } </ span >
611+ < span style = { { bg : bg ( ) , fg : Theme . background } } >
612+ { " " }
613+ { MIME_BADGE [ file . mime ] ?? file . mime } { " " }
614+ </ span >
615+ < span style = { { bg : Theme . backgroundElement , fg : Theme . textMuted } } >
616+ { " " }
617+ { file . filename } { " " }
618+ </ span >
584619 </ text >
585620 )
586621 } }
@@ -591,9 +626,16 @@ function UserMessage(props: {
591626 { sync . data . config . username ?? "You" } { " " }
592627 < Show
593628 when = { queued ( ) }
594- fallback = { < span style = { { fg : Theme . textMuted } } > ({ Locale . time ( props . message . time . created ) } )</ span > }
629+ fallback = {
630+ < span style = { { fg : Theme . textMuted } } >
631+ ({ Locale . time ( props . message . time . created ) } )
632+ </ span >
633+ }
595634 >
596- < span style = { { bg : Theme . accent , fg : Theme . backgroundPanel , bold : true } } > QUEUED </ span >
635+ < span style = { { bg : Theme . accent , fg : Theme . backgroundPanel , bold : true } } >
636+ { " " }
637+ QUEUED{ " " }
638+ </ span >
597639 </ Show >
598640 </ text >
599641 </ box >
@@ -632,7 +674,8 @@ function AssistantMessage(props: { message: AssistantMessage; parts: Part[]; las
632674 < Show
633675 when = {
634676 ! props . message . time . completed ||
635- ( props . last && props . parts . some ( ( item ) => item . type === "step-finish" && item . reason === "tool-calls" ) )
677+ ( props . last &&
678+ props . parts . some ( ( item ) => item . type === "step-finish" && item . reason === "tool-calls" ) )
636679 }
637680 >
638681 < box
@@ -644,7 +687,9 @@ function AssistantMessage(props: { message: AssistantMessage; parts: Part[]; las
644687 customBorderChars = { SplitBorder . customBorderChars }
645688 borderColor = { Theme . backgroundElement }
646689 >
647- < text fg = { local . agent . color ( props . message . mode ) } > { Locale . titlecase ( props . message . mode ) } </ text >
690+ < text fg = { local . agent . color ( props . message . mode ) } >
691+ { Locale . titlecase ( props . message . mode ) }
692+ </ text >
648693 < Shimmer text = { `${ props . message . modelID } ` } color = { Theme . text } />
649694 </ box >
650695 </ Show >
@@ -656,7 +701,9 @@ function AssistantMessage(props: { message: AssistantMessage; parts: Part[]; las
656701 >
657702 < box paddingLeft = { 3 } >
658703 < text marginTop = { 1 } >
659- < span style = { { fg : local . agent . color ( props . message . mode ) } } > { Locale . titlecase ( props . message . mode ) } </ span > { " " }
704+ < span style = { { fg : local . agent . color ( props . message . mode ) } } >
705+ { Locale . titlecase ( props . message . mode ) }
706+ </ span > { " " }
660707 < span style = { { fg : Theme . textMuted } } > { props . message . modelID } </ span >
661708 </ text >
662709 </ box >
@@ -682,7 +729,12 @@ function ReasoningPart(props: { part: ReasoningPart; message: AssistantMessage }
682729 customBorderChars = { SplitBorder . customBorderChars }
683730 borderColor = { Theme . backgroundPanel }
684731 >
685- < box paddingTop = { 1 } paddingBottom = { 1 } paddingLeft = { 2 } backgroundColor = { Theme . backgroundPanel } >
732+ < box
733+ paddingTop = { 1 }
734+ paddingBottom = { 1 }
735+ paddingLeft = { 2 }
736+ backgroundColor = { Theme . backgroundPanel }
737+ >
686738 < text > { props . part . text . trim ( ) } </ text >
687739 </ box >
688740 </ box >
@@ -814,7 +866,10 @@ function GenericTool(props: ToolProps<any>) {
814866}
815867
816868const ToolRegistry = ( ( ) => {
817- const state : Record < string , { name : string ; container : "inline" | "block" ; render ?: Component < ToolProps < any > > } > = { }
869+ const state : Record <
870+ string ,
871+ { name : string ; container : "inline" | "block" ; render ?: Component < ToolProps < any > > }
872+ > = { }
818873 function register < T extends Tool . Info > ( input : {
819874 name : string
820875 container : "inline" | "block"
@@ -908,10 +963,16 @@ ToolRegistry.register<typeof WriteTool>({
908963 </ ToolTitle >
909964 < box flexDirection = "row" >
910965 < box flexShrink = { 0 } >
911- < For each = { numbers ( ) } > { ( value ) => < text style = { { fg : Theme . textMuted } } > { value } </ text > } </ For >
966+ < For each = { numbers ( ) } >
967+ { ( value ) => < text style = { { fg : Theme . textMuted } } > { value } </ text > }
968+ </ For >
912969 </ box >
913970 < box paddingLeft = { 1 } flexGrow = { 1 } >
914- < code filetype = { filetype ( props . input . filePath ! ) } syntaxStyle = { syntaxTheme } content = { code ( ) } />
971+ < code
972+ filetype = { filetype ( props . input . filePath ! ) }
973+ syntaxStyle = { syntaxTheme }
974+ content = { code ( ) }
975+ />
915976 </ box >
916977 </ box >
917978 </ >
@@ -926,7 +987,8 @@ ToolRegistry.register<typeof GlobTool>({
926987 return (
927988 < >
928989 < ToolTitle icon = "✱" fallback = "Finding files..." when = { props . input . pattern } >
929- Glob "{ props . input . pattern } " < Show when = { props . input . path } > in { normalizePath ( props . input . path ) } </ Show >
990+ Glob "{ props . input . pattern } "{ " " }
991+ < Show when = { props . input . path } > in { normalizePath ( props . input . path ) } </ Show >
930992 < Show when = { props . metadata . count } > ({ props . metadata . count } matches)</ Show >
931993 </ ToolTitle >
932994 </ >
@@ -940,7 +1002,8 @@ ToolRegistry.register<typeof GrepTool>({
9401002 render ( props ) {
9411003 return (
9421004 < ToolTitle icon = "✱" fallback = "Searching content..." when = { props . input . pattern } >
943- Grep "{ props . input . pattern } " < Show when = { props . input . path } > in { normalizePath ( props . input . path ) } </ Show >
1005+ Grep "{ props . input . pattern } "{ " " }
1006+ < Show when = { props . input . path } > in { normalizePath ( props . input . path ) } </ Show >
9441007 < Show when = { props . metadata . matches } > ({ props . metadata . matches } matches)</ Show >
9451008 </ ToolTitle >
9461009 )
0 commit comments