diff --git a/group_vars/mac/main.yml b/group_vars/mac/main.yml index 1ae4064..b8bfbe9 100644 --- a/group_vars/mac/main.yml +++ b/group_vars/mac/main.yml @@ -27,6 +27,8 @@ hermes_dashboard_username: admin # The one host folder Hermes's sandbox sees (mounted at /workspace). hermes_workspace: "{{ ansible_user_dir }}/hermes" +# Mounted into the sandbox for the browser (terminal.docker_volumes below). +hermes_sandbox_chromium: "{{ ansible_user_dir }}/.hermes/sandbox-chromium" # Individual Hermes settings, set with `hermes config set`. The rest of # ~/.hermes/config.yaml stays Hermes's own (its updates migrate that file). @@ -42,6 +44,15 @@ hermes_settings: # the gateway (its .env with the API keys). A container path such as # /workspace made the host log a warning every few seconds (#140527). terminal.cwd: "{{ hermes_workspace }}" + # Podman reports images by their full name, and Hermes compares names as + # text: the short name made it delete the sandbox on every reuse. + terminal.docker_image: docker.io/nousresearch/hermes-sandbox:desktop + # Hermes 0.23.1 looks for Chromium in chrome-linux/; the ARM64 image ships + # chrome-linux-arm64/, so the browser said there was none (hermes-agent + # #153626). The mounted folder (roles/mac/files/sandbox-chromium) holds a + # chrome-linux/chrome script that runs the image's own Chromium. + terminal.docker_volumes: + - "{{ hermes_sandbox_chromium }}:/home/pn/.cache/ms-playwright:ro" terminal.container_memory: 3072 # MB; must fit in the Podman VM (podman_machine_memory) # kanban: multi-agent boards (unused here); its 14 tools were 25 KB of the # 65 KB of tool definitions sent with every message. diff --git a/roles/mac/README.md b/roles/mac/README.md index f368033..3e5aeb6 100644 --- a/roles/mac/README.md +++ b/roles/mac/README.md @@ -40,8 +40,15 @@ Manages cogitator-02, an Apple Silicon Mac on the tailnet (`mac.yml`, Hermes has no command for it. Cua's skill pack is read through `skills.external_dirs`, and the `cua-driver` symlink in `~/.hermes/skills` is removed (a symlink there empties running sandboxes' skills, - hermes-agent #53630). After changing `terminal.cwd`, remove the old - `hermes-*` Podman containers: running ones keep their old mounts. + hermes-agent #53630). After changing `terminal.cwd` or + `terminal.docker_volumes`, remove the old `hermes-*` Podman containers: + running ones keep their old mounts. + The sandbox image is set by its full name (`docker.io/…`): Podman reports + that form, and with the short name Hermes deleted the sandbox on every + reuse. For the browser, `~/.hermes/sandbox-chromium` + (`files/sandbox-chromium`) is mounted where Hermes looks for Chromium; its + `chrome-linux/chrome` script runs the ARM64 Chromium the image ships + (hermes-agent #153626). Remove the mount once Hermes finds it by itself. - **MCP servers and secrets** (also tag `hermes-settings`): MCP servers are `mcp_servers.` entries in `hermes_settings`, each running in a throwaway Podman container. Secrets they need are in `hermes_env_secrets` diff --git a/roles/mac/files/sandbox-chromium/chromium-arm64/chrome-linux/chrome b/roles/mac/files/sandbox-chromium/chromium-arm64/chrome-linux/chrome new file mode 100755 index 0000000..cbe5cb8 --- /dev/null +++ b/roles/mac/files/sandbox-chromium/chromium-arm64/chrome-linux/chrome @@ -0,0 +1,10 @@ +#!/bin/sh +# Hermes 0.23.1 looks for Chromium in chrome-linux/; the ARM64 sandbox image +# ships it in chrome-linux-arm64/ (hermes-agent #153626). Mounted at +# /home/pn/.cache/ms-playwright, so this runs the image's own Chromium, +# whichever version it is. +for c in /opt/playwright/chromium-*/chrome-linux-arm64/chrome; do + exec "$c" "$@" +done +echo "no Chromium under /opt/playwright" >&2 +exit 127 diff --git a/roles/mac/tasks/hermes-settings.yml b/roles/mac/tasks/hermes-settings.yml index e50f476..be09fb4 100644 --- a/roles/mac/tasks/hermes-settings.yml +++ b/roles/mac/tasks/hermes-settings.yml @@ -21,6 +21,15 @@ when: hermes_cua_skills_link.stat.islnk | default(false) notify: [Restart Hermes gateway, Restart Hermes dashboard] +# Before the settings, so the folder exists when a sandbox mounts it. +# Changing the mount only affects new sandboxes: remove the hermes-* +# Podman containers to pick it up. +- name: Chromium launcher for the sandbox's browser + ansible.builtin.copy: + src: sandbox-chromium/ + dest: "{{ hermes_sandbox_chromium }}/" + mode: preserve + # Secrets go in first, so servers and settings that reference them # (${VAR}) find them when the gateway restarts. - name: Secrets in Hermes's .env