@@ -235,6 +235,21 @@ export type AppProps = {
235235 onFirstUserMessage ?: ( ) => void ;
236236} ;
237237
238+ // Center a selection in a fixed-height window over a copy-target list.
239+ // Returns the visible slice and the absolute index of its first item so
240+ // the caller can mark the selected row without re-scanning the full list.
241+ function windowedCopyTargets (
242+ items : readonly CopyTarget [ ] ,
243+ selectedIndex : number ,
244+ windowSize = 6 ,
245+ ) : { window : readonly CopyTarget [ ] ; start : number } {
246+ const start = Math . max (
247+ 0 ,
248+ Math . min ( selectedIndex - Math . floor ( windowSize / 2 ) , Math . max ( 0 , items . length - windowSize ) ) ,
249+ ) ;
250+ return { window : items . slice ( start , start + windowSize ) , start } ;
251+ }
252+
238253export function App ( {
239254 eventEmitter,
240255 agent,
@@ -1074,6 +1089,40 @@ export function App({
10741089 ) ;
10751090 }
10761091
1092+ // Work / Acceptance chrome: order flips by goal phase (implementing = Work on top).
1093+ const workBlock = hasActiveTasks ( state . tasks ) ? (
1094+ < Box flexDirection = "column" marginTop = { 1 } key = "work" >
1095+ < TaskView
1096+ tasks = { state . tasks }
1097+ compact = { ! workExpanded }
1098+ title = { goalActive ? "Work" : "Tasks" }
1099+ />
1100+ </ Box >
1101+ ) : null ;
1102+ const acceptBlock =
1103+ goalActive && goalSnapshot !== null ? (
1104+ < Box flexDirection = "column" marginTop = { 1 } key = "accept" >
1105+ < GoalView goal = { goalSnapshot } compact = { ! showAcceptance } />
1106+ </ Box >
1107+ ) : null ;
1108+ const workAcceptBlocks = workPrimary ? (
1109+ < >
1110+ { workBlock }
1111+ { acceptBlock }
1112+ </ >
1113+ ) : (
1114+ < >
1115+ { acceptBlock }
1116+ { workBlock }
1117+ </ >
1118+ ) ;
1119+
1120+ const copyModeSelection = copyModeIndex ?? 0 ;
1121+ const { window : copyModeWindow , start : copyModeWindowStart } = windowedCopyTargets (
1122+ copyTargetList ,
1123+ copyModeSelection ,
1124+ ) ;
1125+
10771126 return (
10781127 < Box flexDirection = "column" height = { rows } >
10791128 < Box flexShrink = { 0 } flexDirection = "column" >
@@ -1256,35 +1305,7 @@ export function App({
12561305 ) }
12571306 { ! taskFullScreenOpen && (
12581307 < Box flexShrink = { 0 } flexDirection = "column" >
1259- { ( ( ) => {
1260- const workBlock = hasActiveTasks ( state . tasks ) ? (
1261- < Box flexDirection = "column" marginTop = { 1 } key = "work" >
1262- < TaskView
1263- tasks = { state . tasks }
1264- compact = { ! workExpanded }
1265- title = { goalActive ? "Work" : "Tasks" }
1266- />
1267- </ Box >
1268- ) : null ;
1269- const acceptBlock =
1270- goalActive && goalSnapshot !== null ? (
1271- < Box flexDirection = "column" marginTop = { 1 } key = "accept" >
1272- < GoalView goal = { goalSnapshot } compact = { ! showAcceptance } />
1273- </ Box >
1274- ) : null ;
1275- // implementing: Work on top; planning/reviewing/completed: Acceptance on top
1276- return workPrimary ? (
1277- < >
1278- { workBlock }
1279- { acceptBlock }
1280- </ >
1281- ) : (
1282- < >
1283- { acceptBlock }
1284- { workBlock }
1285- </ >
1286- ) ;
1287- } ) ( ) }
1308+ { workAcceptBlocks }
12881309 { agentsStripVisible ? (
12891310 < Box flexDirection = "column" marginTop = { 1 } >
12901311 < AgentsStrip
@@ -1317,20 +1338,15 @@ export function App({
13171338 { copyModeOpen && (
13181339 < Box flexDirection = "column" marginTop = { 1 } borderStyle = "round" borderColor = { color ( "brand" ) } paddingX = { 1 } >
13191340 < Text color = { color ( "brand" ) } bold > Copy — ↑/↓ select · y/⏎ copy · a copy all · esc cancel</ Text >
1320- { ( ( ) => {
1321- const windowSize = 6 ;
1322- const sel = copyModeIndex ?? 0 ;
1323- const start = Math . max ( 0 , Math . min ( sel - Math . floor ( windowSize / 2 ) , Math . max ( 0 , copyTargetList . length - windowSize ) ) ) ;
1324- return copyTargetList . slice ( start , start + windowSize ) . map ( ( target , i ) => {
1325- const idx = start + i ;
1326- const selected = idx === sel ;
1327- return (
1328- < Text key = { target . id } color = { selected ? color ( "text" ) : color ( "muted" ) } dimColor = { ! selected } >
1329- { selected ? "› " : " " } { target . label } : { target . preview }
1330- </ Text >
1331- ) ;
1332- } ) ;
1333- } ) ( ) }
1341+ { copyModeWindow . map ( ( target , i ) => {
1342+ const idx = copyModeWindowStart + i ;
1343+ const selected = idx === copyModeSelection ;
1344+ return (
1345+ < Text key = { target . id } color = { selected ? color ( "text" ) : color ( "muted" ) } dimColor = { ! selected } >
1346+ { selected ? "› " : " " } { target . label } : { target . preview }
1347+ </ Text >
1348+ ) ;
1349+ } ) }
13341350 </ Box >
13351351 ) }
13361352 { exitConfirmOpen ? (
0 commit comments