workbench

package
v0.1.0-preview.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package workbench serves the local browser debug workbench.

Index

Constants

View Source
const (
	DefaultPort    = 8585
	DefaultAddress = "127.0.0.1:8585"
)

Default server limits keep the workbench local and bound resource use.

View Source
const ProtocolVersion = 1

ProtocolVersion identifies the JSON envelope contract spoken by the browser and server.

Variables

View Source
var (
	// ErrInvalidConfig indicates that server configuration violates safety constraints.
	ErrInvalidConfig = errors.New("invalid debug workbench configuration")
	// ErrAlreadyStarted indicates that Start was called more than once.
	ErrAlreadyStarted = errors.New("debug workbench server already started")
	// ErrNotStarted indicates that shutdown was requested before startup.
	ErrNotStarted = errors.New("debug workbench server not started")
	// ErrOutboundQueueFull indicates that a slow client exhausted its bounded queue.
	ErrOutboundQueueFull = errors.New("debug workbench outbound queue is full")
	// ErrControllerConnected indicates that the initial single-controller limit was reached.
	ErrControllerConnected = errors.New("a debug workbench controller is already connected")
	// ErrServerStopping indicates that shutdown has closed the connection admission gate.
	ErrServerStopping = errors.New("debug workbench server is stopping")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Address          string
	OutboundCapacity int
	MaxMessageBytes  int64
	ResultPoll       time.Duration
}

Config controls the local workbench server without exposing gameplay settings.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns conservative loopback-only server settings.

type ControlPlane

type ControlPlane interface {
	SubmitDebugRequest(request debugging.Request) error
	NextDebugResult() (debugging.Result, bool)
	DebugDiscoverySnapshot() debugging.DiscoverySnapshot
	DebugSceneGeneration() uint64
}

ControlPlane is the concurrency-safe application boundary used by the server.

type Server

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

Server owns the loopback listener, active browser connection, and resumable operation records.

func NewServer

func NewServer(control ControlPlane, config Config) (*Server, error)

NewServer validates configuration and creates a stopped workbench server.

func (*Server) Errors

func (s *Server) Errors() <-chan error

Errors reports unexpected HTTP serving failures.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown stops active connections, HTTP serving, and result dispatch.

func (*Server) Start

func (s *Server) Start() error

Start binds synchronously and starts HTTP and result-dispatch goroutines.

func (*Server) URL

func (s *Server) URL() string

URL returns the bound browser URL after Start.

Jump to

Keyboard shortcuts

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