From fd27166c122d006decca80b15fde43d4b5bd0560 Mon Sep 17 00:00:00 2001 From: Ollie Agent Date: Sat, 25 Jul 2026 18:20:26 +0200 Subject: [PATCH] ollie: remove daemon subcommands, centralize service file management MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit olliesrv no longer has start/fgstart/stop/status subcommands — it runs in the foreground and relies on the supervisor (systemd, openrc, or xdg-autostart) for lifecycle management. This simplifies the binary and makes the single-process model explicit. Changes: - All docs: olliesrv start → olliesrv - justfile: add install-services target, used by all install recipes; installs systemd user unit, openrc init script, xdg autostart entry; remove inline autostart installs from individual targets - systemd unit: ExecStart drops "start" subcommand - openrc init script: deleted (was for daemonized start; now managed via install-services) - xdg-autostart: new desktop entry (moved from 9p/ submodule), Exec=olliesrv (no longer shells out to start + remount) - contrib/ollie-remount: add debug echo for namespace/socket - 9p submodule: remove daemon subcommands from Go code; delete old desktop file - el submodule: update README for foreground-only olliesrv --- 9p | 2 +- README.md | 4 +-- contrib/ollie-remount | 3 ++ doc/USAGE.md | 16 ++++------ doc/help.md | 2 +- el | 2 +- justfile | 32 +++++++++++++------ services/openrc/ollie.initd | 23 ------------- services/systemd/ollie.service | 2 +- .../xdg-autostart/org.ollie.olliesrv.desktop | 11 +++++++ 10 files changed, 50 insertions(+), 47 deletions(-) delete mode 100644 services/openrc/ollie.initd create mode 100644 services/xdg-autostart/org.ollie.olliesrv.desktop diff --git a/9p b/9p index af7363c..cbd249e 160000 --- a/9p +++ b/9p @@ -1 +1 @@ -Subproject commit af7363cb1dd2d4e5c37ac03296079eb9f0a01451 +Subproject commit cbd249e5f9eaed03b2b16aa193990d8356280f85 diff --git a/README.md b/README.md index 73608b1..8126493 100644 --- a/README.md +++ b/README.md @@ -246,8 +246,8 @@ The 9P server embeds the core library directly — no display server, no desktop The embedded D-Bus adapter is automatically disabled when using `-tcp` (remote listen mode). You can also disable it explicitly with `-nodbus`: ```sh -olliesrv start -tcp :5640 # TCP listener, no D-Bus (implied) -olliesrv start -nodbus # Unix socket only, no D-Bus +olliesrv -tcp :5640 # TCP listener, no D-Bus (implied) +olliesrv -nodbus # Unix socket only, no D-Bus ``` ### Shell composability diff --git a/contrib/ollie-remount b/contrib/ollie-remount index 69623ca..6bf90b2 100755 --- a/contrib/ollie-remount +++ b/contrib/ollie-remount @@ -8,5 +8,8 @@ OLLIE="${OLLIE:-$HOME/mnt/ollie}" NAMESPACE="${NAMESPACE:-/tmp/ns.$(id -un).$(echo "${DISPLAY:-:0}" | tr / _)}" SOCK="$NAMESPACE/ollie" +echo $NAMESPACE +echo $SOCK + sudo umount -f "$OLLIE" 2>/dev/null || true 9pfuse "$SOCK" "$OLLIE" diff --git a/doc/USAGE.md b/doc/USAGE.md index 57e147c..240f3b5 100644 --- a/doc/USAGE.md +++ b/doc/USAGE.md @@ -5,16 +5,14 @@ ### Start and stop ```sh -olliesrv start # start in background (daemonizes) -olliesrv fgstart # start in foreground -olliesrv stop # stop the daemon -olliesrv status # check if running +olliesrv # start the server (foreground) +# Stop by sending SIGTERM or via the supervisor (e.g. rc-service ollie stop) ``` By default the server mounts at `$HOME/mnt/ollie`. Override with `-mount`: ```sh -olliesrv start -mount /tmp/ollie +olliesrv -mount /tmp/ollie ``` ### TCP listener @@ -22,7 +20,7 @@ olliesrv start -mount /tmp/ollie To also accept connections over TCP (e.g. for remote access): ```sh -olliesrv start -tcp :9564 +olliesrv -tcp :9564 ``` ### Debug logging @@ -30,7 +28,7 @@ olliesrv start -tcp :9564 Log level is controlled by `OLLIE_LOG` (default: `warn`). Set to `debug` for verbose output: ```sh -OLLIE_LOG=debug olliesrv fgstart +OLLIE_LOG=debug olliesrv ``` Valid levels: `debug`, `info`, `warn`, `error`. Per-subsystem overrides follow the pattern @@ -542,8 +540,8 @@ ollie-httpgw -net tcp -addr host:9564 # connect to remote olliesrv over TCP | `-addr` | `` | 9P server address; required when `-net` is set | The gateway must be able to reach `olliesrv`. For a local server started with -`olliesrv start`, the defaults work as-is. For a remote server started with -`olliesrv start -tcp :9564`, use `-net tcp -addr remotehost:9564`. +`olliesrv`, the defaults work as-is. For a remote server started with +`olliesrv -tcp :9564`, use `-net tcp -addr remotehost:9564`. ### HTTP → 9P mapping diff --git a/doc/help.md b/doc/help.md index 31fed48..5f295ab 100644 --- a/doc/help.md +++ b/doc/help.md @@ -5,7 +5,7 @@ An AI agent exposed as a filesystem. Mount it, then use shell tools. ## Quick start ```sh -olliesrv start # start the 9P server +olliesrv # start the 9P server echo "cwd=$PWD" > ~/mnt/ollie/s/new # create a session ls ~/mnt/ollie/s/ # find the session ID echo "hello" > ~/mnt/ollie/s//prompt # send a prompt diff --git a/el b/el index 895da7c..4f7a22c 160000 --- a/el +++ b/el @@ -1 +1 @@ -Subproject commit 895da7cb778c0bf141b4ae4580f5de6a676350c8 +Subproject commit 4f7a22c29a0911fac80ede52be67f5980c9be87b diff --git a/justfile b/justfile index 583f7a5..a9cc2f8 100644 --- a/justfile +++ b/justfile @@ -82,29 +82,25 @@ kde-kf5: # === Install targets === -install-9p: test install-data install-scripts install-contrib install-kde install-el +install-9p: test install-data install-scripts install-contrib install-kde install-el install-services install -m644 prompts/SYSTEM_PROMPT.md {{cfg}}/prompts/SYSTEM_PROMPT.md install -m644 prompts/session-9p.md {{cfg}}/prompts/session.md - mkdir -p ~/.config/autostart - install -m644 9p/org.ollie.olliesrv.desktop ~/.config/autostart/ @echo === Install complete \(9P\) === @echo 'Restart Plasma to pick up KDE plugins.' -install-dbus: test install-data install-scripts install-contrib install-dbus-bin install-kde +install-dbus: test install-data install-scripts install-contrib install-dbus-bin install-kde install-services install -m644 prompts/SYSTEM_PROMPT.md {{cfg}}/prompts/SYSTEM_PROMPT.md install -m644 prompts/session-dbus.md {{cfg}}/prompts/session.md @echo === Install complete \(D-Bus\) === @echo 'Restart Plasma to pick up KDE plugins.' -install-ninep-kf5: test install-data install-scripts install-contrib install-kde-kf5 install-el +install-ninep-kf5: test install-data install-scripts install-contrib install-kde-kf5 install-el install-services install -m644 prompts/SYSTEM_PROMPT.md {{cfg}}/prompts/SYSTEM_PROMPT.md install -m644 prompts/session-9p.md {{cfg}}/prompts/session.md - mkdir -p ~/.config/autostart - install -m644 9p/org.ollie.olliesrv.desktop ~/.config/autostart/ @echo === Install complete \(9P + KF5\) === @echo 'Restart Plasma to pick up KDE plugins.' -install-dbus-kf5: test install-data install-scripts install-contrib install-dbus-bin install-kde-kf5 +install-dbus-kf5: test install-data install-scripts install-contrib install-dbus-bin install-kde-kf5 install-services install -m644 prompts/SYSTEM_PROMPT.md {{cfg}}/prompts/SYSTEM_PROMPT.md install -m644 prompts/session-dbus.md {{cfg}}/prompts/session.md @echo === Install complete \(D-Bus + KF5\) === @@ -284,6 +280,18 @@ install-scripts: install -m755 scripts/x/prime {{cfg}}/scripts/x/prime install -m755 scripts/x/freeloader {{cfg}}/scripts/x/freeloader +install-services: + @echo === Installing service files === + # systemd (user) + mkdir -p ~/.config/systemd/user + install -m644 services/systemd/ollie.service ~/.config/systemd/user/ + # openrc (user) + mkdir -p ~/.config/rc/init.d + install -m755 services/openrc/ollie.initd ~/.config/rc/init.d/ollie + # xdg autostart (fallback when no supervisor) + mkdir -p ~/.config/autostart + install -m644 services/xdg-autostart/org.ollie.olliesrv.desktop ~/.config/autostart/ + install-contrib: @echo === Installing contrib scripts === mkdir -p {{bin}} @@ -299,11 +307,14 @@ uninstall: rm -f {{bin}}/Ollie {{bin}}/Kmpl {{bin}}/Oi {{bin}}/Theo rm -f {{bin}}/ollie-remount {{bin}}/ollie-watchdog rm -rf {{cfg}} - rm -f ~/.config/autostart/org.ollie.olliesrv.desktop # D-Bus daemon pkill -u "$(id -u)" -x ollied 2>/dev/null; true rm -f ~/.local/bin/ollied rm -f ~/.config/autostart/org.ollie.SessionManager.desktop + # Service files + rm -f ~/.config/systemd/user/ollie.service + rm -f ~/.config/rc/init.d/ollie + rm -f ~/.config/autostart/org.ollie.olliesrv.desktop # KDE rm -f ~/.local/bin/ollie-tray ~/.local/bin/ollie-gui rm -f ~/.local/bin/ollie-ask ~/.local/bin/ollie-session-here @@ -328,6 +339,9 @@ uninstall-ninep-kf5: rm -f {{bin}}/Ollie {{bin}}/Kmpl {{bin}}/Oi {{bin}}/Theo rm -f {{bin}}/ollie-remount {{bin}}/ollie-watchdog rm -rf {{cfg}} + # Service files + rm -f ~/.config/systemd/user/ollie.service + rm -f ~/.config/rc/init.d/ollie rm -f ~/.config/autostart/org.ollie.olliesrv.desktop # KDE (KF5) rm -f ~/.local/bin/ollie-tray ~/.local/bin/ollie-gui diff --git a/services/openrc/ollie.initd b/services/openrc/ollie.initd deleted file mode 100644 index 6b3edb6..0000000 --- a/services/openrc/ollie.initd +++ /dev/null @@ -1,23 +0,0 @@ -#!/sbin/openrc-run - -description="Ollie server daemon (olliesrv)" - -supervisor=supervise-daemon - -command="${HOME}/bin/olliesrv" -command_args="start" - -output_log="${XDG_RUNTIME_DIR}/ollie/olliesrv.log" -error_log="${XDG_RUNTIME_DIR}/ollie/olliesrv.log" - -respawn_delay=3 -respawn_max=10 -respawn_period=60 - -depend() { - need dbus -} - -start_pre() { - checkpath -o $USER -d "${XDG_RUNTIME_DIR}/ollie" -} diff --git a/services/systemd/ollie.service b/services/systemd/ollie.service index f4cdeed..fa1173f 100644 --- a/services/systemd/ollie.service +++ b/services/systemd/ollie.service @@ -5,7 +5,7 @@ Requires=dbus.service [Service] Type=simple -ExecStart=%h/bin/olliesrv start +ExecStart=%h/bin/olliesrv Restart=on-failure RestartSec=3 Environment=XDG_RUNTIME_DIR=/run/user/%U diff --git a/services/xdg-autostart/org.ollie.olliesrv.desktop b/services/xdg-autostart/org.ollie.olliesrv.desktop new file mode 100644 index 0000000..123deb0 --- /dev/null +++ b/services/xdg-autostart/org.ollie.olliesrv.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Type=Application +Name=Ollie Server +GenericName=AI Agent 9P Server +Comment=9P server for Ollie AI agent sessions (includes embedded D-Bus adapter) +Exec=olliesrv +Icon=ollie +Terminal=false +Categories=Utility; +X-DBUS-StartupType=unique +X-DBUS-ServiceName=org.ollie.SessionManager