Documentation
¶
Overview ¶
Package server wires configuration into a running HTTP gateway: it builds the adapters, the router and the API frontends, and owns the listener.
Index ¶
Constants ¶
const ProbeTimeout = 30 * time.Second
ProbeTimeout bounds the health check of a single backend at startup, so one wedged CLI cannot hold up the listener.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the agent2api HTTP gateway.
func New ¶
New builds the gateway. Backends are auto-detected: each configured CLI is probed, and the ones that are installed and logged in start serving. The rest are reported in Server.Skipped rather than failing startup, so the gateway runs with whatever this machine happens to have.
func (*Server) ListenAndServe ¶
ListenAndServe runs the gateway until ctx is canceled, then drains in-flight requests before returning.
type Skipped ¶
Skipped records a backend that was configured but is not being served — almost always a CLI that is not installed or not logged in on this machine.
func BuildAdapters ¶
func BuildAdapters(ctx context.Context, cfg *config.Config, log *slog.Logger) ([]adapter.Adapter, []Skipped, error)
BuildAdapters instantiates the backends this machine can actually serve.
Every configured adapter is probed. A probe failure is a skip, not an error: having only some of these CLIs installed is the normal case, and a gateway that refuses to start because Cursor is absent would be useless. Startup only fails when nothing at all is usable, which New reports.