Documentation
¶
Overview ¶
Package httpserver is the servicepack service that runs chatz's HTTP API. It self-bootstraps from the environment: parse config, open the DB (running migrations + wiring the generated repositories), build the collaborators (secrets box, model upstreams, MCP manager, auth), and serve the generated StrictServerInterface until the context is cancelled.
Index ¶
Constants ¶
const ServiceName = "http-server"
ServiceName is the service-manager registration key.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service wires the HTTP API together and owns the resources it opens (the DB handle + the MCP subprocesses/clients), releasing them on Stop. It also runs the internal-only observability listeners (/metrics + pprof) alongside the API, sharing the same metrics registry the usage recorder emits into.
func New ¶
New parses config, connects the DB, discovers model upstreams, connects the enabled MCP servers (best-effort), and assembles the HTTP server. It runs when the service manager starts the service (the `run` command), not at registration time — so the DB is only touched when the app actually boots.
func (*Service) Run ¶
Run serves the HTTP API until ctx is cancelled, at which point Serve drains and shuts down echo and returns nil. The internal observability listeners (/metrics + pprof) run alongside on their own ports and are torn down after the API drains. A failure on an aux port only warns — observability never takes down the API.