tui-use  by onesuper

AI agent interaction with terminal applications

Created 4 months ago
251 stars

Top 99.8% on SourcePulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

Summary

tui-use addresses the critical gap in AI agent capabilities by enabling programmatic interaction with interactive terminal applications. It allows agents to control programs that expect human input, such as REPLs, debuggers, and TUI applications, which are inaccessible via standard shell scripting. This empowers AI coding assistants and researchers to debug complex systems, inspect large datasets in memory, and navigate interactive tools without manual intervention.

How It Works

The core of tui-use involves capturing raw PTY (pseudo-terminal) output and processing it through a headless xterm emulator. This ensures accurate rendering of terminal state, including ANSI escape sequences. Its novel "snapshot model" provides agents with a clean, plain-text representation of the screen at any given moment. The "smart wait" mechanism is a key differentiator, allowing agents to pause execution until the terminal screen has stabilized or until a specific text pattern appears, eliminating the need for unreliable sleep commands or polling.

Quick Start & Requirements

Installation is straightforward via npm: npm install -g tui-use. Alternatively, it can be built from source. Build tools (like build-essential, python3, g++ on Linux) are only required if the automatic binary pre-build fails. The project includes example usage, such as tui-use start python3 examples/ask.py.

Highlighted Details

  • Full VT Rendering: Accurately interprets ANSI escape codes for a clean, plain-text screen representation.
  • Smart Wait: Offers both screen stabilization (debounce) and semantic pattern matching for precise synchronization.
  • Snapshot Model: Facilitates predictable agent interaction loops by providing explicit screen state.
  • Highlights Field: Detects inverse-video spans to identify active UI elements like selected menu items.

Maintenance & Community

The README does not detail specific contributors, sponsorships, or community channels like Discord or Slack.

Licensing & Compatibility

The project is released under the permissive MIT License, generally allowing for commercial use and integration into closed-source projects.

Limitations & Caveats

tui-use strips most TUI color and formatting, presenting output as plain text. Interaction relies on detecting inverse-video for UI element selection, which may not cover all TUI paradigms.

Health Check
Last Commit

4 months ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
0 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.