Documentation
¶
Overview ¶
Package gatewaybridge manages the local lifecycle of the klaus-gateway service (and optionally the upstream agentgateway it can run behind). It mirrors the shape of pkg/musterbridge: klausctl spawns the processes, tracks their PID/port, registers the HTTP MCP endpoint into mcpservers.yaml, and auto-starts on `klaus create` when a personality/instance declares `requires.gateway: true`.
Index ¶
- Constants
- func Stop(ctx context.Context, paths *config.Paths) error
- type AgentGatewayState
- type Options
- type Status
- func EnsureRunning(ctx context.Context, paths *config.Paths, opts Options) (*Status, error)
- func GetStatus(paths *config.Paths) *Status
- func Restart(ctx context.Context, paths *config.Paths, opts Options) (*Status, error)
- func Start(ctx context.Context, paths *config.Paths, opts Options) (*Status, error)
Constants ¶
const ( // BridgeName is the name used when registering klaus-gateway in the // MCP server store. BridgeName = "klaus-gateway" // DefaultKlausGatewayPort is the default port for klaus-gateway. DefaultKlausGatewayPort = 8080 // DefaultAgentGatewayPort is the default port for the optional agentgateway. DefaultAgentGatewayPort = 8090 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AgentGatewayState ¶
type AgentGatewayState struct {
Running bool `json:"running"`
PID int `json:"pid,omitempty"`
Port int `json:"port,omitempty"`
URL string `json:"url,omitempty"`
Healthy bool `json:"healthy"`
Mode string `json:"mode,omitempty"`
}
AgentGatewayState describes the agentgateway process state as a sub-status.
type Options ¶
type Options struct {
// WithAgentGateway, when true, also starts the agentgateway process
// before starting klaus-gateway.
WithAgentGateway bool
// Port overrides the klaus-gateway listen port.
Port int
// AgentGatewayPort overrides the agentgateway listen port.
AgentGatewayPort int
// KlausGatewayBin overrides the klaus-gateway host binary path.
// If empty, the KLAUS_GATEWAY_BIN env var is consulted, then PATH.
KlausGatewayBin string
// AgentGatewayBin overrides the agentgateway host binary path.
// If empty, the KLAUS_AGENTGATEWAY_BIN env var is consulted, then PATH.
AgentGatewayBin string
// LogLevel overrides the gateway log level (defaults to "info").
LogLevel string
}
Options configures the bridge lifecycle. All fields are optional; zero values fall back to defaults or values read from gateway/config.yaml.
type Status ¶
type Status struct {
Running bool `json:"running"`
PID int `json:"pid,omitempty"`
Port int `json:"port,omitempty"`
URL string `json:"url,omitempty"`
Healthy bool `json:"healthy"`
Mode string `json:"mode,omitempty"`
Adapters []string `json:"adapters,omitempty"`
WithAgentGateway bool `json:"withAgentGateway,omitempty"`
AgentGateway *AgentGatewayState `json:"agentGateway,omitempty"`
}
Status represents the state of the gateway bridge.
func EnsureRunning ¶
EnsureRunning starts the bridge if it is not already running, otherwise ensures the bridge entry exists in the MCP server store. Used by the auto-start integration in the instance start flow.