Skip to content

feat: Termux/Android support — install path, TUI adaptations, voice backend, /image command#6834

Merged
teknium1 merged 15 commits into
mainfrom
hermes/hermes-8c64f471
Apr 9, 2026
Merged

feat: Termux/Android support — install path, TUI adaptations, voice backend, /image command#6834
teknium1 merged 15 commits into
mainfrom
hermes/hermes-8c64f471

Conversation

@teknium1

@teknium1 teknium1 commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Salvages the Termux/Android support from PR #6201 (by @adybag14-cyber), dropping the unrelated ChatGPT Web provider that was bundled in the same PR.

What this PR does

Adds first-class Android/Termux support for Hermes Agent:

Install & packaging:

  • Termux-aware scripts/install.sh — detects Termux, uses pkg for system deps, stdlib venv + pip
  • New .[termux] extra in pyproject.toml — curated bundle (cron, cli, pty, mcp, honcho, acp)
  • constraints-termux.txt for stable Android wheel resolution
  • setup-hermes.sh Termux path

Runtime adaptations:

  • get_temp_dir() on environment backends — Termux has no /tmp, uses $TMPDIR
  • Tool result storage and execute_code sandbox honor $TMPDIR
  • shlex.quote fixes in remote execute_code paths
  • supports_systemd_services() guard — Termux has no systemd
  • Gateway service flows disabled on Android

CLI/TUI:

  • Narrow-terminal TUI chrome (< 64 cols) — compact status bar, voice status, input separators
  • /image <path> slash command for local image attachment
  • Improved file-drop detection — supports ~/, quoted paths, relative paths, TERMINAL_CWD
  • Termux-specific clipboard paste guidance
  • Compact image attachment badges for narrow terminals

Voice mode:

  • TermuxAudioRecorder backend using termux-microphone-record / Termux:API
  • create_audio_recorder() factory — auto-selects best backend
  • detect_audio_environment() Termux-aware fallbacks

Diagnostics:

  • hermes doctor Termux-aware checks (pkg install hints, Docker info, browser setup steps)
  • hermes status Termux gateway detection

Documentation:

  • Full website/docs/getting-started/termux.md guide (manual + installer paths)
  • Installation, quickstart, FAQ updates
  • README Termux mention

Follow-up fixes (ours)

  • Deduplicated _is_termux() — was copy-pasted in 6 files, now single source in hermes_constants.is_termux()
  • Fixed test for suppress_status_output — was mocking _vprint (bypassing guard), now captures stdout

What was excluded from #6201

  • ChatGPT Web reverse-engineering provider (670-line module, websocket streaming, session token scraping)
  • websockets core dependency
  • run_agent.py chatgpt-web api_mode / XML tool call extraction
  • credential_pool.py session_token addition
  • error_classifier / _rate_limit_state removals (stale-branch regressions)

Test results

  • 415 targeted tests passed (all PR-specific test files)
  • 9743/9754 full suite passed — 11 failures all pre-existing on main

Closes the Termux portion of #6201. Credit to @adybag14-cyber for the original implementation.

adybag14-cyber and others added 15 commits April 9, 2026 14:49
Replace 6 identical copies of the Termux detection function across
cli.py, browser_tool.py, voice_mode.py, status.py, doctor.py, and
gateway.py with a single shared implementation in hermes_constants.py.

Each call site imports with its original local name to preserve all
existing callers (internal references and test monkeypatches).
…_vprint

The test was mocking _vprint entirely, bypassing the suppress guard.
Switch to capturing _print_fn output so the real _vprint runs and
the guard suppresses retry noise as intended.
@teknium1 teknium1 merged commit 3b554bf into main Apr 9, 2026
5 of 7 checks passed
@lenhoare

Copy link
Copy Markdown

Link to the termux docs is broken.
website/docs/getting-started/termux.md

@adybag14-cyber

Copy link
Copy Markdown
Contributor

Link to the termux docs is broken. website/docs/getting-started/termux.md

I'll take a look soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants