@@ -220,6 +220,21 @@ export type AppProps = {
220220 onFirstUserMessage ?: ( ) => void ;
221221} ;
222222
223+ // Center a selection in a fixed-height window over a copy-target list.
224+ // Returns the visible slice and the absolute index of its first item so
225+ // the caller can mark the selected row without re-scanning the full list.
226+ function windowedCopyTargets (
227+ items : readonly CopyTarget [ ] ,
228+ selectedIndex : number ,
229+ windowSize = 6 ,
230+ ) : { window : readonly CopyTarget [ ] ; start : number } {
231+ const start = Math . max (
232+ 0 ,
233+ Math . min ( selectedIndex - Math . floor ( windowSize / 2 ) , Math . max ( 0 , items . length - windowSize ) ) ,
234+ ) ;
235+ return { window : items . slice ( start , start + windowSize ) , start } ;
236+ }
237+
223238export function App ( {
224239 eventEmitter,
225240 agent,
@@ -1037,6 +1052,40 @@ export function App({
10371052 ) ;
10381053 }
10391054
1055+ // Work / Acceptance chrome: order flips by goal phase (implementing = Work on top).
1056+ const workBlock = hasActiveTasks ( state . tasks ) ? (
1057+ < Box flexDirection = "column" marginTop = { 1 } key = "work" >
1058+ < TaskView
1059+ tasks = { state . tasks }
1060+ compact = { ! workExpanded }
1061+ title = { goalActive ? "Work" : "Tasks" }
1062+ />
1063+ </ Box >
1064+ ) : null ;
1065+ const acceptBlock =
1066+ goalActive && goalSnapshot !== null ? (
1067+ < Box flexDirection = "column" marginTop = { 1 } key = "accept" >
1068+ < GoalView goal = { goalSnapshot } compact = { ! showAcceptance } />
1069+ </ Box >
1070+ ) : null ;
1071+ const workAcceptBlocks = workPrimary ? (
1072+ < >
1073+ { workBlock }
1074+ { acceptBlock }
1075+ </ >
1076+ ) : (
1077+ < >
1078+ { acceptBlock }
1079+ { workBlock }
1080+ </ >
1081+ ) ;
1082+
1083+ const copyModeSelection = copyModeIndex ?? 0 ;
1084+ const { window : copyModeWindow , start : copyModeWindowStart } = windowedCopyTargets (
1085+ copyTargetList ,
1086+ copyModeSelection ,
1087+ ) ;
1088+
10401089 return (
10411090 < Box flexDirection = "column" height = { rows } >
10421091 < Box flexShrink = { 0 } flexDirection = "column" >
@@ -1209,35 +1258,7 @@ export function App({
12091258 ) }
12101259 { ! taskFullScreenOpen && (
12111260 < Box flexShrink = { 0 } flexDirection = "column" >
1212- { ( ( ) => {
1213- const workBlock = hasActiveTasks ( state . tasks ) ? (
1214- < Box flexDirection = "column" marginTop = { 1 } key = "work" >
1215- < TaskView
1216- tasks = { state . tasks }
1217- compact = { ! workExpanded }
1218- title = { goalActive ? "Work" : "Tasks" }
1219- />
1220- </ Box >
1221- ) : null ;
1222- const acceptBlock =
1223- goalActive && goalSnapshot !== null ? (
1224- < Box flexDirection = "column" marginTop = { 1 } key = "accept" >
1225- < GoalView goal = { goalSnapshot } compact = { ! showAcceptance } />
1226- </ Box >
1227- ) : null ;
1228- // implementing: Work on top; planning/reviewing/completed: Acceptance on top
1229- return workPrimary ? (
1230- < >
1231- { workBlock }
1232- { acceptBlock }
1233- </ >
1234- ) : (
1235- < >
1236- { acceptBlock }
1237- { workBlock }
1238- </ >
1239- ) ;
1240- } ) ( ) }
1261+ { workAcceptBlocks }
12411262 { agentsStripVisible ? (
12421263 < Box flexDirection = "column" marginTop = { 1 } >
12431264 < AgentsStrip
@@ -1270,20 +1291,15 @@ export function App({
12701291 { copyModeOpen && (
12711292 < Box flexDirection = "column" marginTop = { 1 } borderStyle = "round" borderColor = { color ( "brand" ) } paddingX = { 1 } >
12721293 < Text color = { color ( "brand" ) } bold > Copy — ↑/↓ select · y/⏎ copy · a copy all · esc cancel</ Text >
1273- { ( ( ) => {
1274- const windowSize = 6 ;
1275- const sel = copyModeIndex ?? 0 ;
1276- const start = Math . max ( 0 , Math . min ( sel - Math . floor ( windowSize / 2 ) , Math . max ( 0 , copyTargetList . length - windowSize ) ) ) ;
1277- return copyTargetList . slice ( start , start + windowSize ) . map ( ( target , i ) => {
1278- const idx = start + i ;
1279- const selected = idx === sel ;
1280- return (
1281- < Text key = { target . id } color = { selected ? color ( "text" ) : color ( "muted" ) } dimColor = { ! selected } >
1282- { selected ? "› " : " " } { target . label } : { target . preview }
1283- </ Text >
1284- ) ;
1285- } ) ;
1286- } ) ( ) }
1294+ { copyModeWindow . map ( ( target , i ) => {
1295+ const idx = copyModeWindowStart + i ;
1296+ const selected = idx === copyModeSelection ;
1297+ return (
1298+ < Text key = { target . id } color = { selected ? color ( "text" ) : color ( "muted" ) } dimColor = { ! selected } >
1299+ { selected ? "› " : " " } { target . label } : { target . preview }
1300+ </ Text >
1301+ ) ;
1302+ } ) }
12871303 </ Box >
12881304 ) }
12891305 { exitConfirmOpen ? (
0 commit comments