Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigProvider ¶
ConfigProvider returns the currently-active *config.Config per /config request. Used so the endpoint reflects a hot-reload swap performed by core/reloader; for setups without hot-reload the host just wraps a captured pointer (`func() *Config { return cfg }`).
type Option ¶
type Option func(*statServerOpts)
Option configures a StatServer at construction time.
func WithExtraStats ¶
WithExtraStats adds one top-level key name to the /stats document, with fn's map as its value, read per request. Without it the document is the merged plugin stats alone.
func WithLoopbackOnly ¶
WithLoopbackOnly answers 403 on every route to a non-loopback Host or a request carrying Origin (httpx.LoopbackOnly). /config can hold a secret under a key name redact does not know, so a page doing DNS rebinding must not read it. The host enables it where the stats port is loopback-only (listener.bind_loopback_only).
func WithPprof ¶
WithPprof mounts Go's net/http/pprof handlers under /debug/pprof/. Off unless asked for: the profiles expose the process's internals — allocation stack traces, argv (cmdline), and a caller's ability to start CPU profiling and tracing — so the host enables it only where the stats port is loopback-only (cmd/cortex reads listener.bind_loopback_only, the same gate as the session API's clear). The handlers also refuse a non-loopback Host and any request carrying Origin, the erase guards' browser defenses — pprofx.RegisterPprof's, the one guarded pprof surface shared with the agentop viewer.
Side effect of the import: net/http/pprof's init registers /debug/pprof/* on http.DefaultServeMux in every binary linking pprofx. Nothing in this tree serves that mux — an http.Server built with a nil Handler would, and would expose these ungated, so none may be.
func WithPricingTable ¶
WithPricingTable registers a /pricing/table handler (typically the Handler returned by a core/cost/pricing.Registry). Omit when pricing isn't wired up.
It answers what a config file cannot: the rates in effect come from the operator's `pricing:` section PLUS a table compiled into the binary PLUS any shipped gateway discount, so reading the config describes only the part the operator wrote.
func WithReloadStatus ¶
WithReloadStatus registers a /reload/status handler (typically the Handler returned by a core/reloader.Reloader). Omit when hot- reload isn't wired up — the endpoint simply won't exist.
func WithTLSBridgeUnread ¶
WithTLSBridgeUnread registers a /tls-bridge/unread handler (tlsbridge.Engine's UnreadHandler): which client programs the TLS bridge is passing through unread, and why. Omit when no bridge runs.
type StatServer ¶
type StatServer struct {
// contains filtered or unexported fields
}
func NewStatServer ¶
func NewStatServer(addr string, configProvider ConfigProvider, statsProvider StatsProvider, opts ...Option) *StatServer
NewStatServer builds the stat HTTP server. configProvider is invoked per /config request and statsProvider per /stats request, so both reflect current state rather than a snapshot captured at construction.
func (*StatServer) Close ¶
func (s *StatServer) Close() error
Close stops the server at once: the listener closes and any request in flight is dropped. For a stop that frees the port immediately; Shutdown is the draining one.
type StatsProvider ¶
StatsProvider returns a fresh *auth.Stats per /stats request. The host typically implements this by calling auth.MergeStats over the per-plugin stats collected from each pipeline — see plugins.CollectStats. Called per HTTP request, so implementations should be cheap (a few map copies).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package claude owns the Claude Code session-metadata contract: the shape agentop's harvester writes to ~/.cortex/session-metadata.json, the path it lives at, and the harvest that produces it.
|
Package claude owns the Claude Code session-metadata contract: the shape agentop's harvester writes to ~/.cortex/session-metadata.json, the path it lives at, and the harvest that produces it. |