/**
* PromptInput is the message composer: Enter sends (Shift+Enter for a new
* line); while a turn runs the send button becomes a stop button, matching
* the behaviour of Zed's agent panel.
*
* @example
* <PromptInput turnActive={false} onSend={(t) => console.log(t)} onCancel={() => {}} />
*/import{useState}from"react";interfacePromptInputProps{turnActive: boolean;onSend:(text: string)=>void;onCancel:()=>void;}exportfunctionPromptInput({turnActive,onSend,onCancel,}:PromptInputProps){const[text,setText]=useState("");constsubmit=()=>{consttrimmed=text.trim();if(trimmed===""||turnActive){return;}onSend(trimmed);setText("");};return(<formclassName="composer"onSubmit={(event)=>{event.preventDefault();submit();}}><textareaclassName="composer-input"placeholder="Message the agent…"aria-label="prompt"value={text}rows={3}onChange={(event)=>setText(event.target.value)}onKeyDown={(event)=>{if(event.key==="Enter"&&!event.shiftKey){event.preventDefault();submit();}}}/>{turnActive?(<buttontype="button"className="composer-stop"onClick={onCancel}>Stop</button>):(<buttontype="submit"className="composer-send"disabled={text.trim()===""}>Send</button>)}</form>);}
One first-party cookie so a repeat visit isn't counted twice. No cross-site tracking, nothing stored until you accept. Cookie Policy.