server

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: GPL-3.0 Imports: 45 Imported by: 0

Documentation

Overview

Package server provides the HTTP and WebSocket layer.

Package server is the HTTP/WS adapter for APIs, plugin routes, and the UI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Plugins    *plugin.Registry
	Store      *store.Store
	Sessions   *session.Manager
	Auth       auth.Authenticator
	SessionMgr *auth.SessionManager
	Tickets    *auth.TicketStore
	// ArtifactTickets guards public install-artifact fetches.
	ArtifactTickets   *auth.TicketStore
	Policy            *policy.Enforcer
	Connector         *service.Connector
	Connections       *service.ConnectionService
	Credentials       *service.CredentialService
	Enrollments       *service.EnrollmentService
	Users             *service.UserService
	TwoFactor         *service.TwoFactorService
	Invitations       *service.InvitationService
	Tunnels           *transport.Registry
	Recordings        *service.RecordingService
	Recording         *recording.Engine
	RecordingMaxChunk int64
	AI                *aiconfig.Service
	// AIGlobal is the env/config shared-AI provider.
	AIGlobal config.AIConfig
	// ModelRegistry resolves model context windows and live model lists.
	ModelRegistry *modelreg.Registry
	Audit         audit.Sink
	Metrics       *telemetry.Metrics
	Health        *telemetry.Health
	Logger        *slog.Logger

	// StaticFS is the embedded web/dist; nil in dev mode.
	StaticFS fs.FS
	Dev      bool
	// AllowedOrigins are extra WS origins beyond same-site (usually empty).
	AllowedOrigins []string
}

Deps are the server's injected dependencies (wired once in cmd/server).

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server wires the dependencies into a chi router.

func New

func New(d Deps) *Server

New builds the server and its routes.

func (*Server) Handler

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

Handler returns the root HTTP handler.

func (*Server) InvokeRoute

func (s *Server) InvokeRoute(ctx context.Context, user models.User, connID, routeID string, params map[string]string, body []byte) (any, error)

InvokeRoute runs one non-streaming plugin route as the given user through the same authorization, validation, and audit path as HTTP dispatch.

Jump to

Keyboard shortcuts

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