server

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package server exposes the control plane over HTTP: sandbox lifecycle, governed tool calls, approvals, audit endpoints, a terminal WebSocket, and optionally the web dashboard. Every tool call goes through controlplane.Manager, so governance is always enforced.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TokenAuth

func TokenAuth(token string, next http.Handler) http.Handler

TokenAuth wraps next with bearer-token authentication. When token is empty, authentication is disabled and next is returned unchanged. /healthz is always exempt so liveness probes work without credentials. The token may be presented as "Authorization: Bearer <token>", an "X-Runeward-Token" header, or a "token" query parameter only for terminal WebSocket compatibility.

Types

type Server

type Server struct {

	// AuthToken, when non-empty, requires every request (except /healthz) to
	// present it as a bearer token. Empty disables authentication. Ignored when
	// Authz is set.
	AuthToken string

	// Authz, when set, enables multi-principal RBAC: each request's bearer token
	// is resolved to a named principal with per-profile launch and approval
	// permissions. Takes precedence over AuthToken.
	Authz *authz.Store

	// MCP, when set, is mounted at /mcp alongside the REST API.
	MCP http.Handler
	// contains filtered or unexported fields
}

Server is the control-plane HTTP surface.

func New

func New(mgr *controlplane.Manager, dashboard http.Handler, logger *slog.Logger) *Server

New builds a Server over mgr. dashboard, when non-nil, is mounted at "/"; logger may be nil.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the routed http.Handler for the control plane.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(addr string) error

ListenAndServe starts the control plane on addr.

Jump to

Keyboard shortcuts

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