Documentation
¶
Index ¶
- Variables
- func LoadAgents(home string) (map[string]Agent, error)
- func Root(home string) string
- func SocketPath(home string) string
- type Agent
- type Client
- func (c *Client) Ensure(ctx context.Context) error
- func (c *Client) Log(ctx context.Context, id string, tail int) (string, error)
- func (c *Client) Ls(ctx context.Context, all bool) (string, error)
- func (c *Client) Result(ctx context.Context, id, turn string) (string, error)
- func (c *Client) Say(ctx context.Context, id, message string) (string, error)
- func (c *Client) Spawn(ctx context.Context, spec Spec) (string, error)
- func (c *Client) Statuses(ctx context.Context) ([]Status, error)
- func (c *Client) Stop(ctx context.Context, id string) (string, error)
- func (c *Client) Wait(ctx context.Context, id string, timeout time.Duration) (string, error)
- func (c *Client) WaitOnce(ctx context.Context, id string, seconds int) (entry string, final bool, err error)
- func (c *Client) Watch(ctx context.Context, ids []string, timeout time.Duration, out io.Writer) error
- type Daemon
- type Meta
- type Now
- type Spec
- type State
- type Status
- type TurnInfo
- type Usage
- type Worker
Constants ¶
This section is empty.
Variables ¶
var ErrStillRunning = errors.New("still running")
ErrStillRunning is returned by Wait when the timeout passes first.
Functions ¶
func LoadAgents ¶
LoadAgents returns the built-in agents overlaid with ~/.fleet/agents.json.
func SocketPath ¶
SocketPath returns the daemon's unix socket path.
Types ¶
type Agent ¶
type Agent struct {
Argv []string `json:"argv"`
Env []string `json:"env,omitempty"`
// Bare agents have no tools; cwd is irrelevant and the brief must carry everything.
Bare bool `json:"bare,omitempty"`
}
Agent describes how to launch one ACP agent process.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the daemon over its unix socket, starting it when absent.
func (*Client) Ensure ¶
Ensure makes sure a daemon is answering, launching `fleet serve` detached if not.
func (*Client) Result ¶
Result returns a worker's reply text and footer. turn selects the reply: empty or "0" for the latest turn (live while running), a turn number for an earlier one, or "all" for every turn concatenated.
func (*Client) Wait ¶
Wait blocks until the worker is final or timeout passes, returning its ls entry.
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon owns the live workers and serves them over a unix socket.
func NewDaemon ¶
NewDaemon loads agent definitions and the metadata of past workers, then reattaches every worker whose host process outlived the previous daemon.
type Meta ¶
type Meta struct {
ID string `json:"id"`
Spec Spec `json:"spec"`
Started time.Time `json:"started"`
SessionID string `json:"session_id,omitempty"`
PID int `json:"pid,omitempty"`
State State `json:"state"`
Detail string `json:"detail,omitempty"`
Turns int `json:"turns"`
TurnLog []TurnInfo `json:"turn_log,omitempty"`
Usage Usage `json:"usage"`
// ContextUsed and ContextSize are the agent's latest reported context
// window fill in tokens; CostUSD is the latest reported session cost.
ContextUsed int64 `json:"context_used,omitempty"`
ContextSize int64 `json:"context_size,omitempty"`
CostUSD float64 `json:"cost_usd,omitempty"`
Ended time.Time `json:"ended,omitempty"`
// Restart survival: AckSeq is the host stream position handled so far,
// NextRPCID keeps request ids unique across reattaches, and TurnCallID
// with TurnDeadline describe the in-flight prompt call to resume.
AckSeq int64 `json:"ack_seq,omitempty"`
NextRPCID int64 `json:"next_rpc_id,omitempty"`
TurnCallID int64 `json:"turn_call_id,omitempty"`
TurnDeadline time.Time `json:"turn_deadline,omitempty"`
}
Meta is the persisted description of a worker.
type Spec ¶
type Spec struct {
Agent string `json:"agent"`
Model string `json:"model"`
Thinking string `json:"thinking"`
Cwd string `json:"cwd"`
Label string `json:"label"`
Brief string `json:"brief"`
Writes bool `json:"writes"`
Minutes int `json:"minutes"`
}
Spec is what a caller asks for when spawning a worker.
type Status ¶
type Status struct {
ID string `json:"id"`
State State `json:"state"`
Flag string `json:"flag,omitempty"`
Label string `json:"label"`
Line string `json:"line"`
Entry string `json:"entry"`
}
Status is the machine-readable form of one ls entry.
type TurnInfo ¶
TurnInfo records how one turn ended so past turns stay listable after the in-memory text of earlier turns is gone.
type Usage ¶
type Usage struct {
Input int64 `json:"input"`
CachedRead int64 `json:"cached_read"`
Output int64 `json:"output"`
}
Usage is cumulative token usage across turns.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker owns one ACP agent session, reached through the worker's host.
func (*Worker) ResultTurn ¶
ResultTurn returns one turn's reply text. An empty turn, "0", or the number of the latest turn gives the live text; "all" concatenates every turn; any other number reads that turn's saved reply.