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.1-py3-none-any.whl
.
File metadata
- Download URL: termadaptor-0.0.1-py3-none-any.whl
- Upload date:
- Size: 13.1 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 | 563a1c1e0d1bcb0b1dfab64f3197e319b49eb8752e7b65775ba9db5f35ce72d3 |
|
MD5 | 8994cf2e496dda566b9fe1c371284548 |
|
BLAKE2b-256 | 272f75b144969344dc430bac1080e46f4c7663d0826ee59035e870c824be6ad1 |