Documentation
¶
Overview ¶
Package omp finds the omp (oh-my-pi) agents running on the machine and what they are doing, from what is on disk: the omp processes (their working directory, and for an agent beekeeper started its environment) and the session files omp writes under ~/.omp/agent/sessions, one JSON line per entry: a title line (rewritten in place), the session header (id, cwd), model changes, and messages of the roles user, assistant and toolResult.
omp keeps no record of which process runs which session file and holds none open: a process runs the session file of its working directory that it created (the header's time is the first one at or after its start), else the one written last since it started (a resumed session).
Index ¶
- Constants
- Variables
- func Discover(sessionsDir string, t *proc.Table, now time.Time) []*claude.Session
- func Ended(sessionsDir string, running []*claude.Session, since time.Time) []*claude.Session
- func Follow(path string, n int) ([]claude.Turn, error)
- func InboxPath(stateDir, id string) string
- func MakeInbox(path string) error
- func ReadTranscript(path string, now time.Time) (claude.Work, claude.Activity)
- func RemoveInbox(path string) (removed bool, err error)
- func Send(path, msg string) error
- func ShellArgv(path string, argv ...string) []string
- func Tail(path string, n int) ([]claude.Turn, error)
Constants ¶
const ( EnvAgent = "BEEKEEPER_OMP_AGENT" EnvName = "BEEKEEPER_AGENT_NAME" )
The environment beekeeper starts an omp agent with: its start id and its roster name, which no session file carries.
const ( StateBusy = "busy" StateIdle = "idle" StateEnded = "ended" )
The session states: busy while a turn runs, idle while it waits for a message, ended when no process runs the session.
const Comm = "omp"
Comm is the omp binary's process name.
const Harness = "omp"
Harness is the harness name omp sessions carry (claude.Session.Harness).
const HostPrefix = "omp_"
HostPrefix makes a start id the agent's host session id on the roster: omp_<start id>.
Variables ¶
var ErrNotRunning = errors.New("no omp process reads its inbox")
ErrNotRunning is a message to an agent whose inbox no process reads.
Functions ¶
func Discover ¶
Discover returns the running omp sessions, newest first. A session's process may not have written its session file yet (omp creates it with the first message): it is listed without a transcript. A process that another omp process started (a subagent) belongs to that session.
func Ended ¶
Ended returns the omp sessions written to since since that no running session runs, most recently active first.
func Follow ¶ added in v0.61.0
Follow is Tail with the agent's tool calls among the turns, as claude.Follow returns them.
func ReadTranscript ¶
ReadTranscript reads an omp session file's window for the issues and repositories it is about and its activity: turns (the person's messages), tool calls and failed ones, tokens and cost as omp counted them, and the context its last reply had.
func RemoveInbox ¶ added in v0.60.0
RemoveInbox removes the inbox at path and its lock file; removed is false when there was none. A process that still reads the inbox keeps its open end, but no message reaches it any more.
func Send ¶
Send writes msg to the inbox at path as one steer command. It never blocks on an inbox no process reads: that refuses it (ErrNotRunning). Writes are serialized by a lock file beside the inbox (macOS locks no FIFO), so two senders' lines never interleave, whatever their length.
func ShellArgv ¶
ShellArgv runs argv, omp's command line, with its stdin on the inbox at path: opened for reading and writing, so the inbox never reaches its end while the agent runs, whoever writes to it. omp's protocol output goes nowhere; its log is omp's own (~/.omp/logs) and the unit's journal keeps its errors.
Types ¶
This section is empty.