api

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package api serves a small newline-delimited JSON protocol over a unix socket, so an agent harness can drive the environment programmatically (run commands, branch, roll back) and get structured results — including the snapshot node id produced by each command, which it can later checkout or branch from.

One JSON request per line; one JSON response per line. Example:

{"op":"exec","cmd":"apt-get install -y jq"}
-> {"ok":true,"exit":0,"stdout":"...","node":"ab12cd34ef56","head":"ab12cd34ef56"}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(ctx context.Context, r *repo.Repo, c *repo.Capturer, sockPath string) error

Serve listens on sockPath and serves requests until ctx is cancelled.

Security: the socket is created with default fs perms (~0755 after umask), which lets ANY local user connect and invoke `exec` — i.e. run arbitrary commands as whoever runs agentenv (often root). We immediately tighten it to 0600 so only the owning uid can talk to the daemon. Callers that need to share the socket across UIDs should chmod/chown it themselves AFTER Serve has started (with full awareness of the implications).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL