import React from 'react'; export type PromptInputSubmitKey = 'enter' | 'mod-enter'; export interface PromptInputProps extends Omit, 'value' | 'defaultValue' | 'onChange' | 'onSubmit' | 'rows' | 'disabled' | 'children'> { /** * The accessible name of the text field. Required, and not a placeholder: * placeholder text disappears the moment the user types, and is not reliably * announced as a name. */ label: string; /** Controlled text. Pass `onChange` with it. */ value?: string; /** Uncontrolled starting text. */ defaultValue?: string; onChange?: (value: string) => void; /** * Fires with the text as typed. Uncontrolled, the field clears straight away; * if the returned promise rejects, the text is put back — a prompt lost to a * network error is the one thing a composer must never do. */ onSubmit?: (value: string) => void | Promise; /** * Which key sends. `enter` sends on Enter with Shift+Enter for a new line — * a chat. `mod-enter` sends on Cmd/Ctrl+Enter and leaves Enter for new lines — * a composer where messages are long and a stray Enter is expensive. */ submitKey?: PromptInputSubmitKey; /** * A run is in progress. The send control becomes an `AgentStop` in the same * place, and submitting is refused. The field stays editable, so the user can * draft the next message while the agent works. */ isRunning?: boolean; /** Called by the stop control while `isRunning`. */ onStop?: () => void; /** Passed to the stop control once the stop has been requested. */ isStopping?: boolean; isDisabled?: boolean; /** Rows the field starts at. */ minRows?: number; /** Rows the field grows to before it scrolls. */ maxRows?: number; /** * Controls at the start of the toolbar — attach, a model picker, a tool * toggle. Icon-only controls here need their own `aria-label`. */ actions?: React.ReactNode; /** Rendered above the text — attached files, a quoted message. */ attachments?: React.ReactNode; /** Accessible name of the send control. */ sendLabel?: string; /** The stop control's label while a run is in progress — AgentStop's `label`. */ stopLabel?: string; /** The stop control's label once pressed — AgentStop's `stoppingLabel`. */ stoppingLabel?: string; /** * How to send, read after the field's name — "Press Enter to send, Shift * and Enter for a new line." in English, or the ⌘/Ctrl+Enter version when * `submitKey` is `mod-enter`. Pass the translation for your `submitKey`. */ submitHint?: string; /** Class names for the outer box. */ className?: string; } /** * PromptInput — where a person writes to an agent. * * WHY IT IS NOT A TEXTAREA AND A BUTTON * * Every composer is assembled that way, and every one re-implements the same * four bugs: * * Enter during IME composition sends half a word. Japanese, Chinese and * Korean input confirm a candidate with Enter; a handler that does not check * `isComposing` sends the message mid-character. That excludes whole * languages from the product, silently, and nobody on an English keyboard * ever sees it. * * The prompt is lost when sending fails. Clearing on submit is right — * waiting for the server makes the composer feel broken — but clearing and * never restoring destroys what may have been a long message. Uncontrolled, * a rejected `onSubmit` promise puts the text back. * * The stop control lives somewhere else. While a run is going, the send * button's place is exactly where the user's pointer and attention already * are, so that is where `AgentStop` goes — the same control, the same * guarantees, not a second stop button with different ones. * * The keyboard contract is invisible. "Enter sends, Shift+Enter for a new * line" is announced through `aria-describedby`, because a screen-reader * user who presses Enter expecting a newline has just sent a message. * * WHAT IT DOES NOT DO * * It does not upload, pick models or render messages. `attachments` and * `actions` are slots, because what a product attaches and which tools it * offers are the product's decisions. */ export declare const PromptInput: React.ForwardRefExoticComponent>; //# sourceMappingURL=PromptInput.d.ts.map