Documentation
¶
Index ¶
- Constants
- Variables
- func Connect(ctx context.Context, endpoint string, start bool) (net.Conn, error)
- func CurrentTerminal() string
- func Detach(cmd *exec.Cmd)
- func Dial(ctx context.Context, endpoint string) (net.Conn, error)
- func Endpoint() (string, error)
- func Listen(endpoint string) (net.Listener, error)
- func ReadFrame(r io.Reader, value any) error
- func Requester(pid int) string
- func ResourceApproval(account, command, requester, id, name string) (string, string)
- func Serve(ctx context.Context, listener net.Listener, handler Handler) error
- func Text(s string) string
- func WriteFrame(w io.Writer, value any) error
- type Dialog
- type Handler
- type Message
- type Request
- type Sessions
- type Status
Constants ¶
const IdleTimeout = time.Hour
const MaxFrame = 8 << 20
const ProtocolVersion = 2
Variables ¶
var ErrDenied = errors.New("agent approval denied or canceled")
var ErrProtocol = errors.New("incompatible agent protocol; stop the old agent and retry")
Functions ¶
func CurrentTerminal ¶
func CurrentTerminal() string
func Requester ¶
Requester is best-effort display context, never authorization evidence. Only executable names are inspected: process arguments may contain credentials.
func ResourceApproval ¶
ResourceApproval keeps the resource name first so long account/URI labels cannot hide it. Dialog backends sanitize all displayed text before rendering.
func Serve ¶
Serve serializes commands and all session lifecycle operations. Connections are bounded; slow/abandoned clients cannot retain a session or refresh its lease.
Types ¶
type Message ¶
type Message struct {
Kind string
Data []byte `json:",omitempty"`
Error string `json:",omitempty"`
Status []Status `json:",omitempty"`
Environment []string `json:",omitempty"`
Args []string `json:",omitempty"`
}
Message multiplexes command output and interactive input without consuming stdin before the command actually asks for it.
type Request ¶
type Request struct {
Terminal string
PID int
Version int
Action string
Args []string
Settings map[string]any
Directory string
Environment []string
Dialog string
Pinentry string
}
Request travels only over owner-restricted local IPC, never a network listener.
type Sessions ¶
type Sessions struct {
// contains filtered or unexported fields
}
Sessions is owned by the serialized dispatcher. Status never extends a lease.