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

daemon

package
v0.0.0-...-8ff7086 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 48 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ShutdownGrace is how long a stopping daemon lets requests in flight finish when the stop
	// does not set a timeout.
	ShutdownGrace = 10 * time.Second

	// StoppingHeader marks an Unavailable error, or a 503 response, from a daemon that stops
	// taking new work; the caller retries with the daemon that discovery names next.
	StoppingHeader = "Agx-Daemon-Stopping"
)
View Source
const EndedHeader = "Agx-Launch-Ended"

EndedHeader carries, on a renewal refused because the launch ended, how it ended: revoked, finished, or expired, so the wrapper can tell its user.

Variables

View Source
var ErrUnavailable = errors.New("daemon unavailable")

ErrUnavailable marks ReadDiscovery errors that leave no daemon to reach: it is not running, or its discovery file is invalid.

View Source
var Version = "dev"

Version is set at build time with -ldflags "-X agx/internal/daemon.Version=..."; otherwise it is the main module's version, which go install module@version records.

Functions

func Serve

func Serve(
	ctx context.Context,
	stop <-chan struct{},
	paths platform.Paths,
	registry adapters.Registry,
	builtins config.Builtins,
) error

Serve runs the daemon until stop closes or a stop request arrives, then shuts down gracefully: it takes no new launches or MCP sessions, lets requests in flight finish for the grace period, and lets its MCP servers exit. When ctx ends, it shuts down at once. Unless the stop forces, wrappers attach their launches to the next daemon. builtins must describe the adapters in registry.

func StatePath

func StatePath(paths platform.Paths) string

StatePath is the file in which the daemon keeps what the next one needs.

Types

type Discovery

type Discovery struct {
	Version    string `json:"version"`
	InstanceID string `json:"instance_id"`
	URL        string `json:"url"`
	Token      string `json:"token"`
	Config     string `json:"config"`
	// PID is the daemon's process, for diagnosing one that stopped answering.
	PID int `json:"pid,omitempty"`
}

func ReadDiscovery

func ReadDiscovery(paths platform.Paths) (Discovery, error)

ReadDiscovery reads the authenticated endpoint for this configuration.

type Server

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

func (*Server) AttachLaunch

AttachLaunch takes a launch from its wrapper when this daemon does not hold it, or let it expire: after a restart, an upgrade, or a crash. The launch keeps its ID, grant, and lifecycle token, so its harness's MCP configuration stays valid, and gets its thread launches back. Attaching a launch the daemon holds attaches only the thread launches it misses.

func (*Server) CallTool

func (*Server) GetRuntime

func (*Server) GetSkill

func (*Server) InspectSource

InspectSource checks a Git source out at its pins, for filling in a package's revision, hash, and subdirectory.

func (*Server) Install

Install streams an installation's progress and then its result or failure. The installation goes on if the caller disconnects; a stopping daemon waits for it for its grace period, then cancels it.

func (*Server) ListSessions

func (*Server) ListSourceRefs

ListSourceRefs lists a Git source's branches and tags for picking a package's ref.

func (*Server) ListTools

func (*Server) Login

func (*Server) Logout

func (*Server) PlanChanges

func (*Server) ReadFile

func (*Server) RenewLaunch

func (*Server) Resolve

func (*Server) SetSecret

func (*Server) Stop

Stop makes the daemon stop; without force, wrappers attach its active launches to the next daemon.

func (*Server) Validate

func (*Server) WatchRuntime

Jump to

Keyboard shortcuts

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