Files
hermes-agent/docker/build_agent.py
ethernet 1bf588234c refactor(build): share product recipes across distributions
Build TUI, web, desktop UI and runnable agent products from explicit
prepared inputs. Keep dependency preparation separate from distribution
packaging, with PM and native builds sharing uv environment construction.

Docker copies compiled frontend products instead of build dependencies.
Nix retains uv2nix environments and consumes shared assembly through store
references. Native desktop and Termux use the same launcher and frontend
contracts. Preserve the independent PM runtime and source imports from
arbitrary working directories.

Keep failed frontend builds from replacing the previous product, reject
source/output overlap, and bound dependency-process output draining.
Include hermes_wisdom in the Nix wheel: real CLI smoke tests exposed its
missing package declaration on the base revision too.

Verified focused Python and JavaScript suites, Docker build/runtime checks,
Nix desktop and CLI/ACP checks, standalone TUI and packaged Electron PTY,
and real full-Chromium interaction. Native signed installers, Android device
installation and the full repository suite remain CI verification.
2026-09-11 13:16:55 -04:00

32 lines
1.3 KiB
Python

"""Supply the image's fixed runtime paths to the shared offline assembler."""
from __future__ import annotations
from pathlib import Path
import sysconfig
from scripts.build.agent import assemble
from scripts.build.inputs import AgentInputs, RESOURCE_ENV
from pm.store import current_target
def assemble_image(root: Path) -> None:
environment = root / ".venv"
site = Path(sysconfig.get_path("purelib", vars={"base": str(environment), "platbase": str(environment)}))
manifest = assemble(AgentInputs(
project=root / "pyproject.toml", code=root, repo=".", placement="fixed",
target=current_target(), python=(environment / "bin/python").absolute(),
site_packages=site, environment=environment, tools=root / "tools",
pm_runtime=root / "pm-runtime", bin_dir="libexec",
resources={name: root / name for name in RESOURCE_ENV},
frontends={"tui": root / "ui-tui", "web": root / "hermes_cli/web_dist"},
), root)
# Preserve the venv command paths used by s6 and the privilege-drop shim.
for name, command in manifest["runtime"]["commands"].items():
link = environment / "bin" / name
link.unlink(missing_ok=True)
link.symlink_to(f"../../{command}")
if __name__ == "__main__":
assemble_image(Path("/opt/hermes"))