attachment

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 12 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 attachment coordinates live CLI clients of one run.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Attached

func Attached(paths state.ProjectPaths, runID string) (bool, error)

Attached reports whether a run has any live client sessions. Sessions whose liveness cannot be disproved (notably remote hosts) remain attached.

func Bind

func Bind(paths state.ProjectPaths, id, runID string) error

Bind commits the pending initiating session to a run. It also marks that run as using session-derived attachment state, replacing the legacy boolean.

func CurrentLaunchOrigin

func CurrentLaunchOrigin() model.LaunchOrigin

CurrentLaunchOrigin is the process that ran this rotari command: its parent, such as the shell or script, on this host. Like a shell's wait, wait without a selector follows the runs that the same process started.

func EnableRun

func EnableRun(paths state.ProjectPaths, runID string) error

EnableRun marks a newly started run as using session-derived attachment state. Older runs without this marker retain their lock-boolean fallback.

func Enabled

func Enabled(paths state.ProjectPaths, runID string) bool

Enabled reports whether a run has session-derived attachment state.

func Forget

func Forget(paths state.ProjectPaths, id string) error

Forget removes a stale or handled session record after the caller has applied its disconnect policy. It does not remove a live session lock.

func ForgetRun

func ForgetRun(paths state.ProjectPaths, runID string) error

ForgetRun removes a deleted run's attachment marker and the session records bound to it whose locks are not held. A live client's session is left for that client to close.

func IsAttached

func IsAttached(paths state.ProjectPaths, runID string) (bool, error)

IsAttached derives current attachment state, retaining compatibility with active runs created before session records were introduced.

func NewID

func NewID() (string, error)

NewID returns a collision-resistant identifier safe as one path element.

func SameLaunchOrigin

func SameLaunchOrigin(recorded *model.LaunchOrigin, current model.LaunchOrigin) bool

SameLaunchOrigin reports whether a run's recorded origin is current. A start time known on both sides must match, so a reused PID never matches.

Types

type Info

type Info struct {
	ID         string
	RunID      string
	PID        int
	Host       string
	Disconnect string
	Initiator  bool
	Live       bool
}

Info describes one live or unexpectedly lost client session.

func Scan

func Scan(paths state.ProjectPaths, runID string) (live, stale []Info, err error)

Scan returns live sessions and sessions proved stale on this host. A stale initiating session configured to cancel is returned so the supervisor can apply that policy; callers should treat scan errors as uncertainty.

type Session

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

Session owns a process-held advisory lock. The lock is released by the kernel on process death, including SIGKILL, and remains held while stopped.

func Open

func Open(paths state.ProjectPaths, runID, id, disconnectAction string) (*Session, error)

Open registers a client that attaches to an existing run.

func OpenPending

func OpenPending(paths state.ProjectPaths, id, disconnectAction string) (*Session, error)

OpenPending reserves an initiating client session before run startup. Bind associates it with the accepted run without releasing the process lock.

func (*Session) Close

func (session *Session) Close(reason string) error

Close releases the session and removes its record. An empty reason is used by non-initiating wait clients, which do not alter launch history.

func (*Session) ID

func (session *Session) ID() string

ID returns the stable identifier sent in the run startup request.

Jump to

Keyboard shortcuts

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