config

package
v0.1.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config reads halo.yaml (the roster) and the saved state (server, API key, address tokens).

Index

Constants

View Source
const (
	RoleLead     = "lead"
	RoleWorker   = "worker"
	RoleReviewer = "reviewer"
)

Roles of an agent.

Variables

This section is empty.

Functions

func DetectWeb

func DetectWeb(dir string) (string, bool)

DetectWeb looks for the signs of a web project in dir.

func LagrangeLogin

func LagrangeLogin() (server, key string)

LagrangeLogin reads the server and API key `lagrange login` saved ($LAGRANGE_CONFIG, or lagrange/config.json in the user's config directory). Both are empty when there is no login.

func RosterPath

func RosterPath() (string, error)

RosterPath is the global roster, next to the state: one team for every repo. HALO_ROSTER overrides it.

func StatePath

func StatePath() (string, error)

StatePath is $HALO_STATE or halo/state.json in the user's config directory.

Types

type Agent

type Agent struct {
	Name     string `yaml:"name"`
	Model    string `yaml:"model"`
	Role     string `yaml:"role"`
	Capacity int    `yaml:"capacity"`
	// ACP is this agent's coding agent command, e.g. "agy acp --process-per-session";
	// empty uses the roster's acp. Model is then whatever that agent calls its
	// models (a session option), e.g. "gemini-3.8-flash-low".
	ACP string `yaml:"acp,omitempty"`
}

Agent is one roster entry.

type Config

type Config struct {
	// Server is the Lagrange server's URL. LAGRANGE_SERVER overrides it.
	Server string `yaml:"server"`
	// Prefix starts every address handle: "halo" gives @halo-lead, @halo-sonnet-1, ...
	Prefix string `yaml:"prefix"`
	// Repo is the git repository the agents work on. Relative paths are resolved
	// against the directory of halo.yaml.
	Repo string `yaml:"repo"`
	// ACP is the coding agent command, "claude-agent-acp" by default. An agent's
	// own acp overrides it (see [Config.Command]).
	ACP string `yaml:"acp"`
	// Preview is the command that serves the project for the live preview row,
	// e.g. "npm run dev". Setting it marks the project as a web project; without
	// it Halo detects one from package.json (see [Config.PreviewCommand]).
	Preview string `yaml:"preview"`
	// Notify, when false, keeps Halo from pinging the terminal (a desktop
	// notification and a bell) when something new waits on you. On by default.
	Notify *bool `yaml:"notify,omitempty"`
	// Agents is the roster: one lead, one reviewer, any number of workers.
	Agents []Agent `yaml:"agents"`
}

Config is halo.yaml.

func Default

func Default() *Config

Default is the roster used when there is no halo.yaml.

func Load

func Load(path string) (*Config, error)

Load reads path, or returns Default if it doesn't exist.

func LoadRoster

func LoadRoster(local string) (*Config, string, error)

LoadRoster returns the roster: local if that file exists (a repo that wants its own team), else the global one, which it creates from Default on first use. The second result says where it came from.

func (*Config) Agent

func (c *Config) Agent(handle string) (Agent, bool)

Agent returns the roster entry of a handle.

func (*Config) ByRole

func (c *Config) ByRole(role string) []Agent

ByRole returns the agents with role.

func (*Config) Clone

func (c *Config) Clone() *Config

Clone returns a deep copy.

func (*Config) Command

func (c *Config) Command(a Agent) string

Command is the coding agent command an agent runs: its own acp, or the roster's.

func (*Config) Handle

func (c *Config) Handle(name string) string

Handle is the Lagrange handle of a roster name.

func (*Config) Lead

func (c *Config) Lead() Agent

Lead returns the lead.

func (*Config) Name

func (c *Config) Name(handle string) string

Name is the roster name of a handle, or the handle itself.

func (*Config) Notifies

func (c *Config) Notifies() bool

Notifies reports whether Halo pings when something waits on you.

func (*Config) PreviewCommand

func (c *Config) PreviewCommand(dir string) (string, bool)

PreviewCommand returns the command that serves the project in dir and whether it is a web project. The configured Preview wins; otherwise dir is a web project when its package.json has a dev or start script (dev preferred), or when it has an index.html or a vite/next config (then "npm run dev").

func (*Config) Reviewer

func (c *Config) Reviewer() Agent

Reviewer returns the reviewer.

func (*Config) SaveRoster

func (c *Config) SaveRoster(path string) error

SaveRoster writes the roster (prefix, coding agent and agents) to path.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the roster: one lead, one reviewer, at least one worker, and unique names that work as handles.

func (*Config) WorkerModels

func (c *Config) WorkerModels() []string

WorkerModels lists the models workers run, in ladder order of appearance.

type State

type State struct {
	Server string            `json:"server"`
	Key    string            `json:"key"`
	Human  string            `json:"human"`
	Tokens map[string]string `json:"tokens,omitempty"` // "server handle" -> token
}

State is what halo remembers between runs: the server, the API key, who it acts for, and the address tokens it minted.

func LoadState

func LoadState() (*State, error)

LoadState reads the state, applying LAGRANGE_SERVER and LAGRANGE_KEY.

func (*State) Save

func (s *State) Save() error

Save writes the state, readable by the user only.

func (*State) SetToken

func (s *State) SetToken(handle, token string)

SetToken saves a token.

func (*State) Token

func (s *State) Token(handle string) string

Token returns the saved token of a handle on the current server.

Jump to

Keyboard shortcuts

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