macos

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HeaderLaunchToken authenticates top-level desktop-managed HTTP navigations.
	HeaderLaunchToken = "X-Vango-Desktop-Launch"
	// HeaderWindowID scopes desktop-managed HTTP navigations to a native window.
	HeaderWindowID = "X-Vango-Window-ID"
	// QueryWindowID scopes WebSocket upgrades to a native window.
	QueryWindowID = "vango_window"
	// QueryRuntimeToken authenticates WebSocket upgrades.
	QueryRuntimeToken = "vango_rt"
)

Variables

This section is empty.

Functions

func DefaultCapabilities

func DefaultCapabilities() shell.CapabilitySet

DefaultCapabilities returns the reference host's phase-1 capability surface.

Types

type ClientMessage

type ClientMessage struct {
	Type    string          `json:"type"`
	Payload json.RawMessage `json:"payload,omitempty"`
}

ClientMessage is sent from the embedded WebView back into the desktop runtime.

type Host

type Host interface {
	Dispatch(windowID string, cmd shell.Command) error
	Request(ctx context.Context, windowID string, req shell.Request) (shell.Response, error)
}

Host executes normalized shell commands and requests against the native host.

type Options

type Options struct {
	BundleID              string
	AppVersion            string
	BuildChannel          string
	ApplicationSupportDir string
	CacheDir              string
	LogDir                string
	SessionStorePath      string
	RuntimeTokenTTL       time.Duration
	Capabilities          shell.CapabilitySet
	Logger                *slog.Logger
}

Options configure the macOS desktop runtime.

type ResumeEntry

type ResumeEntry struct {
	Key       string    `json:"key,omitempty"`
	SessionID string    `json:"sessionID,omitempty"`
	LastSeq   uint64    `json:"lastSeq,omitempty"`
	LastPath  string    `json:"lastPath,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
}

ResumeEntry stores window-scoped resumable session metadata.

type Runtime

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

Runtime hosts a Vango app inside a native macOS shell.

func New

func New(app *vango.App, host Host, opts Options) (*Runtime, error)

New creates a macOS desktop runtime for the given Vango app.

func (*Runtime) BaseURL

func (r *Runtime) BaseURL() string

BaseURL returns the loopback server base URL.

func (*Runtime) CloseWindow

func (r *Runtime) CloseWindow(windowID string) error

CloseWindow removes the window registration and records its current route for restore/debugging.

func (*Runtime) EmitShellEvent

func (r *Runtime) EmitShellEvent(windowID string, event shell.Event) error

EmitShellEvent publishes a host-originated shell event to the target window.

func (*Runtime) HandleClientMessage

func (r *Runtime) HandleClientMessage(windowID string, raw []byte) error

HandleClientMessage applies a client-originated host message, such as resume-store updates.

func (*Runtime) PrepareWindow

func (r *Runtime) PrepareWindow(windowID, path string) (WindowLaunch, error)

PrepareWindow returns the loopback URL and headers required to load a window.

func (*Runtime) Shutdown

func (r *Runtime) Shutdown(ctx context.Context) error

Shutdown stops the loopback HTTP server.

func (*Runtime) Start

func (r *Runtime) Start() error

Start launches the loopback HTTP server if it is not already running.

type StoragePaths

type StoragePaths struct {
	ApplicationSupportDir string
	CacheDir              string
	LogDir                string
	SessionStorePath      string
}

StoragePaths holds the stable macOS filesystem locations used by the desktop runtime.

type WindowLaunch

type WindowLaunch struct {
	WindowID string            `json:"windowID"`
	URL      string            `json:"url"`
	Headers  map[string]string `json:"headers"`
}

WindowLaunch describes how the native host should load a Vango page into a window.

Jump to

Keyboard shortcuts

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