Textual UI application for deepagents-cli.
URL for deepagents-cli documentation.
Tool names recognized as shell/command-execution tools.
Only 'execute' is registered by the SDK and CLI backends in practice.
'bash' and 'shell' are legacy names carried over and kept as
backwards-compatible aliases.
Copy selected text from app widgets to clipboard.
This queries all widgets for their text_selection and copies any selected text to the system clipboard.
Build a full LangSmith thread URL if tracing is configured.
Combines get_langsmith_project_name and fetch_langsmith_project_url
into a single convenience helper.
Create a chat model.
Uses init_chat_model for standard providers, or imports a custom
BaseChatModel subclass when the provider has a class_path in config.
Supports provider:model format (e.g., 'anthropic:claude-sonnet-4-5')
for explicit provider selection, or bare model names for auto-detection.
Auto-detect provider from model name.
Intentionally duplicates a subset of LangChain's
_attempt_infer_model_provider because we need to resolve the provider
before calling init_chat_model in order to:
init_chat_model.Check if a shell command is in the allow-list.
The allow-list matches against the first token of the command (the executable name). This allows read-only commands like ls, cat, grep, etc. to be auto-approved.
SECURITY: This function rejects commands containing dangerous shell patterns (command substitution, redirects, process substitution, etc.) BEFORE parsing, to prevent injection attacks that could bypass the allow-list.
Update the recently used model in config file.
Writes to [models].recent instead of [models].default, so that /model
switches do not overwrite the user's intentional default.
Execute a task with output directed to Textual UI.
This is the Textual-compatible version of execute_task() that uses the TextualUIAdapter for all UI operations.
Run the Textual application.
Character set mode for TUI display.
A model specification in provider:model format.
Adapter for rendering agent output to Textual widgets.
This adapter provides an abstraction layer between the agent execution and the Textual UI, allowing streaming output to be rendered as widgets.
Approval menu using standard Textual patterns.
Key design decisions (following mistral-vibe reference):
Chat input widget with prompt, multi-line text, autocomplete, and history.
Features:
Animated loading indicator with status text and elapsed time.
Displays:
In-memory message data for virtualization.
This dataclass holds all information needed to recreate a message widget. It is designed to be lightweight so that thousands of messages can be stored without meaningful memory overhead.
Manages message data and widget window for virtualization.
This class stores all messages as data and manages a sliding window of widgets that are actually mounted in the DOM.
Types of messages in the chat.
Status of a tool call.
Widget displaying an app message.
Widget displaying an assistant message with markdown support.
Uses MarkdownStream for smoother streaming instead of re-rendering the full content on each update.
Widget displaying an error message.
Widget displaying a queued (pending) user message in grey.
This is an ephemeral widget that gets removed when the message is dequeued.
Widget displaying a tool call with collapsible output.
Tool outputs are shown as a 3-line preview by default. Press Ctrl+E to expand/collapse the full output. Shows an animated "Running..." indicator while the tool is executing.
Widget displaying a user message.
Full-screen modal for model selection.
Displays available models grouped by provider with keyboard navigation and search filtering. Current model is highlighted.
Returns (model_spec, provider) tuple on selection, or None on cancel.
Status bar showing mode, auto-approve status, and working directory.
Modal dialog for browsing and resuming threads.
Displays recent threads with keyboard navigation. The current thread is pre-selected and visually marked.
Returns a thread_id string on selection, or None on cancel.
Welcome banner displayed at startup.
Represents a queued user message awaiting processing.
Token tracker that updates the status bar.
Session state for the Textual app.
Main Textual application for deepagents-cli.
Result from running the Textual application.