File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,6 +59,21 @@ export function normalizeCompactToolLabel(value: string): string {
5959 return value . replace ( / \s + (?: c o m p l e t e | c o m p l e t e d ) \s * $ / i, "" ) . trim ( ) ;
6060}
6161
62+ export function resolveAssistantMessageCopyState ( {
63+ text,
64+ streaming,
65+ } : {
66+ text : string | null ;
67+ streaming : boolean ;
68+ } ) {
69+ const hasText = text !== null && text . trim ( ) . length > 0 ;
70+ return {
71+ disabled : streaming ,
72+ text : hasText ? text : null ,
73+ visible : streaming || hasText ,
74+ } ;
75+ }
76+
6277export function deriveMessagesTimelineRows ( input : {
6378 timelineEntries : ReadonlyArray < TimelineEntry > ;
6479 completionDividerBeforeEntryId : string | null ;
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ import {
4545 deriveMessagesTimelineRows ,
4646 estimateMessagesTimelineRowHeight ,
4747 normalizeCompactToolLabel ,
48+ resolveAssistantMessageCopyState ,
4849 type MessagesTimelineRow ,
4950} from "./MessagesTimeline.logic" ;
5051import { TerminalContextInlineChip } from "./TerminalContextInlineChip" ;
Original file line number Diff line number Diff line change 88} from "./terminalStateStore" ;
99
1010const THREAD_ID = ThreadId . makeUnsafe ( "thread-1" ) ;
11- const TERMINAL_STATE_STORAGE_KEY = "t3code:terminal-state:v1" ;
1211
1312function makeTerminalEvent (
1413 type : TerminalEvent [ "type" ] ,
Original file line number Diff line number Diff line change @@ -45,34 +45,6 @@ function createTerminalStateStorage() {
4545 return resolveStorage ( typeof window !== "undefined" ? window . localStorage : undefined ) ;
4646}
4747
48- function createMemoryStorage ( ) : StateStorage {
49- const store = new Map < string , string > ( ) ;
50- return {
51- getItem : ( name ) => store . get ( name ) ?? null ,
52- setItem : ( name , value ) => {
53- store . set ( name , value ) ;
54- } ,
55- removeItem : ( name ) => {
56- store . delete ( name ) ;
57- } ,
58- } ;
59- }
60-
61- function createTerminalStateStorage ( ) {
62- if (
63- typeof localStorage !== "undefined" &&
64- typeof localStorage . getItem === "function" &&
65- typeof localStorage . setItem === "function" &&
66- typeof localStorage . removeItem === "function"
67- ) {
68- return localStorage ;
69- }
70-
71- return createMemoryStorage ( ) ;
72- }
73-
74- const terminalStateStorage = createTerminalStateStorage ( ) ;
75-
7648function normalizeTerminalIds ( terminalIds : string [ ] ) : string [ ] {
7749 const ids = [ ...new Set ( terminalIds . map ( ( id ) => id . trim ( ) ) . filter ( ( id ) => id . length > 0 ) ) ] ;
7850 return ids . length > 0 ? ids : [ DEFAULT_THREAD_TERMINAL_ID ] ;
You can’t perform that action at this time.
0 commit comments