terminalbinding

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package terminalbinding locates a review terminal without changing an agent's launch options.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CMUXProcessTargets added in v1.5.1

func CMUXProcessTargets(data []byte, socket string) map[int]Target

CMUXProcessTargets decodes `cmux --json --id-format uuids top --all --processes`.

func CMUXSocketPath added in v1.5.1

func CMUXSocketPath() string

CMUXSocketPath supports the current state directory and the legacy socket.

func Remote added in v1.2.0

func Remote(target Target, origin Origin) bool

Remote suppresses GUI launchers only on positive evidence. A current, unique tmux client supersedes the wrapper's startup environment after reattachment.

func Snapshot

func Snapshot(ctx context.Context, t Target) (string, error)

Snapshot reads only visible pane text, without scrolling or collecting history.

func ZellijOwners added in v1.5.1

func ZellijOwners(t Target) map[int]Target

ZellijOwners finds the pane's root process below its Zellij server. Zellij's pane listing does not expose process IDs, so this requires inherited identity.

Types

type Origin added in v1.2.0

type Origin struct {
	PID             int    `json:"pid,omitempty"`
	Started         string `json:"started,omitempty"`
	SSH             bool   `json:"ssh,omitempty"`
	Terminal        string `json:"terminal,omitempty"`
	WSLDistribution string `json:"wsl_distribution,omitempty"`
}

Origin records client hints, never SSH addresses or a daemon's environment. Started guards against PID reuse when a marker is resolved later.

func CaptureOrigin added in v1.2.0

func CaptureOrigin(pid int) Origin

type Request

type Request struct {
	ID        string    `json:"id"`
	Marker    string    `json:"marker"`
	ExpiresAt time.Time `json:"expires_at"`
}

Request is the prepare response. Marker must be displayed verbatim before resolving ID.

type Store

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

func DefaultStore

func DefaultStore() *Store

func (*Store) Notify

func (s *Store) Notify(id string, target Target) error

Notify is the tfil intake. Multiple distinct destinations remain ambiguous.

func (*Store) Prepare

func (s *Store) Prepare() (Request, error)

func (*Store) Probe added in v1.3.0

func (s *Store) Probe(ctx context.Context, target Target, display func(string) error, snapshot func(context.Context, Target) (string, error)) (resolved Target, err error)

Probe checks a marker displayed in the caller's own terminal, without a wrapper registration. An empty target tests filter notifications only.

func (*Store) Register

func (s *Store) Register(target Target) error

Register records only a candidate; the marker is still needed to attribute a review.

func (*Store) Resolve

func (s *Store) Resolve(ctx context.Context, id string, snapshot func(context.Context, Target) (string, error)) (Target, error)

Resolve prefers notifications and otherwise scans only live registrations' visible screens. It consumes the request once a destination is selected, before the caller launches its UI.

func (*Store) ResolveNotification added in v1.2.0

func (s *Store) ResolveNotification(ctx context.Context, id string) (Target, error)

ResolveNotification tests the terminal filter callback without falling back to registered pane screens. It consumes the request only after a notification.

type Target

type Target struct {
	Origin    Origin `json:"origin,omitempty"`
	Kind      string `json:"kind"`
	Socket    string `json:"socket"`
	Pane      string `json:"pane"` // Surface ID for cmux.
	Workspace string `json:"workspace,omitempty"`
	Tab       string `json:"tab,omitempty"`
}

Target identifies a multiplexer pane or a notifying client outside a multiplexer.

func FromEnvironment

func FromEnvironment() (Target, error)

FromEnvironment is used in the real terminal, never to infer a daemon client's identity.

func ZellijEnvironment added in v1.5.1

func ZellijEnvironment() Target

ZellijEnvironment records the session name and optional socket directory.

func (Target) Command

func (t Target) Command(ctx context.Context, args ...string) *exec.Cmd

Command pins requests to the recorded server, regardless of daemon environment.

func (Target) Validate

func (t Target) Validate() error

Jump to

Keyboard shortcuts

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