A real terminal adaptor for AI agents
Project description
TermAdaptor
Demo
Built on top of tmux
and many other libraries, Cybergod is capable of understanding and interacting terminal interface with both text-only and multimodal modes. With the help of wcwidth
, cursor is placed precisely at the right position even if there are multi-width unicode chars (CJK characters for example).
Code can be found here.
To interact with the environment programmatically, check out here
# env: TmuxEnvironment
env.send_key("vim")
env.send_key("Enter")
Terminal parsing (colorless):
Terminal parsing (colorful):
Terminal screenshot converted from HTML (cursor in red):
Terminal with dark theme and grayscale effects except for the cursor:
You can also have a block-styled cursor:
Change the cursor character to underline:
Override the cursor block style:
Usage
Terminal environment integration
First, install required binaries:
sudo apt install -y tmux tmuxp aha
Next, install the following dependencies:
pip install parse playwright beautifulsoup4
# setup playwright if you want to take terminal screenshots
playwright install chromium
Finally copy the lib.py
, then run test_lib.py
next to the lib.py
.
The SESSION_COMMAND
in test_lib.py
is the initial terminal environment command to be executed. Change it according to your need.
To view the environment:
preview = session.preview_html(show_cursor=True,wrap_html=True, dark_mode=True, grayscale=True)
To interact with the environment:
# note that both special key and literal strings can be sent.
env.send_key("date")
env.send_key("Enter") # special key
A full mapping from conventional special keys to standard Tmux special keys can be generated by running generate_funckey_alias.py
You can read the test file for further integration.
Star History
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file termadaptor-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: termadaptor-0.0.2-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d5b8881e0c84582d32c6b2851d05213f62747f686fc2156773815d5b57b03ed |
|
MD5 | 9c2fe81337f35467d63d63fcbaca367b |
|
BLAKE2b-256 | c96f72019c250d02830165924de8bba187525fd78b3b3ff4ee5796eba36c6371 |