Documentation
¶
Overview ¶
Package terminalbinding locates a review terminal without changing an agent's launch options.
Index ¶
- func CMUXProcessTargets(data []byte, socket string) map[int]Target
- func CMUXSocketPath() string
- func HCProcessTargets(terminals []HCTerminal, socket string) map[int]Target
- func HCSocketPath() string
- func Remote(target Target, origin Origin) bool
- func RexExecutable() (string, error)
- func RexID(id, kind string) bool
- func RexOwners(ctx context.Context, t Target) map[int]Target
- func Snapshot(ctx context.Context, t Target) (string, error)
- func WorkspaceExecutable(kind string) string
- func ZellijOwners(t Target) map[int]Target
- type DiscoveryIssue
- type HCTerminal
- type Origin
- type Request
- type Store
- func (s *Store) Notify(id string, target Target) error
- func (s *Store) Prepare() (Request, error)
- func (s *Store) Probe(ctx context.Context, target Target, display func(string) error, ...) (resolved Target, err error)
- func (s *Store) Register(target Target) error
- func (s *Store) Resolve(ctx context.Context, id string, ...) (Target, error)
- func (s *Store) ResolveNotification(ctx context.Context, id string) (Target, error)
- func (s *Store) ResolveWithDiagnostics(ctx context.Context, id string, ...) (Target, []DiscoveryIssue, error)
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CMUXProcessTargets ¶ added in v1.5.1
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 HCProcessTargets ¶ added in v1.10.0
func HCProcessTargets(terminals []HCTerminal, socket string) map[int]Target
HCProcessTargets maps the processes that own each live local terminal. Terminals on other machines carry their machine in the address and have no local processes.
func HCSocketPath ¶ added in v1.10.0
func HCSocketPath() string
HCSocketPath follows hc's own resolution: the terminal's core, an explicit override, the config file, then the runtime directory of the session.
func Remote ¶ added in v1.2.0
Remote suppresses GUI launchers only on positive evidence. A current, unique tmux client supersedes the wrapper's startup environment after reattachment.
func RexExecutable ¶ added in v1.10.1
RexExecutable also finds the CLI bundled with the macOS preview app.
func RexID ¶ added in v1.10.1
RexID accepts only full IDs, never labels, indexes, or ambiguous suffixes.
func RexOwners ¶ added in v1.10.1
RexOwners uses only the inherited local endpoint and full terminal identity.
func WorkspaceExecutable ¶ added in v1.10.1
func ZellijOwners ¶ added in v1.5.1
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 DiscoveryIssue ¶ added in v1.10.1
DiscoveryIssue explains a connection that could not supply a complete inventory. It does not invalidate inventories from other reachable connections.
type HCTerminal ¶ added in v1.10.0
type HCTerminal struct {
Address string `json:"address"`
State string `json:"state"`
PID int `json:"pid"`
Foreground *struct{ PID int } `json:"foreground"`
Labels map[string]string `json:"labels"`
}
HCTerminal is the part of a herdr-core terminal record that locates it.
func DecodeHCTerminals ¶ added in v1.10.0
func DecodeHCTerminals(data []byte) ([]HCTerminal, error)
DecodeHCTerminals reads the JSON-RPC reply to a terminal.list request.
func HCTerminals ¶ added in v1.10.0
func HCTerminals(ctx context.Context, t Target) ([]HCTerminal, error)
HCTerminals lists the core's live terminals through `hc connect`, which returns the full records that `hc ls` leaves out.
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
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) 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 ¶
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 searches visible mux screens. It consumes the request once a destination is selected, before the caller launches its UI.
func (*Store) ResolveNotification ¶ added in v1.2.0
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"`
SourceID string `json:"source_id,omitempty"`
RuntimeID string `json:"runtime_id,omitempty"`
}
Target identifies a multiplexer pane or a notifying client outside a multiplexer.
func CMUXTargets ¶ added in v1.10.1
CMUXTargets includes surfaces without process metadata, for marker discovery.
func FromEnvironment ¶
FromEnvironment is used in the real terminal, never to infer a daemon client's identity.
func HCEnvironment ¶ added in v1.10.0
func HCEnvironment() Target
HCEnvironment is used in the real terminal, like the other multiplexers.
func RexEnvironment ¶ added in v1.10.1
func RexEnvironment() Target
func WorkspaceEnvironment ¶ added in v1.10.1
WorkspaceEnvironment captures public host identity, never activity tokens or pairing credentials. Orca does not expose local process ownership.
func ZellijEnvironment ¶ added in v1.5.1
func ZellijEnvironment() Target
ZellijEnvironment records the session name and optional socket directory.