harness

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package harness defines the public execution seam for runner adapters.

Index

Constants

This section is empty.

Variables

View Source
var WellKnownBinDirs = []string{
	"~/.local/bin",
	"~/bin",
	"/usr/local/bin",
	"/opt/homebrew/bin",
	"/opt/local/bin",
	"/usr/bin",
	"/bin",
	"/snap/bin",
	"~/.npm-global/bin",
	"~/.bun/bin",
	"~/.volta/bin",
	"~/.asdf/shims",
	"~/.nvm/current/bin",
	"~/node_modules/.bin",
}

WellKnownBinDirs are the directories a coding agent is commonly installed into, searched in this order when PATH does not already resolve it.

A managed runner is started by the Edge agent under a service account whose PATH is whatever the init system gave it — usually /usr/bin:/bin, never the interactive shell's. An operator who installed Claude Code or Codex the normal way (a per-user install under ~/.local/bin, Homebrew on macOS, a global npm prefix) then sees only `exec: "claude": executable file not found in $PATH`, with nothing on the machine actually missing. Looking in these places costs one stat each and turns that into a working runner.

Entries beginning with "~/" are expanded against the RUNNER's home, which is the account the harness process itself runs as.

Functions

func ResolveBinary added in v0.2.7

func ResolveBinary(name string) string

ResolveBinary returns the path the harness should execute for name.

It prefers what the environment already resolves, so an operator who set an explicit path or a working PATH keeps exactly what they configured. Only when that fails does it search WellKnownBinDirs. A name that is already a path is returned untouched, and a name found nowhere is returned untouched too: the caller's own "not found in $PATH" error is the clearest thing a reader can act on, and inventing a path would only move the failure.

Types

type Adapter

type Adapter interface {
	Probe(context.Context) (Info, error)
	Run(context.Context, Launch, Emit) (Result, error)
}

Adapter probes its executable and runs one isolated agent turn.

type Clarification

type Clarification struct {
	ID   string `json:"id"`
	Text string `json:"text"`
}

Clarification is a bounded product question that can be answered by a caller before resuming the existing harness session.

type Emit

type Emit func(Event) error

Emit receives adapter events. Implementations must treat an error as a terminal failure and stop producing events for the launch.

type Event

type Event struct {
	Type          string          `json:"type"`
	SessionID     string          `json:"sessionID,omitempty"`
	TurnID        string          `json:"turnID,omitempty"`
	Message       string          `json:"message,omitempty"`
	Data          json.RawMessage `json:"data,omitempty"`
	Clarification *Clarification  `json:"clarification,omitempty"`
}

Event is a bounded adapter event forwarded to the runner state engine.

type Info

type Info struct {
	Name    string   `json:"name"`
	Version string   `json:"version"`
	Ready   bool     `json:"ready"`
	Reasons []string `json:"reasons,omitempty"`
}

Info describes an adapter's executable and readiness state.

type Launch

type Launch struct {
	AttemptID    string `json:"attemptID"`
	Workdir      string `json:"workdir"`
	SessionID    string `json:"sessionID,omitempty"`
	Instructions string `json:"instructions"`
	Model        string `json:"model,omitempty"`
}

Launch identifies one worker attempt and the thread turn it should execute.

type Result

type Result struct {
	Phase         string         `json:"phase"`
	SessionID     string         `json:"sessionID,omitempty"`
	Blocker       string         `json:"blocker,omitempty"`
	Clarification *Clarification `json:"clarification,omitempty"`
}

Result is the terminal state of one adapter launch.

Directories

Path Synopsis
Package claude adapts headless Claude Code to the runner harness.
Package claude adapts headless Claude Code to the runner harness.
Package codex adapts the Codex app-server protocol to the runner harness.
Package codex adapts the Codex app-server protocol to the runner harness.
internal
proc
Package proc holds the process-group primitives every harness adapter needs.
Package proc holds the process-group primitives every harness adapter needs.

Jump to

Keyboard shortcuts

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