localruntime

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 28 Imported by: ? 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 localruntime starts the per-user Lectern control plane used by the local CLI. It deliberately keeps its state away from the checkout so a fresh install can run without a hosted server or a configured target.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BrowserURL added in v2.7.0

func BrowserURL(ctx context.Context, ep Endpoint, next string) (string, error)

BrowserURL is a link that signs a browser in to the runtime and then opens next (a path such as "/#sessions/new"). The link works once, for ten minutes.

func Engine

func Engine(ctx context.Context, base *config.Config, dir, token string, lockFD int, log *slog.Logger) error

func OutdatedNote added in v2.6.0

func OutdatedNote(runtime version.Info) string

OutdatedNote explains a running runtime that is older than this binary, or returns "" when it is not (or the builds cannot be ordered). Nothing stops the old runtime automatically: it may be running sessions.

func SharePath added in v2.7.0

func SharePath(ctx context.Context, ep Endpoint) (bool, error)

SharePath hands the runtime this process's PATH. It reports whether the runtime gained any directories. An older runtime without the route is left alone.

func StateDir

func StateDir() (string, error)

func Stop

func Stop(ctx context.Context) error

func TmuxDir added in v2.6.0

func TmuxDir() (string, error)

TmuxDir is the private tmux directory the local runtime's sessions use. A process whose TMUX_TMPDIR is this directory runs inside one of them.

Types

type Endpoint

type Endpoint struct {
	URL       string       `json:"url"`
	Token     string       `json:"token"`
	Instance  string       `json:"instance"`
	PID       int          `json:"pid"`
	StartedAt string       `json:"started_at"`
	Build     version.Info `json:"build"`
	TmuxDir   string       `json:"tmux_dir"`
}

func Ensure

func Ensure(ctx context.Context, binary string, base *config.Config) (Endpoint, error)

func Peek added in v2.4.0

func Peek(ctx context.Context) (Endpoint, bool)

Peek reports the local runtime's endpoint, token included, if one is already healthy — without starting one. Unlike StatusOf (whose Endpoint has the token stripped for safe display), a caller here is about to make authenticated requests, e.g. `lectern doctor`'s live checks. It never starts a new engine; that's Ensure's job.

type Status

type Status struct {
	State    string       `json:"state"`
	Endpoint *Endpoint    `json:"endpoint,omitempty"`
	Health   any          `json:"health,omitempty"`
	Detail   string       `json:"detail,omitempty"`
	Version  string       `json:"version,omitempty"`
	Build    version.Info `json:"build,omitempty"`
	// CLIVersion is the binary asking; Outdated says the running runtime is
	// an older build than it. A running runtime is reused whatever its
	// version, so this is how a stale one becomes visible.
	CLIVersion string `json:"cli_version,omitempty"`
	Outdated   bool   `json:"outdated,omitempty"`
}

func StatusOf

func StatusOf(ctx context.Context) (Status, error)

Jump to

Keyboard shortcuts

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