@@ -8,6 +8,7 @@ import { useShallow } from 'zustand/react/shallow'
88
99import { routeUserPrompt } from './commands/router'
1010import { AgentModeToggle } from './components/agent-mode-toggle'
11+ import { BuildModeButtons } from './components/build-mode-buttons'
1112import { LoginModal } from './components/login-modal'
1213import {
1314 MultilineInput ,
@@ -302,7 +303,10 @@ export const App = ({
302303 isChainInProgress,
303304 setIsChainInProgress,
304305 agentMode,
306+ setAgentMode,
305307 toggleAgentMode,
308+ hasReceivedPlanResponse,
309+ setHasReceivedPlanResponse,
306310 resetChatStore,
307311 } = useChatStore (
308312 useShallow ( ( store ) => ( {
@@ -327,7 +331,10 @@ export const App = ({
327331 isChainInProgress : store . isChainInProgress ,
328332 setIsChainInProgress : store . setIsChainInProgress ,
329333 agentMode : store . agentMode ,
334+ setAgentMode : store . setAgentMode ,
330335 toggleAgentMode : store . toggleAgentMode ,
336+ hasReceivedPlanResponse : store . hasReceivedPlanResponse ,
337+ setHasReceivedPlanResponse : store . setHasReceivedPlanResponse ,
331338 resetChatStore : store . reset ,
332339 } ) ) ,
333340 )
@@ -555,7 +562,7 @@ export const App = ({
555562
556563 const hasModifier = Boolean ( key . ctrl || key . meta || key . alt || key . option )
557564
558- function selectCurrent ( ) {
565+ function selectCurrent ( ) : boolean {
559566 const selected = slashMatches [ slashSelectedIndex ] ?? slashMatches [ 0 ]
560567 if ( ! selected ) {
561568 return
@@ -574,6 +581,7 @@ export const App = ({
574581 helpers . setValue ( newValue )
575582 helpers . setCursorPosition ( before . length + replacement . length )
576583 setSlashSelectedIndex ( 0 )
584+ return true
577585 }
578586
579587 if ( key . name === 'down' && ! hasModifier ) {
@@ -640,7 +648,7 @@ export const App = ({
640648
641649 const hasModifier = Boolean ( key . ctrl || key . meta || key . alt || key . option )
642650
643- function selectCurrent ( ) {
651+ function selectCurrent ( ) : boolean {
644652 const selected = agentMatches [ agentSelectedIndex ] ?? agentMatches [ 0 ]
645653 if ( ! selected ) {
646654 return
@@ -660,6 +668,7 @@ export const App = ({
660668 helpers . setValue ( newValue )
661669 helpers . setCursorPosition ( before . length + replacement . length )
662670 setAgentSelectedIndex ( 0 )
671+ return true
663672 }
664673
665674 if ( key . name === 'down' && ! hasModifier ) {
@@ -806,6 +815,7 @@ export const App = ({
806815 scrollToLatest,
807816 availableWidth : separatorWidth ,
808817 onTimerEvent : handleTimerEvent ,
818+ setHasReceivedPlanResponse,
809819 } )
810820
811821 sendMessageRef . current = sendMessage
@@ -872,6 +882,28 @@ export const App = ({
872882 ] ,
873883 )
874884
885+ const handleBuildFast = useCallback ( ( ) => {
886+ setAgentMode ( 'FAST' )
887+ setInputValue ( 'Build it!' )
888+ setTimeout ( ( ) => {
889+ if ( sendMessageRef . current ) {
890+ sendMessageRef . current ( { content : 'Build it!' , agentMode : 'FAST' } )
891+ }
892+ setInputValue ( '' )
893+ } , 0 )
894+ } , [ setAgentMode , setInputValue ] )
895+
896+ const handleBuildMax = useCallback ( ( ) => {
897+ setAgentMode ( 'MAX' )
898+ setInputValue ( 'Build it!' )
899+ setTimeout ( ( ) => {
900+ if ( sendMessageRef . current ) {
901+ sendMessageRef . current ( { content : 'Build it!' , agentMode : 'MAX' } )
902+ }
903+ setInputValue ( '' )
904+ } , 0 )
905+ } , [ setAgentMode , setInputValue ] )
906+
875907 useKeyboardHandlers ( {
876908 isStreaming,
877909 isWaitingForResponse,
@@ -1154,6 +1186,13 @@ export const App = ({
11541186 </ box >
11551187 ) }
11561188 < Separator theme = { theme } width = { separatorWidth } />
1189+ { agentMode === 'PLAN' && hasReceivedPlanResponse && (
1190+ < BuildModeButtons
1191+ theme = { theme }
1192+ onBuildFast = { handleBuildFast }
1193+ onBuildMax = { handleBuildMax }
1194+ />
1195+ ) }
11571196 { slashContext . active && slashSuggestionItems . length > 0 ? (
11581197 < SuggestionMenu
11591198 items = { slashSuggestionItems }
0 commit comments