From ac0aaa931f787c8902c9ec613e8642ebe381b41f Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Fri, 20 Mar 2026 16:27:09 +0100 Subject: [PATCH] Rename anvilsrv to anvillm --- README.md | 32 +++---- SECURITY.md | 8 +- docs/ollama-backend.md | 2 +- services/README.md | 34 +++---- services/inbox-notify-runit/README.md | 2 +- services/runit/README.md | 28 +++--- services/runit/finish | 6 +- services/runit/run | 12 +-- services/systemd/README.md | 88 +++++++++---------- services/systemd/anvillm-inbox-notify.service | 4 +- ...lsrv-user.service => anvillm-user.service} | 6 +- .../{anvilsrv.service => anvillm.service} | 6 +- .../{anvilsrv@.service => anvillm@.service} | 6 +- services/sysvinit/README.md | 58 ++++++------ services/sysvinit/{anvilsrv => anvillm} | 28 +++--- services/sysvinit/{rc.anvilsrv => rc.anvillm} | 66 +++++++------- 16 files changed, 193 insertions(+), 193 deletions(-) rename services/systemd/{anvilsrv-user.service => anvillm-user.service} (81%) rename services/systemd/{anvilsrv.service => anvillm.service} (87%) rename services/systemd/{anvilsrv@.service => anvillm@.service} (82%) rename services/sysvinit/{anvilsrv => anvillm} (85%) rename services/sysvinit/{rc.anvilsrv => rc.anvillm} (60%) diff --git a/README.md b/README.md index ea8d363..fadaf92 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ LLM orchestrator using 9P — scriptable, multi-backend, crash-resilient ![Architecture](docs/diagrams/architecture.svg?v=2) -**Core:** anvilsrv (9P daemon), anvilmcp (optional MCP server, see [anvillm-mcp](https://github.com/lneely/anvillm-mcp)) +**Core:** anvillm (9P daemon), anvilmcp (optional MCP server, see [anvillm-mcp](https://github.com/lneely/anvillm-mcp)) **Frontends:** Any 9P-speaking program — currently Assist (Acme) **Benefits:** Shared sessions, crash recovery, scriptable via 9P, cross-backend agent communication @@ -27,32 +27,32 @@ git clone https://github.com/lneely/anvillm && cd anvillm && mk **Service integration** (optional, see `services/*/README.md`): ```sh # systemd user -cp services/systemd/anvilsrv-user.service ~/.config/systemd/user/ -systemctl --user enable --now anvilsrv +cp services/systemd/anvillm-user.service ~/.config/systemd/user/ +systemctl --user enable --now anvillm # systemd system -sudo cp services/systemd/anvilsrv.service /etc/systemd/system/ -sudo systemctl enable --now anvilsrv +sudo cp services/systemd/anvillm.service /etc/systemd/system/ +sudo systemctl enable --now anvillm # runit -sudo cp -r services/runit /etc/sv/anvilsrv -sudo ln -s /etc/sv/anvilsrv /var/service/ +sudo cp -r services/runit /etc/sv/anvillm +sudo ln -s /etc/sv/anvillm /var/service/ ``` ## Usage ```sh -anvilsrv start # background -anvilsrv fgstart # foreground -anvilsrv status -anvilsrv stop +anvillm start # background +anvillm fgstart # foreground +anvillm status +anvillm stop ``` `Assist` auto-starts if needed. **Namespaces:** Run multiple instances via `$NAMESPACE` (default: `/tmp/ns.$USER.:0`) ```sh -NAMESPACE=/tmp/ns.$USER.:1 anvilsrv start +NAMESPACE=/tmp/ns.$USER.:1 anvillm start NAMESPACE=/tmp/ns.$USER.:1 Assist ``` @@ -348,7 +348,7 @@ The Conductor analyzes dependencies, spawns specialized bots, and delegates work **Monitoring:** - Event stream: `9p read anvillm/events` (state changes, messages) - Debug logs: `~/.config/anvillm/logs/` (set `ANVILLM_DEBUG=1` for verbose output) -- Foreground mode: `anvilsrv fgstart` for live stderr output +- Foreground mode: `anvillm fgstart` for live stderr output ## MCP Integration @@ -370,13 +370,13 @@ See [Code Execution User Guide](docs/code-execution-user-guide.md) for details. | Problem | Solution | |---------|----------| -| Can't connect | `anvilsrv status`; try `anvilsrv start` | +| Can't connect | `anvillm status`; try `anvillm start` | | Session won't start | Check stderr; verify backend installed | | Landlock ABI error | Set `best_effort: true` or upgrade kernel | | Permission denied | Add paths to layered config | | Orphaned tmux | `tmux kill-session -t anvillm-0` | | 9P not working | `9p ls agent` | -| Stale PID | `anvilsrv stop` auto-cleans | -| Daemon won't stop | `anvilsrv fgstart` for logs | +| Stale PID | `anvillm stop` auto-cleans | +| Daemon won't stop | `anvillm fgstart` for logs | | Bot stuck in "running" | Attach to the session's tmux window and type "stop work." to interrupt it and return to idle | See Configuration section for environment variables. diff --git a/SECURITY.md b/SECURITY.md index 50e1c6d..f86fbba 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,7 +2,7 @@ ## 9P Server Socket -The anvilsrv 9P server creates a Unix domain socket at `$NAMESPACE/agent` (typically `/tmp/ns.$USER/agent`). +The anvillm 9P server creates a Unix domain socket at `$NAMESPACE/agent` (typically `/tmp/ns.$USER/agent`). **Important Security Notes:** @@ -43,7 +43,7 @@ The anvilsrv 9P server creates a Unix domain socket at `$NAMESPACE/agent` (typic ## PID File -The PID file is stored at `$NAMESPACE/anvilsrv.pid` to prevent symlink attacks. Older versions used `/tmp/anvilsrv.pid` which was vulnerable. +The PID file is stored at `$NAMESPACE/anvillm.pid` to prevent symlink attacks. Older versions used `/tmp/anvillm.pid` which was vulnerable. ## Path Validation @@ -68,9 +68,9 @@ Backend sessions run in tmux windows with: - FIFO pipes for output capture at `/tmp/tmux-{session}-{window}.fifo` **Security Notes**: -- Tmux sessions are accessible to the user running anvilsrv +- Tmux sessions are accessible to the user running anvillm - FIFO files in /tmp could theoretically be accessed by other local users -- Backend processes inherit anvilsrv's environment and permissions +- Backend processes inherit anvillm's environment and permissions ## Future Improvements diff --git a/docs/ollama-backend.md b/docs/ollama-backend.md index 4a91900..1190a23 100644 --- a/docs/ollama-backend.md +++ b/docs/ollama-backend.md @@ -34,7 +34,7 @@ The Ollama backend enables local LLM usage via [mcphost](https://github.com/mark ## Usage -Start anvilsrv and create an Ollama session: +Start anvillm and create an Ollama session: ```bash # Via 9P interface diff --git a/services/README.md b/services/README.md index 156bf57..4a177ed 100644 --- a/services/README.md +++ b/services/README.md @@ -1,6 +1,6 @@ # AnviLLM Service Management -This directory contains service management scripts for running `anvilsrv` as a system service. +This directory contains service management scripts for running `anvillm` as a system service. ## Available Init Systems @@ -13,9 +13,9 @@ See [systemd/README.md](systemd/README.md) for installation instructions. **Quick Start (User Service):** ```sh mkdir -p ~/.config/systemd/user -cp services/systemd/anvilsrv-user.service ~/.config/systemd/user/ +cp services/systemd/anvillm-user.service ~/.config/systemd/user/ systemctl --user daemon-reload -systemctl --user enable --now anvilsrv-user.service +systemctl --user enable --now anvillm-user.service ``` ### runit @@ -26,30 +26,30 @@ See [runit/README.md](runit/README.md) for installation instructions. **Quick Start:** ```sh -sudo cp -r services/runit /etc/sv/anvilsrv -sudo chmod +x /etc/sv/anvilsrv/run /etc/sv/anvilsrv/finish -sudo ln -s /etc/sv/anvilsrv /var/service/anvilsrv +sudo cp -r services/runit /etc/sv/anvillm +sudo chmod +x /etc/sv/anvillm/run /etc/sv/anvillm/finish +sudo ln -s /etc/sv/anvillm /var/service/anvillm ``` ## Manual Management (No Init System) -If you don't want to use an init system, you can manage anvilsrv manually: +If you don't want to use an init system, you can manage anvillm manually: ```sh # Start the server -anvilsrv start +anvillm start # Check status -anvilsrv status +anvillm status # Stop the server -anvilsrv stop +anvillm stop ``` You can also add this to your shell startup file (`.profile`, `.bashrc`, etc.): ```sh -# Auto-start anvilsrv if not running -anvilsrv status 2>/dev/null || anvilsrv start +# Auto-start anvillm if not running +anvillm status 2>/dev/null || anvillm start ``` ## Choosing an Init System @@ -60,9 +60,9 @@ anvilsrv status 2>/dev/null || anvilsrv start ## Troubleshooting -### Check if anvilsrv is Running +### Check if anvillm is Running ```sh -anvilsrv status +anvillm status ``` ### Check 9P Socket @@ -78,13 +78,13 @@ echo "list" | 9p read anvillm/list **systemd:** ```sh -journalctl --user -u anvilsrv-user -f +journalctl --user -u anvillm-user -f ``` **runit:** ```sh -sudo svlogd /var/log/anvilsrv +sudo svlogd /var/log/anvillm ``` **manual:** -Check stderr output (anvilsrv logs to stderr/stdout by default). +Check stderr output (anvillm logs to stderr/stdout by default). diff --git a/services/inbox-notify-runit/README.md b/services/inbox-notify-runit/README.md index 08bacc8..c1fd983 100644 --- a/services/inbox-notify-runit/README.md +++ b/services/inbox-notify-runit/README.md @@ -47,4 +47,4 @@ sv up anvillm-inbox-notify - `anvillm-inbox-notify` script installed in `PATH` - `notify-send` (from `libnotify` or `dunst`) - `jq` ≥ 1.6 -- `9p` command connected to a running `anvilsrv` +- `9p` command connected to a running `anvillm` diff --git a/services/runit/README.md b/services/runit/README.md index 1b3fc3e..84874eb 100644 --- a/services/runit/README.md +++ b/services/runit/README.md @@ -1,33 +1,33 @@ -# runit Service for anvilsrv +# runit Service for anvillm -This directory contains a runit service definition for anvilsrv. +This directory contains a runit service definition for anvillm. ## Installation -1. Copy this directory to `/etc/sv/anvilsrv`: +1. Copy this directory to `/etc/sv/anvillm`: ```sh - sudo cp -r services/runit /etc/sv/anvilsrv - sudo chmod +x /etc/sv/anvilsrv/run - sudo chmod +x /etc/sv/anvilsrv/finish + sudo cp -r services/runit /etc/sv/anvillm + sudo chmod +x /etc/sv/anvillm/run + sudo chmod +x /etc/sv/anvillm/finish ``` 2. Enable the service by creating a symlink: ```sh - sudo ln -s /etc/sv/anvilsrv /var/service/anvilsrv + sudo ln -s /etc/sv/anvillm /var/service/anvillm ``` 3. The service will start automatically. Check status: ```sh - sudo sv status anvilsrv + sudo sv status anvillm ``` ## Service Management -- **Start**: `sudo sv start anvilsrv` -- **Stop**: `sudo sv stop anvilsrv` -- **Restart**: `sudo sv restart anvilsrv` -- **Status**: `sudo sv status anvilsrv` -- **View logs**: `sudo svlogd /var/log/anvilsrv` +- **Start**: `sudo sv start anvillm` +- **Stop**: `sudo sv stop anvillm` +- **Restart**: `sudo sv restart anvillm` +- **Status**: `sudo sv status anvillm` +- **View logs**: `sudo svlogd /var/log/anvillm` ## Notes @@ -36,5 +36,5 @@ This directory contains a runit service definition for anvilsrv. - The service will automatically restart if it crashes - To disable the service, remove the symlink from /var/service: ```sh - sudo rm /var/service/anvilsrv + sudo rm /var/service/anvillm ``` diff --git a/services/runit/finish b/services/runit/finish index 1730e30..7c8e564 100755 --- a/services/runit/finish +++ b/services/runit/finish @@ -1,11 +1,11 @@ #!/bin/sh -# runit finish script for anvilsrv +# runit finish script for anvillm # Called when the service stops -echo "anvilsrv stopped" +echo "anvillm stopped" # Remove PID file if it exists -rm -f /tmp/anvilsrv.pid +rm -f /tmp/anvillm.pid # Optional: clean up stale sockets # export NAMESPACE="${NAMESPACE:-/tmp/ns.$(whoami)}" diff --git a/services/runit/run b/services/runit/run index b98db8d..0f3e68e 100755 --- a/services/runit/run +++ b/services/runit/run @@ -1,9 +1,9 @@ #!/bin/sh -# runit service script for anvilsrv +# runit service script for anvillm # # To install this service: -# 1. Copy this directory to /etc/sv/anvilsrv -# 2. Create symlink: ln -s /etc/sv/anvilsrv /var/service/anvilsrv +# 1. Copy this directory to /etc/sv/anvillm +# 2. Create symlink: ln -s /etc/sv/anvillm /var/service/anvillm # # The service will start automatically and restart if it crashes. @@ -19,8 +19,8 @@ export NAMESPACE="${NAMESPACE:-/tmp/ns.$(whoami)}" mkdir -p "$NAMESPACE" # Log service start -echo "Starting anvilsrv..." +echo "Starting anvillm..." -# Run anvilsrv in foreground (don't daemonize for runit) +# Run anvillm in foreground (don't daemonize for runit) # The 'start' command will handle the daemon setup -exec chpst -u $(whoami) anvilsrv start +exec chpst -u $(whoami) anvillm start diff --git a/services/systemd/README.md b/services/systemd/README.md index 46b5c6b..5b32b87 100644 --- a/services/systemd/README.md +++ b/services/systemd/README.md @@ -1,37 +1,37 @@ -# systemd Service Units for anvilsrv +# systemd Service Units for anvillm -This directory contains systemd service unit files for running anvilsrv as a system service. +This directory contains systemd service unit files for running anvillm as a system service. ## Service Files -### 1. `anvilsrv-user.service` - User Service (Recommended) +### 1. `anvillm-user.service` - User Service (Recommended) -Run anvilsrv as a user service using systemd's user instance. +Run anvillm as a user service using systemd's user instance. **Installation:** ```sh # Copy the service file mkdir -p ~/.config/systemd/user -cp services/systemd/anvilsrv-user.service ~/.config/systemd/user/ +cp services/systemd/anvillm-user.service ~/.config/systemd/user/ # Reload systemd user daemon systemctl --user daemon-reload # Enable and start the service -systemctl --user enable anvilsrv-user.service -systemctl --user start anvilsrv-user.service +systemctl --user enable anvillm-user.service +systemctl --user start anvillm-user.service # Check status -systemctl --user status anvilsrv-user.service +systemctl --user status anvillm-user.service ``` **Management:** -- Start: `systemctl --user start anvilsrv-user` -- Stop: `systemctl --user stop anvilsrv-user` -- Restart: `systemctl --user restart anvilsrv-user` -- Status: `systemctl --user status anvilsrv-user` -- Logs: `journalctl --user -u anvilsrv-user -f` -- Disable: `systemctl --user disable anvilsrv-user` +- Start: `systemctl --user start anvillm-user` +- Stop: `systemctl --user stop anvillm-user` +- Restart: `systemctl --user restart anvillm-user` +- Status: `systemctl --user status anvillm-user` +- Logs: `journalctl --user -u anvillm-user -f` +- Disable: `systemctl --user disable anvillm-user` **Enable Linger (Start on Boot):** @@ -40,95 +40,95 @@ To make the service start on system boot even when not logged in: sudo loginctl enable-linger $USER ``` -### 2. `anvilsrv@.service` - System Service Template +### 2. `anvillm@.service` - System Service Template -Run anvilsrv as a system service for specific users. +Run anvillm as a system service for specific users. **Installation:** ```sh # Copy the service file -sudo cp services/systemd/anvilsrv@.service /etc/systemd/system/ +sudo cp services/systemd/anvillm@.service /etc/systemd/system/ # Reload systemd daemon sudo systemctl daemon-reload # Enable and start for a specific user (replace 'username') -sudo systemctl enable anvilsrv@username.service -sudo systemctl start anvilsrv@username.service +sudo systemctl enable anvillm@username.service +sudo systemctl start anvillm@username.service # Check status -sudo systemctl status anvilsrv@username.service +sudo systemctl status anvillm@username.service ``` **Management:** -- Start: `sudo systemctl start anvilsrv@username` -- Stop: `sudo systemctl stop anvilsrv@username` -- Restart: `sudo systemctl restart anvilsrv@username` -- Status: `sudo systemctl status anvilsrv@username` -- Logs: `sudo journalctl -u anvilsrv@username -f` -- Disable: `sudo systemctl disable anvilsrv@username` +- Start: `sudo systemctl start anvillm@username` +- Stop: `sudo systemctl stop anvillm@username` +- Restart: `sudo systemctl restart anvillm@username` +- Status: `sudo systemctl status anvillm@username` +- Logs: `sudo journalctl -u anvillm@username -f` +- Disable: `sudo systemctl disable anvillm@username` -### 3. `anvilsrv.service` - Simple System Service +### 3. `anvillm.service` - Simple System Service Basic system service (less flexible than the template). **Installation:** ```sh # Edit the service file to set the correct username -nano services/systemd/anvilsrv.service +nano services/systemd/anvillm.service # Copy the service file -sudo cp services/systemd/anvilsrv.service /etc/systemd/system/ +sudo cp services/systemd/anvillm.service /etc/systemd/system/ # Reload systemd daemon sudo systemctl daemon-reload # Enable and start the service -sudo systemctl enable anvilsrv.service -sudo systemctl start anvilsrv.service +sudo systemctl enable anvillm.service +sudo systemctl start anvillm.service # Check status -sudo systemctl status anvilsrv.service +sudo systemctl status anvillm.service ``` ## Choosing the Right Service -- **User Service (`anvilsrv-user.service`)**: Best for most users. Runs in your user session, easier to manage, no sudo required. -- **System Service Template (`anvilsrv@.service`)**: Good for multi-user systems or when you need system-level control. -- **Simple System Service (`anvilsrv.service`)**: Basic system service, less flexible. +- **User Service (`anvillm-user.service`)**: Best for most users. Runs in your user session, easier to manage, no sudo required. +- **System Service Template (`anvillm@.service`)**: Good for multi-user systems or when you need system-level control. +- **Simple System Service (`anvillm.service`)**: Basic system service, less flexible. ## Troubleshooting ### Check Logs ```sh # User service -journalctl --user -u anvilsrv-user -n 50 +journalctl --user -u anvillm-user -n 50 # System service -sudo journalctl -u anvilsrv@username -n 50 +sudo journalctl -u anvillm@username -n 50 ``` ### Verify Service is Running ```sh # User service -systemctl --user status anvilsrv-user +systemctl --user status anvillm-user # System service -sudo systemctl status anvilsrv@username +sudo systemctl status anvillm@username ``` -### Check if anvilsrv is Actually Running +### Check if anvillm is Actually Running ```sh -anvilsrv status +anvillm status ``` ### Restart After Code Changes ```sh # User service -systemctl --user restart anvilsrv-user +systemctl --user restart anvillm-user # System service -sudo systemctl restart anvilsrv@username +sudo systemctl restart anvillm@username ``` ## Notes @@ -136,4 +136,4 @@ sudo systemctl restart anvilsrv@username - The service automatically restarts on failure with a 5-second delay - PID file is cleaned up on service stop - Logs are available via journalctl -- The service uses the anvilsrv binary from `~/bin/anvilsrv` +- The service uses the anvillm binary from `~/bin/anvillm` diff --git a/services/systemd/anvillm-inbox-notify.service b/services/systemd/anvillm-inbox-notify.service index 941cdee..47a7499 100644 --- a/services/systemd/anvillm-inbox-notify.service +++ b/services/systemd/anvillm-inbox-notify.service @@ -11,13 +11,13 @@ Type=simple # Environment="DISPLAY=:0" # Environment="DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%U/bus" -# Namespace for 9P mount (default matches anvilsrv default). +# Namespace for 9P mount (default matches anvillm default). # Override if you use a non-default namespace. # Environment="NAMESPACE=/tmp/ns.%u.:0" ExecStart=%h/bin/anvillm-inbox-notify -# Restart if the daemon exits (e.g. anvilsrv restarted and the 9p read broke). +# Restart if the daemon exits (e.g. anvillm restarted and the 9p read broke). Restart=on-failure RestartSec=5s diff --git a/services/systemd/anvilsrv-user.service b/services/systemd/anvillm-user.service similarity index 81% rename from services/systemd/anvilsrv-user.service rename to services/systemd/anvillm-user.service index 81f1f77..225e125 100644 --- a/services/systemd/anvilsrv-user.service +++ b/services/systemd/anvillm-user.service @@ -11,11 +11,11 @@ WorkingDirectory=%h # But we can override if needed: # Environment="PATH=%h/bin:/usr/local/bin:/usr/bin:/bin" -# Start anvilsrv -ExecStart=%h/bin/anvilsrv start +# Start anvillm +ExecStart=%h/bin/anvillm start # Cleanup on stop -ExecStopPost=/bin/rm -f /tmp/anvilsrv.pid +ExecStopPost=/bin/rm -f /tmp/anvillm.pid # Restart policy Restart=on-failure diff --git a/services/systemd/anvilsrv.service b/services/systemd/anvillm.service similarity index 87% rename from services/systemd/anvilsrv.service rename to services/systemd/anvillm.service index 536c467..24094cd 100644 --- a/services/systemd/anvilsrv.service +++ b/services/systemd/anvillm.service @@ -17,11 +17,11 @@ Environment="NAMESPACE=/tmp/ns.%i" ExecStartPre=/bin/mkdir -p /tmp/ns.%i ExecStartPre=/bin/chown %i:%i /tmp/ns.%i -# Start anvilsrv -ExecStart=/home/%i/bin/anvilsrv start +# Start anvillm +ExecStart=/home/%i/bin/anvillm start # Cleanup on stop -ExecStopPost=/bin/rm -f /tmp/anvilsrv.pid +ExecStopPost=/bin/rm -f /tmp/anvillm.pid ExecStopPost=/bin/rm -f /tmp/ns.%i/agent # Restart policy diff --git a/services/systemd/anvilsrv@.service b/services/systemd/anvillm@.service similarity index 82% rename from services/systemd/anvilsrv@.service rename to services/systemd/anvillm@.service index 43dff83..9766703 100644 --- a/services/systemd/anvilsrv@.service +++ b/services/systemd/anvillm@.service @@ -13,11 +13,11 @@ WorkingDirectory=/home/%i Environment="PATH=/home/%i/bin:/usr/local/bin:/usr/bin:/bin" Environment="HOME=/home/%i" -# Start anvilsrv -ExecStart=/home/%i/bin/anvilsrv start +# Start anvillm +ExecStart=/home/%i/bin/anvillm start # Cleanup on stop -ExecStopPost=/bin/rm -f /tmp/anvilsrv.pid +ExecStopPost=/bin/rm -f /tmp/anvillm.pid # Restart policy Restart=on-failure diff --git a/services/sysvinit/README.md b/services/sysvinit/README.md index 62e80d5..a1a91d0 100644 --- a/services/sysvinit/README.md +++ b/services/sysvinit/README.md @@ -4,79 +4,79 @@ SysV init scripts for AnviLLM services, in two flavours: | File | Style | Install at | |------|-------|-----------| -| `anvilsrv` | Generic SysV + LSB INIT INFO header | `/etc/init.d/anvilsrv` | -| `rc.anvilsrv` | Slackware rc | `/etc/rc.d/rc.anvilsrv` | +| `anvillm` | Generic SysV + LSB INIT INFO header | `/etc/init.d/anvillm` | +| `rc.anvillm` | Slackware rc | `/etc/rc.d/rc.anvillm` | | `anvillm-inbox-notify` | Generic SysV + LSB INIT INFO header | `/etc/init.d/anvillm-inbox-notify` | | `rc.anvillm-inbox-notify` | Slackware rc | `/etc/rc.d/rc.anvillm-inbox-notify` | --- -## anvilsrv — AnviLLM backend server +## anvillm — AnviLLM backend server -`anvilsrv` is the core backend daemon. It exposes the `anvillm/` 9P filesystem +`anvillm` is the core backend daemon. It exposes the `anvillm/` 9P filesystem used by Claude Code sessions, bots, the beads task store, and the event bus. -The binary (`~/bin/anvilsrv`) handles daemonization, PID file management, and -a `status` subcommand itself, so these init scripts delegate to `anvilsrv -start`, `anvilsrv stop`, and `anvilsrv status` rather than doing their own -process tracking. The PID file lives at `$NAMESPACE/anvilsrv.pid`. +The binary (`~/bin/anvillm`) handles daemonization, PID file management, and +a `status` subcommand itself, so these init scripts delegate to `anvillm +start`, `anvillm stop`, and `anvillm status` rather than doing their own +process tracking. The PID file lives at `$NAMESPACE/anvillm.pid`. -### Generic SysV (`/etc/init.d/anvilsrv`) +### Generic SysV (`/etc/init.d/anvillm`) ```sh # Install -sudo install -m 755 services/sysvinit/anvilsrv /etc/init.d/ +sudo install -m 755 services/sysvinit/anvillm /etc/init.d/ # Configure — set the user to run as -sudo sh -c 'echo "ANVILSRV_USER=yourlogin" > /etc/default/anvilsrv' +sudo sh -c 'echo "ANVILSRV_USER=yourlogin" > /etc/default/anvillm' # Optionally override NAMESPACE (defaults to /tmp/ns.$ANVILSRV_USER): -# echo "NAMESPACE=/tmp/ns.yourlogin.:0" >> /etc/default/anvilsrv +# echo "NAMESPACE=/tmp/ns.yourlogin.:0" >> /etc/default/anvillm # Register with the init system -sudo update-rc.d anvilsrv defaults # Debian / Ubuntu +sudo update-rc.d anvillm defaults # Debian / Ubuntu # -or- -sudo chkconfig --add anvilsrv # Red Hat / CentOS +sudo chkconfig --add anvillm # Red Hat / CentOS # Manage -sudo service anvilsrv start -sudo service anvilsrv stop -sudo service anvilsrv restart -sudo service anvilsrv status +sudo service anvillm start +sudo service anvillm stop +sudo service anvillm restart +sudo service anvillm status ``` -### Slackware (`/etc/rc.d/rc.anvilsrv`) +### Slackware (`/etc/rc.d/rc.anvillm`) ```sh # Install binary (built from source or downloaded) -install -m 755 /path/to/anvilsrv /home/yourlogin/bin/ +install -m 755 /path/to/anvillm /home/yourlogin/bin/ # Install rc script -install -m 755 services/sysvinit/rc.anvilsrv /etc/rc.d/ +install -m 755 services/sysvinit/rc.anvillm /etc/rc.d/ # Set the user — edit ANVILSRV_USER= at the top of the script, or pass it: -ANVILSRV_USER=yourlogin /etc/rc.d/rc.anvilsrv start +ANVILSRV_USER=yourlogin /etc/rc.d/rc.anvillm start ``` Enable/disable (Slackware convention): ```sh -chmod 755 /etc/rc.d/rc.anvilsrv # enable -chmod 644 /etc/rc.d/rc.anvilsrv # disable +chmod 755 /etc/rc.d/rc.anvillm # enable +chmod 644 /etc/rc.d/rc.anvillm # disable ``` Add to `/etc/rc.d/rc.local` to start at boot: ```sh -if [ -x /etc/rc.d/rc.anvilsrv ]; then - /etc/rc.d/rc.anvilsrv start +if [ -x /etc/rc.d/rc.anvillm ]; then + /etc/rc.d/rc.anvillm start fi ``` Add to `/etc/rc.d/rc.local_shutdown` to stop cleanly: ```sh -if [ -x /etc/rc.d/rc.anvilsrv ]; then - /etc/rc.d/rc.anvilsrv stop +if [ -x /etc/rc.d/rc.anvillm ]; then + /etc/rc.d/rc.anvillm stop fi ``` @@ -128,7 +128,7 @@ install -m 755 services/sysvinit/rc.anvillm-inbox-notify /etc/rc.d/ ANVILLM_USER=yourlogin /etc/rc.d/rc.anvillm-inbox-notify start ``` -Enable/disable and rc.local hooks follow the same pattern as rc.anvilsrv above. +Enable/disable and rc.local hooks follow the same pattern as rc.anvillm above. --- diff --git a/services/sysvinit/anvilsrv b/services/sysvinit/anvillm similarity index 85% rename from services/sysvinit/anvilsrv rename to services/sysvinit/anvillm index 8669582..eacd999 100755 --- a/services/sysvinit/anvilsrv +++ b/services/sysvinit/anvillm @@ -1,6 +1,6 @@ #!/bin/sh ### BEGIN INIT INFO -# Provides: anvilsrv +# Provides: anvillm # Required-Start: $local_fs $syslog # Required-Stop: $local_fs $syslog # Should-Start: $network @@ -8,7 +8,7 @@ # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: AnviLLM backend server -# Description: anvilsrv is the AnviLLM backend server daemon. It exposes +# Description: anvillm is the AnviLLM backend server daemon. It exposes # a 9P filesystem (anvillm/) that Claude Code sessions and bots # use for session management, mailbox communication, beads # task tracking, and the event bus. @@ -17,23 +17,23 @@ # ── configuration ───────────────────────────────────────────────────────────── # # ANVILSRV_USER Login name of the user whose AnviLLM instance to manage. -# The anvilsrv binary is expected at ~/bin/anvilsrv. +# The anvillm binary is expected at ~/bin/anvillm. # # NAMESPACE 9P namespace directory. Defaults to /tmp/ns.$ANVILSRV_USER # matching the Plan 9 client.Namespace() convention. -# The PID file lives at $NAMESPACE/anvilsrv.pid. +# The PID file lives at $NAMESPACE/anvillm.pid. # -# Override in /etc/default/anvilsrv (sourced below if it exists). +# Override in /etc/default/anvillm (sourced below if it exists). # ANVILSRV_USER="${ANVILSRV_USER:-}" NAMESPACE="${NAMESPACE:-}" # Source distro defaults (if any). -[ -r /etc/default/anvilsrv ] && . /etc/default/anvilsrv +[ -r /etc/default/anvillm ] && . /etc/default/anvillm # ── derived paths ───────────────────────────────────────────────────────────── -NAME="anvilsrv" +NAME="anvillm" # Resolve NAMESPACE after potentially sourcing defaults. if [ -z "$NAMESPACE" ] && [ -n "$ANVILSRV_USER" ]; then @@ -44,12 +44,12 @@ fi if [ -z "$ANVILSRV_USER" ]; then echo "${NAME}: ANVILSRV_USER is not set." >&2 - echo " Set it in /etc/default/anvilsrv:" >&2 + echo " Set it in /etc/default/anvillm:" >&2 echo " ANVILSRV_USER=yourlogin" >&2 exit 6 # LSB: program not configured fi -DAEMON="/home/${ANVILSRV_USER}/bin/anvilsrv" +DAEMON="/home/${ANVILSRV_USER}/bin/anvillm" if [ ! -x "$DAEMON" ]; then echo "${NAME}: daemon not found at ${DAEMON}" >&2 @@ -59,7 +59,7 @@ fi # ── actions ─────────────────────────────────────────────────────────────────── do_start() { - # anvilsrv start exits non-zero if already running. + # anvillm start exits non-zero if already running. # Let it decide — delegate fully. echo "Starting ${NAME} (user=${ANVILSRV_USER}, namespace=${NAMESPACE})..." @@ -107,11 +107,11 @@ do_status() { '${DAEMON}' status " local rc=$? - # Map anvilsrv exit codes to LSB status codes. - # anvilsrv status exits 0 if running, non-zero otherwise. + # Map anvillm exit codes to LSB status codes. + # anvillm status exits 0 if running, non-zero otherwise. # We also check for a stale PID file. if [ $rc -ne 0 ]; then - local pidfile="${NAMESPACE}/anvilsrv.pid" + local pidfile="${NAMESPACE}/anvillm.pid" if [ -s "$pidfile" ]; then return 1 # LSB: dead, pidfile exists fi @@ -135,7 +135,7 @@ case "$1" in do_start ;; reload) - # anvilsrv does not support live config reload. + # anvillm does not support live config reload. echo "${NAME}: reload not supported — use restart." >&2 exit 3 # LSB: unimplemented feature ;; diff --git a/services/sysvinit/rc.anvilsrv b/services/sysvinit/rc.anvillm similarity index 60% rename from services/sysvinit/rc.anvilsrv rename to services/sysvinit/rc.anvillm index 90d426e..0972d80 100755 --- a/services/sysvinit/rc.anvilsrv +++ b/services/sysvinit/rc.anvillm @@ -1,34 +1,34 @@ #!/bin/sh -# /etc/rc.d/rc.anvilsrv +# /etc/rc.d/rc.anvillm # -# Start/stop/restart the AnviLLM backend server (anvilsrv). +# Start/stop/restart the AnviLLM backend server (anvillm). # -# anvilsrv exposes a 9P filesystem (anvillm/) used by Claude Code sessions and +# anvillm exposes a 9P filesystem (anvillm/) used by Claude Code sessions and # bots for session management, mailbox communication, beads task tracking, and # the event bus. # # This script follows Slackware rc conventions: -# - Enable service: chmod 755 /etc/rc.d/rc.anvilsrv -# - Disable service: chmod 644 /etc/rc.d/rc.anvilsrv +# - Enable service: chmod 755 /etc/rc.d/rc.anvillm +# - Disable service: chmod 644 /etc/rc.d/rc.anvillm # # To start automatically at boot, add to /etc/rc.d/rc.local: -# if [ -x /etc/rc.d/rc.anvilsrv ]; then -# /etc/rc.d/rc.anvilsrv start +# if [ -x /etc/rc.d/rc.anvillm ]; then +# /etc/rc.d/rc.anvillm start # fi # # To stop cleanly at shutdown, add to /etc/rc.d/rc.local_shutdown: -# if [ -x /etc/rc.d/rc.anvilsrv ]; then -# /etc/rc.d/rc.anvilsrv stop +# if [ -x /etc/rc.d/rc.anvillm ]; then +# /etc/rc.d/rc.anvillm stop # fi # # ── configuration ───────────────────────────────────────────────────────────── # # ANVILSRV_USER Login name of the user whose AnviLLM instance to manage. -# The anvilsrv binary is expected at ~/bin/anvilsrv. +# The anvillm binary is expected at ~/bin/anvillm. # # NAMESPACE 9P namespace directory. Defaults to /tmp/ns.$ANVILSRV_USER # matching the Plan 9 client.Namespace() convention used by -# anvilsrv. The PID file lives at $NAMESPACE/anvilsrv.pid. +# anvillm. The PID file lives at $NAMESPACE/anvillm.pid. # ANVILSRV_USER="${ANVILSRV_USER:-}" NAMESPACE="${NAMESPACE:-}" @@ -39,11 +39,11 @@ if [ -z "$NAMESPACE" ] && [ -n "$ANVILSRV_USER" ]; then NAMESPACE="/tmp/ns.${ANVILSRV_USER}" fi -DAEMON="/home/${ANVILSRV_USER}/bin/anvilsrv" +DAEMON="/home/${ANVILSRV_USER}/bin/anvillm" # ── helpers ─────────────────────────────────────────────────────────────────── -anvilsrv_env() { +anvillm_env() { # Print the environment preamble used in every su invocation. printf "export NAMESPACE='%s'; export HOME='/home/%s'; export PATH='/home/%s/bin:/usr/local/bin:/usr/bin:/bin'" \ "$NAMESPACE" "$ANVILSRV_USER" "$ANVILSRV_USER" @@ -51,65 +51,65 @@ anvilsrv_env() { check_config() { if [ -z "$ANVILSRV_USER" ]; then - echo "rc.anvilsrv: ANVILSRV_USER is not set — edit this script or set the variable." >&2 + echo "rc.anvillm: ANVILSRV_USER is not set — edit this script or set the variable." >&2 return 1 fi if [ ! -x "$DAEMON" ]; then - echo "rc.anvilsrv: ${DAEMON} not found or not executable." >&2 + echo "rc.anvillm: ${DAEMON} not found or not executable." >&2 return 1 fi return 0 } -anvilsrv_start() { +anvillm_start() { check_config || return - echo "Starting anvilsrv (user=${ANVILSRV_USER}, namespace=${NAMESPACE})..." + echo "Starting anvillm (user=${ANVILSRV_USER}, namespace=${NAMESPACE})..." mkdir -p "$NAMESPACE" chown "$ANVILSRV_USER" "$NAMESPACE" 2>/dev/null - # anvilsrv start daemonizes itself and writes its own PID file at - # $NAMESPACE/anvilsrv.pid. It also detects if it is already running and + # anvillm start daemonizes itself and writes its own PID file at + # $NAMESPACE/anvillm.pid. It also detects if it is already running and # exits with an error in that case — no extra guard needed here. - su -s /bin/sh -l "$ANVILSRV_USER" -c "$(anvilsrv_env); '${DAEMON}' start" + su -s /bin/sh -l "$ANVILSRV_USER" -c "$(anvillm_env); '${DAEMON}' start" } -anvilsrv_stop() { +anvillm_stop() { check_config || return - echo "Stopping anvilsrv (user=${ANVILSRV_USER})..." - su -s /bin/sh -l "$ANVILSRV_USER" -c "$(anvilsrv_env); '${DAEMON}' stop" + echo "Stopping anvillm (user=${ANVILSRV_USER})..." + su -s /bin/sh -l "$ANVILSRV_USER" -c "$(anvillm_env); '${DAEMON}' stop" - # Remove the 9P socket left behind by anvilsrv. + # Remove the 9P socket left behind by anvillm. rm -f "${NAMESPACE}/agent" 2>/dev/null } -anvilsrv_restart() { - anvilsrv_stop +anvillm_restart() { + anvillm_stop sleep 1 - anvilsrv_start + anvillm_start } -anvilsrv_status() { +anvillm_status() { check_config || return - su -s /bin/sh -l "$ANVILSRV_USER" -c "$(anvilsrv_env); '${DAEMON}' status" + su -s /bin/sh -l "$ANVILSRV_USER" -c "$(anvillm_env); '${DAEMON}' status" } # ── dispatch ────────────────────────────────────────────────────────────────── case "$1" in start) - anvilsrv_start + anvillm_start ;; stop) - anvilsrv_stop + anvillm_stop ;; restart) - anvilsrv_restart + anvillm_restart ;; status) - anvilsrv_status + anvillm_status ;; *) echo "Usage: $0 {start|stop|restart|status}"