agent-terminal-ui 0.1.35__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. agent_terminal_ui-0.1.35/PKG-INFO +187 -0
  2. agent_terminal_ui-0.1.35/README.md +162 -0
  3. agent_terminal_ui-0.1.35/agent_terminal_ui/__init__.py +6 -0
  4. agent_terminal_ui-0.1.35/agent_terminal_ui/app.py +1115 -0
  5. agent_terminal_ui-0.1.35/agent_terminal_ui/client.py +877 -0
  6. agent_terminal_ui-0.1.35/agent_terminal_ui/commands.py +1776 -0
  7. agent_terminal_ui-0.1.35/agent_terminal_ui/py.typed +0 -0
  8. agent_terminal_ui-0.1.35/agent_terminal_ui/terminal_ui.py +17 -0
  9. agent_terminal_ui-0.1.35/agent_terminal_ui/tui/__init__.py +6 -0
  10. agent_terminal_ui-0.1.35/agent_terminal_ui/tui/agent_timer.py +80 -0
  11. agent_terminal_ui-0.1.35/agent_terminal_ui/tui/css.py +300 -0
  12. agent_terminal_ui-0.1.35/agent_terminal_ui/tui/exit_confirm_screen.py +172 -0
  13. agent_terminal_ui-0.1.35/agent_terminal_ui/tui/formatters.py +163 -0
  14. agent_terminal_ui-0.1.35/agent_terminal_ui/tui/history_screen.py +101 -0
  15. agent_terminal_ui-0.1.35/agent_terminal_ui/tui/input_text_area.py +692 -0
  16. agent_terminal_ui-0.1.35/agent_terminal_ui/tui/mcp_screen.py +102 -0
  17. agent_terminal_ui-0.1.35/agent_terminal_ui/tui/status_line.py +117 -0
  18. agent_terminal_ui-0.1.35/agent_terminal_ui/tui/theme.py +361 -0
  19. agent_terminal_ui-0.1.35/agent_terminal_ui/tui/tool_approval_screen.py +273 -0
  20. agent_terminal_ui-0.1.35/agent_terminal_ui/tui/tool_display/__init__.py +7 -0
  21. agent_terminal_ui-0.1.35/agent_terminal_ui/tui/tool_display/_formatters.py +243 -0
  22. agent_terminal_ui-0.1.35/agent_terminal_ui/tui/tool_display/_registry.py +50 -0
  23. agent_terminal_ui-0.1.35/agent_terminal_ui/tui/tool_display/_widget.py +111 -0
  24. agent_terminal_ui-0.1.35/agent_terminal_ui/widgets/workflow.py +165 -0
  25. agent_terminal_ui-0.1.35/agent_terminal_ui.egg-info/PKG-INFO +187 -0
  26. agent_terminal_ui-0.1.35/agent_terminal_ui.egg-info/SOURCES.txt +51 -0
  27. agent_terminal_ui-0.1.35/agent_terminal_ui.egg-info/dependency_links.txt +1 -0
  28. agent_terminal_ui-0.1.35/agent_terminal_ui.egg-info/entry_points.txt +2 -0
  29. agent_terminal_ui-0.1.35/agent_terminal_ui.egg-info/requires.txt +12 -0
  30. agent_terminal_ui-0.1.35/agent_terminal_ui.egg-info/top_level.txt +4 -0
  31. agent_terminal_ui-0.1.35/pyproject.toml +59 -0
  32. agent_terminal_ui-0.1.35/scripts/img2ansi.py +37 -0
  33. agent_terminal_ui-0.1.35/scripts/inject_logo.py +28 -0
  34. agent_terminal_ui-0.1.35/scripts/verify_tui_acp.py +60 -0
  35. agent_terminal_ui-0.1.35/setup.cfg +4 -0
  36. agent_terminal_ui-0.1.35/tests/__init__.py +0 -0
  37. agent_terminal_ui-0.1.35/tests/test_app_handlers.py +224 -0
  38. agent_terminal_ui-0.1.35/tests/test_app_workers.py +283 -0
  39. agent_terminal_ui-0.1.35/tests/test_basic.py +15 -0
  40. agent_terminal_ui-0.1.35/tests/test_client.py +49 -0
  41. agent_terminal_ui-0.1.35/tests/test_client_methods.py +408 -0
  42. agent_terminal_ui-0.1.35/tests/test_commands.py +735 -0
  43. agent_terminal_ui-0.1.35/tests/test_enhanced_features.py +710 -0
  44. agent_terminal_ui-0.1.35/tests/test_impact_codemap_resources.py +453 -0
  45. agent_terminal_ui-0.1.35/tests/test_input_text_area_overlays.py +273 -0
  46. agent_terminal_ui-0.1.35/tests/test_model_command.py +197 -0
  47. agent_terminal_ui-0.1.35/tests/test_parity_commands.py +565 -0
  48. agent_terminal_ui-0.1.35/tests/test_parity_contract.py +264 -0
  49. agent_terminal_ui-0.1.35/tests/test_screens_and_overlays.py +555 -0
  50. agent_terminal_ui-0.1.35/tests/test_subcommand_dispatch.py +369 -0
  51. agent_terminal_ui-0.1.35/tests/test_tui.py +34 -0
  52. agent_terminal_ui-0.1.35/tests/test_tui_components.py +1050 -0
  53. agent_terminal_ui-0.1.35/tests/text_universal_skills.py +608 -0
@@ -0,0 +1,187 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-terminal-ui
3
+ Version: 0.1.35
4
+ Summary: Terminal UI for Agentic AI!
5
+ Author-email: Audel Rouhi <knucklessg1@gmail.com>
6
+ License: MIT
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Environment :: Console
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: <3.14,>=3.11
13
+ Description-Content-Type: text/markdown
14
+ Requires-Dist: agent-utilities<0.3.0,>=0.2.40
15
+ Requires-Dist: textual<9.0.0,>=8.2.0
16
+ Requires-Dist: rich<16.0.0,>=15.0.0
17
+ Requires-Dist: agent-client-protocol<1.0.0,>=0.9.0
18
+ Requires-Dist: httpx<1.0.0,>=0.28.1
19
+ Requires-Dist: pyyaml<7.0.0,>=6.0.3
20
+ Provides-Extra: test
21
+ Requires-Dist: pytest<10.0.0,>=9.0.0; extra == "test"
22
+ Requires-Dist: pytest-asyncio<2.0.0,>=1.3.0; extra == "test"
23
+ Requires-Dist: pytest-env; extra == "test"
24
+ Requires-Dist: pytest-cov<8.0.0,>=7.0.0; extra == "test"
25
+
26
+ <h1 align="center">
27
+ agent-terminal-ui
28
+ </h1>
29
+ <p align="center">
30
+ <p align="center">Terminal user interface for AI agents built on <a href="https://github.com/pydantic/agent-utilities">agent-utilities</a>.</p>
31
+ </p>
32
+ <p align="center">
33
+ <a href="https://github.com/astral-sh/uv"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json" alt="uv"></a>
34
+ <a href="https://github.com/astral-sh/ty"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ty/main/assets/badge/v0.json" alt="ty"></a>
35
+ <a href="https://pypi.org/project/agent-terminal-ui/"><img src="https://img.shields.io/pypi/v/agent-terminal-ui" alt="PyPI"></a>
36
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
37
+ </p>
38
+
39
+ A [Textual](https://textual.textualize.io/)-based terminal interface for interacting with AI agents. Connects to an [agent-utilities](https://github.com/pydantic/agent-utilities) backend via dual protocol support: AG-UI (SSE streaming) and ACP (JSON-RPC + SSE).
40
+
41
+ > [!NOTE]
42
+ > This library is in early development and subject to change.
43
+
44
+ ### Features
45
+
46
+ #### Core Functionality
47
+ - **Dual protocol support** -- AG-UI (SSE streaming, default) and ACP (JSON-RPC + SSE, opt-in)
48
+ - **Dynamic workflow sidebar** -- discovers graph nodes from sideband events at runtime; nodes are never hardcoded
49
+ - **Phase labels** -- Planning, Discovery, Execution, Validation
50
+ - **Completed node markers** -- checkmarks on finished specialists
51
+ - **Rich tool execution display** -- extensible formatter system for rendering tool calls and results
52
+ - **Human-in-the-loop tool approval** -- modal for confirming sensitive tool calls before execution
53
+ - **Multi-modal image attachment** -- attach images to messages for visual reasoning
54
+ - **Session management and chat history** -- browse and resume previous conversations
55
+ - **MCP server browser** -- inspect connected MCP servers and their tools
56
+
57
+ #### User Experience
58
+ - **Message queuing** -- queue messages while agent is processing; related queries are intelligently combined using regex patterns for conjunctions, sequential actions, and similar structure
59
+ - **Exit confirmation** -- modal dialog prevents accidental termination via Ctrl+C or `/exit`
60
+ - **Terminal transparency** -- UI respects your terminal's transparency settings for seamless integration
61
+ - **Theme system** -- multiple built-in themes (modern_dark, modern_light, nord, gruvbox) with proper color semantics
62
+
63
+ #### Commands
64
+ - **Slash commands** -- comprehensive command set for common operations:
65
+ - `/help` -- show available commands
66
+ - `/clear` -- clear the current event log
67
+ - `/mcp` -- browse connected MCP servers and their tools
68
+ - `/history` -- browse and select from historical chat sessions
69
+ - `/image` -- attach images to messages
70
+ - `/init` -- initialize a new project or workspace
71
+ - `/review` -- review code and suggest improvements
72
+ - `/test` -- run tests on the current codebase
73
+ - `/search` -- search through code and documentation
74
+ - `/stats` -- show statistics about the current session
75
+ - `/cost` -- show token and cost tracking information
76
+ - `/queue` -- show current message queue status
77
+ - `/queue:clear` -- clear all queued messages
78
+ - `/queue:toggle` -- enable/disable message queuing
79
+ - `/model` -- switch between available AI models
80
+ - `/theme` -- switch between available themes
81
+ - `/compact` -- compact conversation context to save tokens
82
+ - `/diff` -- show interactive diff viewer for recent changes
83
+ - `/recap` -- summarize the session context
84
+ - `/fast` -- toggle fast mode (Haiku/Flash models)
85
+ - `/memory` -- manage project memory (AGENTS.md)
86
+ - `/agents` -- list available specialized agents
87
+ - `/add-dir` -- add a directory to the agent's working context
88
+ - `/exit`, `/quit` -- exit the application with confirmation
89
+
90
+ #### Input Prefixes
91
+ - **`!`** -- Direct Bash execution (e.g., `!ls -la`)
92
+ - **`@`** -- Fuzzy file mention autocomplete (e.g., `@app.py`)
93
+
94
+ #### Backend Integration
95
+ - **Unified specialist visibility** -- MCP agents and A2A peers appear identically in the workflow sidebar; both emit the same sideband events via the backend's `discover_all_specialists()` unified roster
96
+ - **Tool-count telemetry** -- `tools-bound` sideband events include `toolset_count`, `dev_tools`, and `mcp_tools` breakdowns for per-specialist visibility
97
+ - **Real-time token and cost tracking** -- integrated in the status line for session monitoring
98
+ - **Memory Auto-loading** -- backend automatically includes `AGENTS.md` and `MEMORY.md` in the system prompt for project-aware reasoning.
99
+
100
+
101
+ ## Usage
102
+
103
+ Start the `agent-utilities` backend server, then launch the TUI:
104
+
105
+ ```bash
106
+ agent-tui
107
+ ```
108
+
109
+ Or run with `uv` if installed locally:
110
+
111
+ ```bash
112
+ uv run agent-tui
113
+ ```
114
+
115
+ ### Keyboard Shortcuts
116
+
117
+ - **Ctrl+C** -- Interrupt generation or cancel current operation
118
+ - **Ctrl+D** -- Exit session (with confirmation)
119
+ - **Ctrl+L** -- Clear the event log
120
+ - **Ctrl+O** -- Toggle workflow sidebar
121
+ - **Ctrl+T** -- Toggle task list view
122
+ - **Ctrl+U** -- Clear input buffer
123
+ - **Ctrl+Y** -- Restore cleared input buffer
124
+ - **Alt+P** -- Switch AI model
125
+ - **Alt+T** -- Toggle Extended Thinking (for reasoning models)
126
+ - **Alt+O** -- Toggle Fast Mode
127
+ - **Ctrl+R** -- Reverse history search
128
+ - **Ctrl+H** -- Show help overlay
129
+ - **Tab** -- Navigate between focusable elements
130
+ - **Esc Esc** -- Rewind/Undo (experimental)
131
+
132
+ ### Message Queuing
133
+
134
+ When the agent is processing, your input is automatically queued. The system intelligently combines related queries using patterns like:
135
+
136
+ - **Conjunctions**: "and", "also", "plus", "then", "after that"
137
+ - **Sequential actions**: semicolon-separated commands
138
+ - **Similar structure**: same action verbs (fix, add, remove, update, create, delete, implement, refactor)
139
+
140
+ Example: If you type "fix the bug in app.py" followed by "and add a test for it", these will be combined into a single query.
141
+
142
+ ### Environment Variables
143
+
144
+ | Variable | Default | Purpose |
145
+ |----------|---------|---------|
146
+ | `AGENT_URL` | `http://localhost:8000` | Agent server URL |
147
+ | `ENABLE_ACP` | `false` | Enable ACP protocol instead of AG-UI |
148
+ | `ACP_URL` | `http://localhost:8001` | ACP server URL (when ACP is enabled) |
149
+
150
+ ### Themes
151
+
152
+ The TUI supports multiple themes that respect terminal transparency:
153
+
154
+ - **modern_dark** (default) -- Dark theme with blue accents
155
+ - **modern_light** -- Light theme with proper contrast
156
+ - **nord** -- Nord color palette with frosty aesthetics
157
+ - **gruvbox** -- Gruvbox retro color scheme
158
+
159
+ Switch themes using `/theme <name>` command.
160
+
161
+
162
+ ## Development
163
+
164
+ ### Prerequisites
165
+
166
+ - [uv](https://docs.astral.sh/uv/getting-started/installation/)
167
+ - [prek](https://github.com/j178/prek/blob/master/README.md#installation)
168
+
169
+ ### Setup
170
+
171
+ Create uv virtual environment and install dependencies:
172
+
173
+ ```bash
174
+ uv sync --frozen --all-groups
175
+ ```
176
+
177
+ To update dependencies (updates the lock file):
178
+
179
+ ```bash
180
+ uv sync --all-groups
181
+ ```
182
+
183
+ Run formatting, linting, and type checking:
184
+
185
+ ```bash
186
+ uv run ruff format && uv run ruff check --fix && uv run ty check
187
+ ```
@@ -0,0 +1,162 @@
1
+ <h1 align="center">
2
+ agent-terminal-ui
3
+ </h1>
4
+ <p align="center">
5
+ <p align="center">Terminal user interface for AI agents built on <a href="https://github.com/pydantic/agent-utilities">agent-utilities</a>.</p>
6
+ </p>
7
+ <p align="center">
8
+ <a href="https://github.com/astral-sh/uv"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json" alt="uv"></a>
9
+ <a href="https://github.com/astral-sh/ty"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ty/main/assets/badge/v0.json" alt="ty"></a>
10
+ <a href="https://pypi.org/project/agent-terminal-ui/"><img src="https://img.shields.io/pypi/v/agent-terminal-ui" alt="PyPI"></a>
11
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
12
+ </p>
13
+
14
+ A [Textual](https://textual.textualize.io/)-based terminal interface for interacting with AI agents. Connects to an [agent-utilities](https://github.com/pydantic/agent-utilities) backend via dual protocol support: AG-UI (SSE streaming) and ACP (JSON-RPC + SSE).
15
+
16
+ > [!NOTE]
17
+ > This library is in early development and subject to change.
18
+
19
+ ### Features
20
+
21
+ #### Core Functionality
22
+ - **Dual protocol support** -- AG-UI (SSE streaming, default) and ACP (JSON-RPC + SSE, opt-in)
23
+ - **Dynamic workflow sidebar** -- discovers graph nodes from sideband events at runtime; nodes are never hardcoded
24
+ - **Phase labels** -- Planning, Discovery, Execution, Validation
25
+ - **Completed node markers** -- checkmarks on finished specialists
26
+ - **Rich tool execution display** -- extensible formatter system for rendering tool calls and results
27
+ - **Human-in-the-loop tool approval** -- modal for confirming sensitive tool calls before execution
28
+ - **Multi-modal image attachment** -- attach images to messages for visual reasoning
29
+ - **Session management and chat history** -- browse and resume previous conversations
30
+ - **MCP server browser** -- inspect connected MCP servers and their tools
31
+
32
+ #### User Experience
33
+ - **Message queuing** -- queue messages while agent is processing; related queries are intelligently combined using regex patterns for conjunctions, sequential actions, and similar structure
34
+ - **Exit confirmation** -- modal dialog prevents accidental termination via Ctrl+C or `/exit`
35
+ - **Terminal transparency** -- UI respects your terminal's transparency settings for seamless integration
36
+ - **Theme system** -- multiple built-in themes (modern_dark, modern_light, nord, gruvbox) with proper color semantics
37
+
38
+ #### Commands
39
+ - **Slash commands** -- comprehensive command set for common operations:
40
+ - `/help` -- show available commands
41
+ - `/clear` -- clear the current event log
42
+ - `/mcp` -- browse connected MCP servers and their tools
43
+ - `/history` -- browse and select from historical chat sessions
44
+ - `/image` -- attach images to messages
45
+ - `/init` -- initialize a new project or workspace
46
+ - `/review` -- review code and suggest improvements
47
+ - `/test` -- run tests on the current codebase
48
+ - `/search` -- search through code and documentation
49
+ - `/stats` -- show statistics about the current session
50
+ - `/cost` -- show token and cost tracking information
51
+ - `/queue` -- show current message queue status
52
+ - `/queue:clear` -- clear all queued messages
53
+ - `/queue:toggle` -- enable/disable message queuing
54
+ - `/model` -- switch between available AI models
55
+ - `/theme` -- switch between available themes
56
+ - `/compact` -- compact conversation context to save tokens
57
+ - `/diff` -- show interactive diff viewer for recent changes
58
+ - `/recap` -- summarize the session context
59
+ - `/fast` -- toggle fast mode (Haiku/Flash models)
60
+ - `/memory` -- manage project memory (AGENTS.md)
61
+ - `/agents` -- list available specialized agents
62
+ - `/add-dir` -- add a directory to the agent's working context
63
+ - `/exit`, `/quit` -- exit the application with confirmation
64
+
65
+ #### Input Prefixes
66
+ - **`!`** -- Direct Bash execution (e.g., `!ls -la`)
67
+ - **`@`** -- Fuzzy file mention autocomplete (e.g., `@app.py`)
68
+
69
+ #### Backend Integration
70
+ - **Unified specialist visibility** -- MCP agents and A2A peers appear identically in the workflow sidebar; both emit the same sideband events via the backend's `discover_all_specialists()` unified roster
71
+ - **Tool-count telemetry** -- `tools-bound` sideband events include `toolset_count`, `dev_tools`, and `mcp_tools` breakdowns for per-specialist visibility
72
+ - **Real-time token and cost tracking** -- integrated in the status line for session monitoring
73
+ - **Memory Auto-loading** -- backend automatically includes `AGENTS.md` and `MEMORY.md` in the system prompt for project-aware reasoning.
74
+
75
+
76
+ ## Usage
77
+
78
+ Start the `agent-utilities` backend server, then launch the TUI:
79
+
80
+ ```bash
81
+ agent-tui
82
+ ```
83
+
84
+ Or run with `uv` if installed locally:
85
+
86
+ ```bash
87
+ uv run agent-tui
88
+ ```
89
+
90
+ ### Keyboard Shortcuts
91
+
92
+ - **Ctrl+C** -- Interrupt generation or cancel current operation
93
+ - **Ctrl+D** -- Exit session (with confirmation)
94
+ - **Ctrl+L** -- Clear the event log
95
+ - **Ctrl+O** -- Toggle workflow sidebar
96
+ - **Ctrl+T** -- Toggle task list view
97
+ - **Ctrl+U** -- Clear input buffer
98
+ - **Ctrl+Y** -- Restore cleared input buffer
99
+ - **Alt+P** -- Switch AI model
100
+ - **Alt+T** -- Toggle Extended Thinking (for reasoning models)
101
+ - **Alt+O** -- Toggle Fast Mode
102
+ - **Ctrl+R** -- Reverse history search
103
+ - **Ctrl+H** -- Show help overlay
104
+ - **Tab** -- Navigate between focusable elements
105
+ - **Esc Esc** -- Rewind/Undo (experimental)
106
+
107
+ ### Message Queuing
108
+
109
+ When the agent is processing, your input is automatically queued. The system intelligently combines related queries using patterns like:
110
+
111
+ - **Conjunctions**: "and", "also", "plus", "then", "after that"
112
+ - **Sequential actions**: semicolon-separated commands
113
+ - **Similar structure**: same action verbs (fix, add, remove, update, create, delete, implement, refactor)
114
+
115
+ Example: If you type "fix the bug in app.py" followed by "and add a test for it", these will be combined into a single query.
116
+
117
+ ### Environment Variables
118
+
119
+ | Variable | Default | Purpose |
120
+ |----------|---------|---------|
121
+ | `AGENT_URL` | `http://localhost:8000` | Agent server URL |
122
+ | `ENABLE_ACP` | `false` | Enable ACP protocol instead of AG-UI |
123
+ | `ACP_URL` | `http://localhost:8001` | ACP server URL (when ACP is enabled) |
124
+
125
+ ### Themes
126
+
127
+ The TUI supports multiple themes that respect terminal transparency:
128
+
129
+ - **modern_dark** (default) -- Dark theme with blue accents
130
+ - **modern_light** -- Light theme with proper contrast
131
+ - **nord** -- Nord color palette with frosty aesthetics
132
+ - **gruvbox** -- Gruvbox retro color scheme
133
+
134
+ Switch themes using `/theme <name>` command.
135
+
136
+
137
+ ## Development
138
+
139
+ ### Prerequisites
140
+
141
+ - [uv](https://docs.astral.sh/uv/getting-started/installation/)
142
+ - [prek](https://github.com/j178/prek/blob/master/README.md#installation)
143
+
144
+ ### Setup
145
+
146
+ Create uv virtual environment and install dependencies:
147
+
148
+ ```bash
149
+ uv sync --frozen --all-groups
150
+ ```
151
+
152
+ To update dependencies (updates the lock file):
153
+
154
+ ```bash
155
+ uv sync --all-groups
156
+ ```
157
+
158
+ Run formatting, linting, and type checking:
159
+
160
+ ```bash
161
+ uv run ruff format && uv run ruff check --fix && uv run ty check
162
+ ```
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/python
2
+ """Agent Terminal UI Package.
3
+
4
+ This package provides a high-performance, Textual-based terminal user interface
5
+ for interacting with AI agents within the agent-packages ecosystem.
6
+ """