Help us shape the future of Go! Take the 2026 Go Developer Survey

herdr

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package herdr reports ask's agent state to herdr (https://herdr.dev), the agent-aware terminal multiplexer, when ask runs inside a herdr pane: whether ask is idle, working, or blocked on the user, the command that resumes its session after a herdr restart, and display metadata for the pane. Reports travel over herdr's socket API (newline-delimited JSON) from one background goroutine; they are best-effort and never block the caller.

Index

Constants

View Source
const (
	// Source identifies ask's reports. herdr reserves the "herdr:" prefix
	// for its own integrations.
	Source = "ask"
	// Agent is the agent name herdr shows for the pane.
	Agent = "ask"
)
View Source
const (
	EnvMarker = "HERDR_ENV"
	EnvPaneID = "HERDR_PANE_ID"
	EnvSocket = "HERDR_SOCKET_PATH"
)

The variables herdr sets for every process in a pane.

Variables

View Source
var DebugLog = func(format string, args ...any) {}

DebugLog is the package's debug sink; the TUI points it at its ASK_DEBUG logger. A no-op by default.

Functions

func WithoutPaneEnv

func WithoutPaneEnv(env []string) []string

WithoutPaneEnv returns env without herdr's pane variables. Processes ask starts on the agent's behalf get it, so a nested agent (an `ask`, a `claude` child with herdr's hooks installed, a test binary) can neither report over nor release ask's own status in the pane.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client reports one pane's status to herdr. A nil *Client is valid and does nothing, which is what FromEnv returns outside herdr.

func FromEnv

func FromEnv(getenv func(string) string) *Client

FromEnv returns a client for the pane described by herdr's variables, or nil when the process is not running inside a herdr pane.

func New

func New(socket, pane string) *Client

New returns a client reporting pane over the herdr socket at socket.

func (*Client) Reclaim

func (c *Client) Reclaim()

Reclaim resends the whole status. herdr drops an agent once its pane is back at a shell prompt, as it is while ask is suspended, so ask reclaims the pane when it resumes.

func (*Client) Release

func (c *Client) Release()

Release stops reporting and hands the pane back to herdr, which clears ask's name, state, and resume command from it.

func (*Client) Report

func (c *Client) Report(s Status)

Report makes s the pane's status. It returns at once; a report still in flight is superseded rather than queued behind.

type RejectedError

type RejectedError struct {
	Method  string
	Code    string
	Message string
}

RejectedError is herdr's answer to a request it refused.

func (*RejectedError) Error

func (e *RejectedError) Error() string

type State

type State string

State is herdr's semantic agent state. herdr derives "done" (finished and not yet looked at) on its own.

const (
	Idle    State = "idle"
	Working State = "working"
	Blocked State = "blocked"
)

type Status

type Status struct {
	State State
	// Message says what a blocked agent is waiting for.
	Message string
	// SessionID names the session Resume reopens. Resume is the argv herdr
	// runs in the pane after a server restart; its first element is a
	// plain command name.
	SessionID string
	Resume    []string
	// Title and Tokens are display-only: the pane title, and named values
	// herdr's sidebar renders as $name.
	Title  string
	Tokens map[string]string
}

Status is everything ask tells herdr about its pane. Every Report carries the whole status; the client sends only the parts herdr has not yet accepted.

Jump to

Keyboard shortcuts

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