Chat input widget with prompt, multi-line text, autocomplete, and history.
Features:
config.newline_shortcut)ChatInput(
self,
cwd: str | Path | None = None,
history_file: Path | None = None,
image_tracker: MediaTracker | None = None,
**kwargs: Any = {}
)Vertical| Name | Type | Description |
|---|---|---|
cwd | str | Path | None | Default: NoneCurrent working directory for file completion |
history_file | Path | None | Default: NonePath to history file (default: ~/.deepagents/history.jsonl) |
image_tracker | MediaTracker | None | Default: NoneOptional tracker for attached images |
**kwargs | Any | Default: {}Additional arguments for parent |
| Name | Type |
|---|---|
| cwd | str | Path | None |
| history_file | Path | None |
| image_tracker | MediaTracker | None |
Compose the chat input layout.
Initialize components after mount.
Update the slash command controller's command list.
Called by the app after discovering skills to merge static
commands with dynamic /skill: entries.
Detect input mode and update completions.
Relay typing activity to the app as ChatInput.Typing.
Handle text submission.
Always posts the Submitted event - the app layer decides whether to process immediately or queue based on agent status.
Handle history previous request.
Handle history next request.
Handle paste payloads that resolve to dropped file paths.
Handle paste text from app-level routing when input is not focused.
When the text area is mounted, the paste is always consumed: file paths are attached as images, and plain text is inserted directly.
Handle key events for completion navigation.
Post mode changed message and update prompt indicator.
The prompt glyph update is deferred via call_after_refresh so that
callers which also schedule deferred work (e.g. the completion popup)
can coalesce both visual changes into a single refresh.
Focus the input field.
Enable or disable the input widget.
Toggle input focus state (e.g., unfocus while agent is working).
Exit the current input mode (command/shell) back to normal.
Dismiss completion: clear view and reset controller state.
Render completion suggestions in the popup.
Clear/hide the completion popup.
Handle click on a completion option.
Replace text in the input field.
Message sent when input is submitted.
Message sent when input mode changes.
Posted when the user presses a printable key or backspace in the input.
The app uses this to delay approval widgets while the user is actively
typing, preventing accidental key presses (e.g. y, n) from
triggering approval decisions.