ollie/data/scripts/README.md

2.8 KiB

scripts

Shell scripts for interacting with the ollie 9P filesystem. All scripts read OLLIE (default: $HOME/mnt/ollie) for the mount path.

mk scripts installs them and exposes them via the mounted filesystem, so they are available without any $PATH changes:

$OLLIE/s/ls                   # list sessions
$OLLIE/s/kill <id>            # kill a session
$OLLIE/s/cleanup              # remove all idle sessions

For one-shot generation, code completion, and routing, use ollie-9p rdwr with the corresponding file:

echo 'summarize this repo' | ollie-9p rdwr generate
echo '{"file":"main.go","prefix":"func ","suffix":""}' | ollie-9p rdwr complete
echo 'implement login page' | ollie-9p rdwr route

Scripts are organized by the filesystem namespace they are hosted under:

  • s/ — session management

s/ls

List all active sessions.

s/ls

s/kill

Kill a session by ID and remove it.

s/kill <id>

s/cleanup

Remove all idle sessions.

s/cleanup

x/elevate

Sandbox escape hatch invoked by shell when a command is marked elevated: true. The Landlock sandbox is enforced at the kernel level — restrictions apply regardless of user privileges within the sandboxed process. x/elevate is a generic client that forwards the command to an adapter running outside the sandbox, which executes it and returns the result.

x/elevate knows nothing about the backend. It connects to the socket at OLLIE_ELEVATE_SOCKET, sends {cmd, cwd}, and reads back {stdout, stderr, exit_code}. The adapter on the other end is backend-specific. Multiple adapters can coexist at different socket paths; switching backends is a single env var change.

Set OLLIE_ELEVATE_SOCKET in ~/.config/ollie/env. The default is $XDG_RUNTIME_DIR/ollie/elevate.sock (falling back to /run/user/<uid>/ollie/elevate.sock), so this only needs to be set when using a non-default path:

OLLIE_ELEVATE_SOCKET=${XDG_RUNTIME_DIR}/ollie/elevate.sock

Protocol

x/elevate sends a newline-terminated JSON object and reads a JSON response:

→  {"cmd": "<shell command>", "cwd": "<working directory>"}\n
←  {"stdout": "...", "stderr": "...", "exit_code": 0}

Any process that listens on a Unix stream socket and speaks this protocol is a valid adapter.

Integrated elevation broker

As of 2026-07, elevation is handled by olliesrv's integrated broker (core/pkg/elevate). The broker listens on $OLLIE_ELEVATE_SOCKET and handles command execution with human-in-the-loop approval via desktop notifications. No external adapter or daemon is required.

Disabling elevation

Replace x/elevate with a script that exits non-zero. Steps marked elevated: true will fail rather than escape the sandbox:

#!/bin/sh
echo "elevation disabled" >&2
exit 1