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 ¶
- Variables
- func Answer(ctx context.Context, w io.Writer, dir string, a asks.Ask, values []string, ...) (asks.Ask, bool, error)
- func AnswersFor(a asks.Ask, values []string) (string, error)
- func AskName(a asks.Ask) string
- func BatchResume(supported bool, hand func(context.Context, asks.Ask) error) func(context.Context, io.Writer, asks.Ask) error
- func FindKey(dir, key string) (asks.Ask, error)
- func FindOpen(dir, token string) (asks.Ask, error)
- func IsOutside(err error) bool
- func ReachableAgents(dir string) agentctl.Backend
- func ReleasePane(ctx context.Context, w io.Writer, a asks.Ask)
- func ReportBlocked(ctx context.Context, w io.Writer, a asks.Ask)
- func RequireAgents() error
- func RequireAgentsIn(env []string) error
- func WithSession(ctx context.Context, env []string) context.Context
- type Deliverer
Constants ¶
This section is empty.
Variables ¶
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.
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.
var ErrNotInside = herdr.ErrNotInside
ErrNotInside is the refusal of a process outside Herdr, which IsOutside reports.
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 ¶
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 BatchResume ¶ added in v0.71.0
func BatchResume( supported bool, hand func(context.Context, asks.Ask) error, ) func(context.Context, io.Writer, asks.Ask) error
BatchResume is a Deliverer's Resume for the stopped batch an answered ask belongs to. hand is the caller's, because the daemon resumes in process and a command dials the daemon. Unsupported, it tells the user to resume by hand.
func FindOpen ¶
FindOpen is the open ask a token names: a task id, or project:task where two projects share one.
func ReachableAgents ¶
ReachableAgents is the backend answering from dir, or nil when this process cannot reach it.
func ReleasePane ¶ added in v0.68.0
ReleasePane hands an answered ask's pane back to herdr's own detection, so it stops showing blocked. A failure is a line on w, never the answer's.
func ReportBlocked ¶ added in v0.68.0
ReportBlocked shows the asking agent's herdr pane blocked on the ask's first question while it is open. Outside herdr it does nothing.
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 ¶
RequireAgentsIn is RequireAgents for a client whose environment is env, which the daemon checks for it; a nil env checks this process's own.
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.
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. |