server

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: GPL-3.0 Imports: 54 Imported by: 0

Documentation

Overview

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    *pluginregistry.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
	Protocols       *service.ProtocolService
	// ExtPlugins is the out-of-tree plugin manager; nil when none are configured.
	ExtPlugins *extplugin.Manager
	// Market is the plugin registry client; nil when the marketplace is disabled.
	Market *pluginmarket.Service
	// PluginsDir is the configured external-plugin directory, surfaced read-only
	// to the admin UI; empty when external loading is disabled.
	PluginsDir        string
	Users             *service.UserService
	TwoFactor         *service.TwoFactorService
	Invitations       *service.InvitationService
	Tunnels           *transport.Registry
	Leases            livelease.LeaseRegistry
	Instance          livelease.InstanceRef
	Recordings        *service.RecordingService
	Recording         *recording.Engine
	RecordingMaxChunk int64
	// AI owns user providers and the env/config shared-AI provider.
	AI *aiconfig.Service
	// ModelRegistry resolves model context windows and live model lists.
	ModelRegistry *modelreg.Registry
	Audit         audit.Sink
	Metrics       *telemetry.Metrics
	Health        *telemetry.Health
	Logger        *slog.Logger
	// Version reports the running build and checks for a newer release.
	Version *version.Checker

	// StaticFS is the embedded web/dist; nil in dev mode.
	StaticFS fs.FS
	Dev      bool
	// AccessLog logs one structured line per API request.
	AccessLog 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.

func (*Server) InvokeStream added in v0.1.1

func (s *Server) InvokeStream(ctx context.Context, user models.User, connID, routeID string, params map[string]string, opts engine.StreamSampleOptions) (any, error)

Jump to

Keyboard shortcuts

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