Skip to main content

ttypal

Serial port debug tool designed for both humans and AI agents.

Features

  • Interactive terminal (like minicom, but better)
  • Auto-logging with timestamps and rotation
  • Terminal-safe control-byte escaping (SO/SI and other C0 bytes shown as ^N/^O; --raw disables it)
  • External command injection via Unix socket (for AI/scripts)
  • ZMODEM file transfer over serial
  • Record/replay serial sessions
  • Macro recording and playback (F1-F12 hotkeys)
  • Board config management
  • AI agent skill for serial debugging

Install

pip install ttypal-ai

Platform-specific setup:

  • Linux - Native support; serial port permissions required
  • macOS - Native plug-and-play support (untested)
  • Windows - Run through WSL2 + usbipd-win (untested)

Quick Start

# Interactive mode
ttypal

# Headless daemon (for AI automation)
ttypal-daemon start -b myboard

# Send commands from another process
ttypal-send --wait "# " "uname -a"

# Read recent serial output
ttypal-tail -n 50

Terminal-safe output

Board output and log display are rendered through a control-byte filter. A stray SO (0x0E) would otherwise leave the terminal stuck in DEC Special Graphics; other unsafe C0 bytes and DEL are shown in caret notation (^N, ^O, ^?, ...). CR, LF, TAB, BS, BEL and ESC (ANSI sequences) pass through unchanged.

Log files themselves are not caret-escaped, so SO/SI remain available for debugging. Note that the logger decodes UTF-8 with replacement; use --record when you need lossless binary capture. ESC is passed through by default, including DEC charset designations, so this is not a full sandbox for arbitrary binary output.

Use --raw on ttypal, ttypal-send or ttypal-tail to disable caret escaping. --raw is not a lossless capture path: ttypal-send output may still have ANSI sequences/timestamps normalized by the daemon, and ttypal-tail --raw can feed control bytes to the terminal again. The interactive terminal can enable raw mode permanently in the board config (--no-raw overrides it):

[terminal]
raw = true

Python API

Use TtypalClient from Python tests and automation code to talk to a running ttypal-daemon without spawning ttypal-send for every operation.

from ttypal.client import TtypalClient, TtypalTimeoutError

serial = TtypalClient(session="myboard")

try:
    output = serial.send_wait("uname -a", prompt="# ", timeout=30)
except TtypalTimeoutError as exc:
    print(f"timed out via {exc.socket_path}: {exc.output}")
else:
    print(output)

Stable first-version methods:

Method Purpose
send(command) Send a command without waiting for output
send_wait(command, prompt="# ", timeout=None) Send a command and return output collected until prompt
expect_send(expect, command, timeout=None) Wait for text, then send a command
expect_send_wait(expect, command, prompt="# ", timeout=None) Wait for text, send a command, then wait for prompt
probe(timeout=2.0) Send Enter and return the current console response
request(payload, operation_timeout=None, io_timeout=None) Send a raw daemon protocol request

Macros

Bind command sequences to F1-F12 keys in your board config:

[macro]
F1 = ["echo hello", "sleep 0.5", "ls -la"]
F2 = ["reboot"]

Or record interactively: Ctrl-T r to start, Ctrl-T s to stop and save.

AI Agent Integration

Clone this repo and point your agent runtime at the reusable skill in .agents/skills/ttypal/.

cd /path/to/ttypal-ai
# Then ask your AI agent to operate the serial port with ttypal

License

MIT

Metadata

Release files for ttypal-ai 0.9.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ttypal-ai 0.9.3
File Size Uploaded Provenance Actions
ttypal_ai-0.9.3.tar.gz 50.7 kB Without provenance Details for ttypal_ai-0.9.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ttypal-ai 0.9.3
File Interpreter ABI Platform Actions
ttypal_ai-0.9.3-py3-none-any.whl Python 3 none any Details for ttypal_ai-0.9.3-py3-none-any.whl

Total release size: 87.7 kB

Release files / ttypal_ai-0.9.3.tar.gz

Download URL ttypal_ai-0.9.3.tar.gz
Size 50.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5414f7d5addf02a25614668a1fad4b2f11df3f01645c7c0678ab28274e923332
BLAKE2b-256 checksum
How to use checksums
a9bf66bd38949754bbf5301a8a94d7995aba276840f85630b5643eeb6fdd99b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / ttypal_ai-0.9.3-py3-none-any.whl

Download URL ttypal_ai-0.9.3-py3-none-any.whl
Size 37.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e816ef41a075b5f803dc5f3279a98022eaf88f1b8afd24d73ab855e55e754dd
BLAKE2b-256 checksum
How to use checksums
343dbdc5e3b0c9740b60dd87af3adeba78cf9e43486d12a7e3f259424b0ff48b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Security for ttypal-ai 0.9.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page