a devlog on machines & languages

25 Adamant Devlog 3

There has been significant progress. This:

# Runs a webserver inside the sandbox that is accessible from outside
adamant --profile minimal prepare -- ls sh fish ncdu fastfetch uname mkdir python echo
adamant --profile minimal probe -- python 'print("Hello, World!")'
adamant --profile minimal run --ingress 45678:45678 -- fish -c "mkdir -p /tmp/www; echo '<p>Hello, World!</p>' >> /tmp/www/index.html; python -m http.server -b 127.0.0.1 -d /tmp/www 45678"

and this:

# Runs headless Firefox inside the sandbox and takes a screenshot
adamant --profile ff prepare -- ls sh uname mkdir fish firefox
adamant --profile ff probe --timeout 60 --host bhashika.org.in -- curl https://bhashika.org.in
adamant --profile ff probe --timeout 60 --host bhashika.org.in -- firefox --headless --no-remote --screenshot https://bhashika.org.in
# screenshot.png is produced in $PWD
adamant --profile ff run --host bhashika.org.in -- firefox --headless --no-remote --screenshot https://bhashika.org.in

Screenshot of the Bhāṣikā website captured by headless firefox

So Adamant now supports ingress and egress.

The HTTP_PROXY limitation continues to exist, and I have scrapped the veth idea because of its complexity. The socat trick together with the whitelisting of hosts is more than sufficient for most needs. But, on the whole, the Adamant that exists today is a far superior version compared to the one from last week. One of its biggest features is that it has zero dependencies and is distributed as a zipapp. All you need is Python 3.11 or above + bwrap + socat + strace on your Linux machine.

probe was a gamechanger. It safely and repeatedly traces the binary inside a sandbox and determines dynamic dependencies. So manual editing of the TOML files can be reduced to a minimum. Both the examples above needed zero edits to the profiles. However, you definitely want to personalize them so that the interactive terminal behaves nicely, and your data and config folders are mounted properly.

I also had the LLM craft a linear patches series from the ~6KLOC single changeset code dump so that anyone actually reading the code can see some sort of linear progression of ideas.

On the whole, a productive week for Adamant.