httpapi

package
v0.1.0-alpha.68 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: GPL-3.0 Imports: 67 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package httpapi exposes the local browser UI and core HTTP API routes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsoleStopResult

type ConsoleStopResult struct {
	// Available reports that a motion engine or device transport received it.
	Available bool
	// Confirmed reports that the device acknowledged it.
	Confirmed bool
}

ConsoleStopResult is the outcome of a Stop from the launch console.

type RemoteInterfaceOptions

type RemoteInterfaceOptions struct {
	AllowedBrowserHosts []string
	NetworkPolicy       *netaccess.Policy
	SecureCookies       bool
}

RemoteInterfaceOptions describes an independently validated socket boundary. Both interfaces borrow the same domains and Stop path; no engine or worker is duplicated. Cookies have distinct names AND server-side session audiences.

type Runtime

type Runtime struct {
	// OpenAI endpoints are injectable only for isolated protocol tests.
	OpenAIHTTPClient   *http.Client
	OpenAIIssuer       string
	OpenAIBaseURL      string
	Traces             *diagnostics.TraceRing
	Transport          transport.DiagnosticsProvider
	MotionTransport    transport.Transport
	MotionSimulated    bool
	LLMProvider        llm.Provider
	LLMHTTPClient      *http.Client
	CloudBaseURL       string
	CloudHTTPClient    *http.Client
	IntifaceHTTPClient *http.Client
	// IntifaceSimulatorAddress replaces the saved Intiface address in
	// -simulate-motion builds, so no real device is ever reached.
	IntifaceSimulatorAddress string
	BrowserBluetoothBridge   *transport.BrowserBluetoothBridge
	// CoyoteConnector replaces the Bluetooth worker, for simulation and tests.
	CoyoteConnector          estim.Connector
	NativeBluetoothConnector ble.Connector
	// ExecutablePath makes first-party worker discovery deterministic and
	// injectable in tests. Empty falls back to os.Executable.
	ExecutablePath      string
	UpdateHTTPClient    *http.Client
	UpdateReleaseAPIURL string
	// Accounts is the process account domain. Nil creates one over Store's
	// shared datastore. AuthenticationRequired protects every route except the
	// deliberately public health, login/bootstrap, and Emergency Stop edges.
	Accounts               *accounts.Store
	AuthenticationRequired bool
	SecureCookies          bool
	RemoteURL              string
	AllowedBrowserHosts    []string
	NetworkPolicy          *netaccess.Policy
	NetworkCertificates    netaccess.CertificateProvider
	NetworkAutomation      *netaccess.Automation
}

Runtime contains app runtime collaborators exposed through HTTP diagnostics.

type Server

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

Server owns the local HTTP routes and embedded static asset serving.

func New

func New(static fs.FS, logger *slog.Logger, store *config.Store, runtime Runtime, version VersionInfo) (*Server, error)

New wires the HTTP API to the embedded static assets and structured logger.

func (*Server) Close

func (s *Server) Close()

Close releases runtime and datastore resources after quiescing device work. It is idempotent so startup failures and deferred shutdown can share it.

func (*Server) ConsoleStop

func (s *Server) ConsoleStop(ctx context.Context) (ConsoleStopResult, error)

ConsoleStop serves the launch console's Stop key. It shares the Stop button's emergency-stop path, admission and audit, so the device can be stopped from the console window even with no browser open.

func (*Server) Handler

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

Handler returns the HTTP handler for use by net/http servers and tests.

func (*Server) Quiesce

func (s *Server) Quiesce()

Quiesce rejects new controller work, drains autonomous planners, and stops device motion before HTTP shutdown waits for active handlers.

func (*Server) RemoteHandler

func (s *Server) RemoteHandler(options RemoteInterfaceOptions) http.Handler

RemoteHandler exposes an explicit allowlist. Even administrator credentials cannot turn this listener into the main app, a file server or a controller.

type VersionInfo

type VersionInfo struct {
	Version string
	Commit  string
}

VersionInfo identifies the build served by the HTTP API.

Source Files

Jump to

Keyboard shortcuts

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