@@ -35,6 +35,7 @@ import { InputToolbar } from '@/app/workspace/[workspaceId]/home/components/user
3535import type { ModelSelectorOptions } from '@/app/workspace/[workspaceId]/home/components/user-input/components/model-selector'
3636import { usePromptHistory } from '@/app/workspace/[workspaceId]/home/components/user-input/hooks/use-prompt-history'
3737import { handleMothershipAddContextEvent } from '@/app/workspace/[workspaceId]/home/components/user-input/mothership-context-event'
38+ import { useChatPlanGate } from '@/app/workspace/[workspaceId]/home/hooks/use-chat-plan-gate'
3839import type {
3940 ChatMessage ,
4041 FileAttachmentForApi ,
@@ -507,6 +508,9 @@ const UserInputImpl = forwardRef<UserInputHandle, UserInputProps>(function UserI
507508 textareaRef . current ?. focus ( )
508509 }
509510
511+ /** Refuses a send the workspace plan excludes here, before `onSubmit`, so the draft survives. */
512+ const stopSendWithoutChatPlan = useChatPlanGate ( )
513+
510514 /** Empties the text, chips, attachments, transcript, and the saved draft in one step. */
511515 const clearComposer = useCallback ( ( ) => {
512516 history . reset ( )
@@ -527,6 +531,7 @@ const UserInputImpl = forwardRef<UserInputHandle, UserInputProps>(function UserI
527531 } , [ resetTranscript , history . reset ] )
528532
529533 const handleSubmit = useCallback ( ( ) => {
534+ if ( stopSendWithoutChatPlan ( ) ) return
530535 const currentFiles = filesRef . current
531536 const currentEditor = editorRef . current
532537
@@ -552,7 +557,7 @@ const UserInputImpl = forwardRef<UserInputHandle, UserInputProps>(function UserI
552557 )
553558 if ( accepted === false ) return
554559 clearComposer ( )
555- } , [ onSubmit , clearComposer ] )
560+ } , [ stopSendWithoutChatPlan , onSubmit , clearComposer ] )
556561
557562 /**
558563 * Enter policy for the editor: mirror canSubmit's uploading guard (Enter
0 commit comments