holder

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 38 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 holder implements `stagent run`: it starts a program on a PTY and owns everything derived from its output — the VT screen, the on-disk scrollback and the output-based state — while serving attach/input requests from the bridge on its own local IPC endpoint and reporting state changes (never output) to the daemon.

Passthrough mode (default) mirrors the program on the local terminal like script(1); detached mode has no local terminal and the app owns the size.

Index

Constants

View Source
const (
	ExitUsage    = 2
	ExitNotFound = 127
	ExitFailure  = 1
)

Exit codes of Run for failures before the program ran.

View Source
const EnvHandoff = "STAGENT_HANDOFF"

EnvHandoff decides --handoff=auto when it is exactly "0" (no handoff) or "1" (handoff); other values are ignored.

Variables

This section is empty.

Functions

func Main

func Main(args []string) int

Main is the `stagent run` entry point. It returns the program's exit code.

func Run

func Run(ctx context.Context, o Options) (int, error)

Run runs a session until its program exits and returns the program's exit code. Errors before the program started come with ExitUsage, ExitNotFound or ExitFailure.

Types

type Holder

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

Holder is one running session.

type Options

type Options struct {
	Command  []string
	Detached bool
	// Handoff keeps a passthrough session running when its local terminal
	// hangs up: the session becomes detached instead of the program being
	// hung up (stagent run --handoff).
	Handoff bool
	// ID is the session id (16 lowercase hex chars); empty = random.
	ID string
	// Cols/Rows size a detached session; passthrough follows the local
	// terminal.
	Cols, Rows int
	// Dir is the program's working directory; empty = current directory.
	Dir string
	// Env is the program's environment before STAGENT_SESSION_ID (and, when
	// detached, TERM/COLORTERM defaults) are added; nil = os.Environ().
	Env    []string
	Layout *paths.Layout
	// DialDaemon connects to the daemon; nil = daemonclient.DialOrStart.
	DialDaemon func() (net.Conn, error)
	// Logf receives diagnostics; nil = stderr when detached (moved to the
	// session's log file once the program runs when stderr is a pipe or
	// socket), the holder log file in passthrough (stderr is the user's
	// terminal there).
	Logf func(format string, args ...any)
}

Options configures one session.

Jump to

Keyboard shortcuts

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