agents

package
v0.67.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 13 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 agents is the generic agents core: the backend that hosts task agents, and the asks they wait on. It is the only package that talks to Herdr, so the rest of f10 stays separable from it.

Index

Constants

This section is empty.

Variables

View Source
var Agents = func(dir string) agentctl.Backend {
	b := herdr.New(dir)
	if SessionEnv == nil {
		return b
	}

	if b.Env = SessionEnv(); len(b.Env) == 0 {
		return unreachable{b}
	}

	return b
}

Agents is the backend hosting task agents, answering from dir: Herdr, the only one. A variable so a test can host agents without it.

View Source
var ErrNoSession = errors.New(
	"no Herdr session has registered with the daemon: run an f10 command inside Herdr")

ErrNoSession is the daemon's refusal of every agent call while no local client has registered the Herdr session it runs in.

View Source
var ErrNotInside = herdr.ErrNotInside

ErrNotInside is the refusal of a process outside Herdr, which IsOutside reports.

View Source
var SessionEnv func() []string

SessionEnv is the environment Herdr calls run under, nil for this process's own. The daemon sets it to the newest local session's, because it outlives the client that spawned it; with none registered, Herdr is unreachable rather than reached through a session that may be gone.

Functions

func Answer

func Answer(
	ctx context.Context,
	w io.Writer,
	dir string,
	a asks.Ask,
	values []string,
	by string,
	d Deliverer,
) (asks.Ask, bool, error)

Answer claims a's answer from N=VALUE values and delivers it, writing what happened to w.

func AnswersFor

func AnswersFor(a asks.Ask, values []string) (string, error)

AnswersFor resolves N=VALUE answers into the ask's answer text; a question not named takes its default, and one with none is refused.

func AskName

func AskName(a asks.Ask) string

AskName is the task, with its project where the inbox spans several.

func FindKey

func FindKey(dir, key string) (asks.Ask, error)

FindKey is the open ask whose inbox key is key.

func FindOpen

func FindOpen(dir, token string) (asks.Ask, error)

FindOpen is the open ask a token names: a task id, or project:task where two projects share one.

func IsOutside

func IsOutside(err error) bool

IsOutside reports err as the refusal of a process outside Herdr.

func ReachableAgents

func ReachableAgents(dir string) agentctl.Backend

ReachableAgents is the backend answering from dir, or nil when this process cannot reach it.

func RequireAgents

func RequireAgents() error

RequireAgents is the check start, forward, drive and finish make before anything else: they run inside a Herdr session and nowhere else, with no fallback by design.

func RequireAgentsIn

func RequireAgentsIn(env []string) error

RequireAgentsIn is RequireAgents for a client whose environment is env, which the daemon checks for it; a nil env checks this process's own.

func WithSession

func WithSession(ctx context.Context, env []string) context.Context

WithSession runs the agent calls made under ctx in env's session (herdr.WithSession), for a daemon calling for one client of several.

Types

type Deliverer

type Deliverer struct {
	Prompt func(ctx context.Context, w io.Writer, a asks.Ask) error
	Resume func(ctx context.Context, w io.Writer, a asks.Ask) error
	Live   func(a asks.Ask) bool
}

A Deliverer moves a claimed answer on: prompt reaches an agent no drive watches, resume restarts a stopped drive, and live says whether a drive still runs. Resume and live are the owner's, because this core knows no drives.

func (Deliverer) Deliver

func (d Deliverer) Deliver(ctx context.Context, w io.Writer, dir string, a asks.Ask) (bool, error)

Deliver moves a claimed answer to where it acts. A drive's ask goes to its drive, a running one taking it as it exits so nothing runs twice; any other is sent to its agent, unless typed in the pane already. sent is true when the answer reached the agent here.

Directories

Path Synopsis
Package agentsrpc serves agents.v1 over the agents core: the workspaces and agents of the multiplexer, text sent to an agent, and the inbox.
Package agentsrpc serves agents.v1 over the agents core: the workspaces and agents of the multiplexer, text sent to an agent, and the inbox.

Jump to

Keyboard shortcuts

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