Managoat.Runner.Adapter (managoat_runner v0.1.0)

Copy Markdown View Source

The self-hosted runner adapter: Managoat.Sandbox implemented as RPCs to a runner daemon on a machine the user owns.

Everything runner-shaped lives here and in Managoat.Runner.Connection: the name → runner-id routing (runner-<32 hex>-<8 hex>, see Managoat.Runner.Names), the request vocabulary, and the offline/disconnected/timeout errors, all of which are {:unavailable, _} — transient in the taxonomy, so a wake retries and a parked directory on a switched-off machine is never mistaken for :not_found.

Capability notes:

  • :suspend is advertised — a suspended sandbox is a directory whose processes were stopped, which costs nothing and preserves the disk; resume/1 is a no-op probe;
  • :attach is advertised — the daemon journals every session and replays from byte zero;
  • :network_policy is not — the machine is the user's and so is its network; apply_network_policy/2 refuses rather than pretending.

Summary

Functions

Resolve a sandbox path to the real directory on the runner machine.

The runner id a sandbox name routes to.

Functions

host_path(handle, path)

@spec host_path(Managoat.Sandbox.Handle.t(), String.t()) :: String.t()

Resolve a sandbox path to the real directory on the runner machine.

/home/sprite (and paths under it) map to the sandbox directory the daemon reports; a path an agent CLI validates in band — the ACP cwd — must be that real one, not the literal /home/sprite, which does not exist on the machine. Other absolute paths (/tmp/...) are already real and pass through. Falls back to the input if the daemon cannot be reached — the spawn that follows will surface the real error.

runner_id(name)

@spec runner_id(String.t()) :: {:ok, binary()} | {:error, {:invalid, term()}}

The runner id a sandbox name routes to.