@@ -974,68 +974,57 @@ your final message like this:
974974 log ( "" ) ;
975975 }
976976
977- // 11. Multi-pass loop
978- const maxPasses = dirty . length + 5 ;
979- while ( ! aborted ) {
980- if ( autopilot ) {
981- if ( passNumber >= maxPasses ) {
982- log ( chalk . dim ( ` Autopilot: reached max passes (${ maxPasses } ), stopping.\n` ) ) ;
983- break ;
984- }
985- } else if ( process . stdin . isTTY ) {
977+ // 11. Multi-pass loop (interactive mode only — autopilot is handled by the SDK)
978+ if ( ! autopilot ) {
979+ while ( ! aborted && process . stdin . isTTY ) {
986980 const wantMore = await confirmPass ( ) ;
987981 if ( ! wantMore ) break ;
988- } else {
989- break ;
990- }
991982
992- passNumber ++ ;
993- currentPhase = "Starting" ;
994- metrics . errors = [ ] ;
995-
996- const passLabel = autopilot ? `Pass ${ passNumber } /${ maxPasses } ` : `Pass ${ passNumber } ` ;
997- log ( `\n${ chalk . cyan ( "●" ) } ${ passLabel } — sending improvement prompt...\n` ) ;
998-
999- await session . send ( {
1000- prompt : [
1001- "Do another pass over the compilation output." ,
1002- "Re-read the original spec files and the compile prompt at " +
1003- `\`${ relative ( SPECS_DIR , promptPath ) } \` to check what you may have missed.` ,
1004- "" ,
1005- "Remember: DEPTH OVER BREADTH. A few components working perfectly" ,
1006- "(with interactive demo) is better than many half-working ones." ,
1007- "" ,
1008- "Focus on:" ,
1009- "- The interactive demo (`--interactive`) — it MUST work as a full-screen playground" ,
1010- "- Components already implemented: polish, fix bugs, ensure full interactivity" ,
1011- "- Tests that are failing or missing" ,
1012- "- Add the NEXT component (fully: implementation + tests + demo wiring)" ,
1013- "- Token usage correctness" ,
1014- "After fixing, run the tests and verify `--interactive` works, then report results." ,
1015- ] . join ( "\n" ) ,
1016- } ) ;
983+ passNumber ++ ;
984+ currentPhase = "Starting" ;
985+ metrics . errors = [ ] ;
986+
987+ log ( `\n${ chalk . cyan ( "●" ) } Pass ${ passNumber } — sending improvement prompt...\n` ) ;
988+
989+ await session . send ( {
990+ prompt : [
991+ "Do another pass over the compilation output." ,
992+ "Re-read the original spec files and the compile prompt at " +
993+ `\`${ relative ( SPECS_DIR , promptPath ) } \` to check what you may have missed.` ,
994+ "" ,
995+ "Remember: DEPTH OVER BREADTH. A few components working perfectly" ,
996+ "(with interactive demo) is better than many half-working ones." ,
997+ "" ,
998+ "Focus on:" ,
999+ "- The interactive demo (`--interactive`) — it MUST work as a full-screen playground" ,
1000+ "- Components already implemented: polish, fix bugs, ensure full interactivity" ,
1001+ "- Tests that are failing or missing" ,
1002+ "- Add the NEXT component (fully: implementation + tests + demo wiring)" ,
1003+ "- Token usage correctness" ,
1004+ "After fixing, run the tests and verify `--interactive` works, then report results." ,
1005+ ] . join ( "\n" ) ,
1006+ } ) ;
10171007
1018- await waitForIdle ( ) ;
1008+ await waitForIdle ( ) ;
10191009
1020- // Complete final phase
1021- if ( ! verbose && currentPhase !== "Starting" ) {
1022- log ( ` ${ chalk . green ( "✓" ) } ${ currentPhase } ` ) ;
1023- }
1010+ if ( ! verbose && currentPhase !== "Starting" ) {
1011+ log ( ` ${ chalk . green ( "✓" ) } ${ currentPhase } ` ) ;
1012+ }
10241013
1025- // Show the agent's last message as a pass recap
1026- if ( metrics . lastAssistantMessage ) {
1027- const rendered = marked ( metrics . lastAssistantMessage . trim ( ) ) as string ;
1028- log ( `\n${ boxen ( rendered . trimEnd ( ) , { padding : 1 , dimBorder : true , title : "Agent summary" , titleAlignment : "left" } ) } ` ) ;
1029- }
1014+ if ( metrics . lastAssistantMessage ) {
1015+ const rendered = marked ( metrics . lastAssistantMessage . trim ( ) ) as string ;
1016+ log ( `\n${ boxen ( rendered . trimEnd ( ) , { padding : 1 , dimBorder : true , title : "Agent summary" , titleAlignment : "left" } ) } ` ) ;
1017+ }
10301018
1031- printSummary ( target , config , metrics , outDir , noLock , passNumber ) ;
1019+ printSummary ( target , config , metrics , outDir , noLock , passNumber ) ;
10321020
1033- if ( metrics . errors . length > 0 ) {
1034- log ( chalk . yellow ( "⚠ Pass completed with errors:" ) ) ;
1035- for ( const err of metrics . errors ) {
1036- log ( ` ${ chalk . red ( "•" ) } ${ err } ` ) ;
1021+ if ( metrics . errors . length > 0 ) {
1022+ log ( chalk . yellow ( "⚠ Pass completed with errors:" ) ) ;
1023+ for ( const err of metrics . errors ) {
1024+ log ( ` ${ chalk . red ( "•" ) } ${ err } ` ) ;
1025+ }
1026+ log ( "" ) ;
10371027 }
1038- log ( "" ) ;
10391028 }
10401029 }
10411030
0 commit comments