summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3ff39d97a161056fe2b30c01434b0e3ebddb0492 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Maintainer: wyf9661 <wyf9661@hotmail.com>
# Contributor: Nous Research <ops@nousresearch.com>

_pkgname=hermes-agent
pkgname=python-${_pkgname}
tag=2026.7.20
pkgver=0.19.0
pkgrel=2
pkgdesc="The self-improving AI agent — creates skills from experience, improves them during use, and runs anywhere"
arch=('any')
url="https://github.com/NousResearch/${_pkgname}"
license=('MIT')
depends=('python>=3.11' 'python-dotenv' 'python-prompt_toolkit' 'python-openai' 'python-fire'
          'python-ruamel-yaml' 'python-rich' 'python-pyjwt' 'python-tenacity' 'python-yaml'
          'python-httpx' 'python-requests' 'python-jinja' 'python-pydantic' 'python-psutil'
          'python-markdown' 'python-pathspec' 'python-ptyprocess'
          'python-certifi' 'python-packaging' 'python-urllib3' 'python-websockets'
          'python-pillow' 'python-multipart' 'python-cryptography'
          'python-fastapi' 'python-starlette' 'uvicorn')
optdepends=('python-telegram-bot: Telegram messaging support'
            'python-discord: Discord messaging support (PyPI: discord.py)'
            'python-aiohttp: Async HTTP for messaging/web, QQ bot & Wechat messaging needs this'
            'python-mcp: Model Context Protocol support'
            'python-anthropic: Anthropic Claude API support'
            'python-faster-whisper: Local voice transcription'
            'python-sounddevice: Audio I/O for voice'
            'python-numpy: Numerical computing for voice/other'
            'python-simple-term-menu: Interactive CLI menu'
            'python-slack-sdk: Slack integration'
            'python-qrcode: QR code generation for auth'
            'python-croniter: Cron scheduling support (upstream-required, AUR)'
            'python-exa-py: Exa web search backend'
            'python-firecrawl-py: Firecrawl web search backend'
            'python-fal-client: Fal image generation backend'
            'python-edge-tts: Edge TTS TTS backend'
            'python-brotlicffi: Brotli compression for aiohttp'
            'python-mautrix: Matrix messaging support'
            'python-aiosqlite: SQLite async for Matrix'
            'python-asyncpg: PostgreSQL async for Matrix'
            'python-aiohttp-socks: SOCKS proxy for Matrix'
            'python-defusedxml: XML hardening for WeCom')
makedepends=('python-installer' 'python-wheel' 'python-build' 'python-setuptools' 'nodejs' 'npm')
# Binary is a self-contained Bun executable with embedded JS/resources - stripping breaks it
options=('!strip' '!debug')
source=(
    "${url}/archive/refs/tags/v${tag}.tar.gz"
    "0001-fix-daemon-pool-py314-ThreadPoolExecutor-API.patch"
)
sha256sums=(
    '285f3fc134ff466a90065e1517801a68993733b807158ee8f32aa01613786990'
    '6b3357098d9e70eb33c95e2f7d12c2bdc016f6e7933b517d85f1399d50caea71'
)

prepare() {
  cd "${srcdir}/hermes-agent-${tag}"
  # Arch Linux currently ships newer setuptools than upstream's build cap.
  # The package builds with the distro setuptools, so relax the upper bound.
  sed -i 's/setuptools>=77.0,<83/setuptools>=77.0/' pyproject.toml
  # Python 3.14: ThreadPoolExecutor no longer has _initializer/_initargs
  patch -p1 < "${srcdir}/0001-fix-daemon-pool-py314-ThreadPoolExecutor-API.patch"
}

package() {
  cd "${srcdir}/hermes-agent-${tag}"
  python -m build --quiet --wheel --no-isolation
  python -m installer --destdir="${pkgdir}" dist/*.whl

  # Pre-build TUI frontend in $srcdir, then place dist/entry.js under hermes_cli/tui_dist/
  cd "${srcdir}/hermes-agent-${tag}/ui-tui"
  npm ci --silent --no-fund --no-audit --progress=false
  npm run build

  _pyver=$(python -c 'import sys; print(f"python{sys.version_info.major}.{sys.version_info.minor}")')
  install -Dm644 dist/entry.js "${pkgdir}/usr/lib/${_pyver}/site-packages/hermes_cli/tui_dist/entry.js"
}