controlsocket

package
v0.149.5 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package controlsocket transports the wing control contract over owner-only local IPC.

Index

Constants

View Source
const NativeTerminalCapability = "native-terminal-v1"
View Source
const SocketName = "control.sock"

Variables

This section is empty.

Functions

func DialAttachment

func DialAttachment(ctx context.Context, dir string, hello Hello) (*SessionStream, Welcome, error)

func DialAttachmentPath

func DialAttachmentPath(ctx context.Context, path string, hello Hello) (*SessionStream, Welcome, error)

func Path

func Path(dir string) (string, error)

Path returns the derived endpoint, never a caller-writable socket pointer.

Types

type AdmissionError added in v0.149.4

type AdmissionError struct {
	Err        error
	Diagnostic *control.LaunchDiagnostic
}

AdmissionError distinguishes an authoritative hello refusal from a failed connection while preserving the legacy text for non-launch callers.

func (*AdmissionError) Error added in v0.149.4

func (e *AdmissionError) Error() string

func (*AdmissionError) LaunchDiagnostic added in v0.149.4

func (e *AdmissionError) LaunchDiagnostic() control.LaunchDiagnostic

func (*AdmissionError) Unwrap added in v0.149.4

func (e *AdmissionError) Unwrap() error

type AttachBind

type AttachBind func(context.Context, Hello) (Welcome, AttachHandler, error)

type AttachHandler

type AttachHandler func(context.Context, *SessionStream) error

type Attachment

type Attachment struct {
	NativeTerminal bool   `json:"native_terminal,omitempty"`
	Session        string `json:"session"`
	ReadOnly       bool   `json:"read_only,omitempty"`
	Takeover       bool   `json:"takeover,omitempty"`
	Rows           uint32 `json:"rows,omitempty"`
	Cols           uint32 `json:"cols,omitempty"`
}

Attachment upgrades an authenticated wing connection to an ordered terminal stream. No egg socket, attachment token or host authority crosses this API.

type Bind

type Bind func(Hello) (Welcome, Handler, error)

type Client

type Client struct {
	Welcome Welcome
	// contains filtered or unexported fields
}

func Dial

func Dial(ctx context.Context, dir string, hello Hello) (*Client, error)

func DialPath

func DialPath(ctx context.Context, path string, hello Hello) (*Client, error)

DialPath connects to a verified SSH stream-local forward as well as local IPC. The forwarding process must belong to this UID; Hello pins the remote wing.

func (*Client) Call

func (c *Client) Call(ctx context.Context, tool string, arguments json.RawMessage) (map[string]any, bool, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Done

func (c *Client) Done() <-chan struct{}

Done signals a lost channel without requiring another tool call.

type Hello

type Hello struct {
	Version      string      `json:"version"`
	WingID       string      `json:"wing_id,omitempty"`
	Client       string      `json:"client,omitempty"`
	Unsandboxed  bool        `json:"unsandboxed,omitempty"`
	Conversation string      `json:"conversation,omitempty"`
	Execution    string      `json:"execution,omitempty"`
	Aggregate    bool        `json:"aggregate,omitempty"`
	Attach       *Attachment `json:"attach,omitempty"`
	// Scope requests a narrower ceiling from an authenticated receiving wing.
	// It never supplies identity or grants greater authority than the peer UID.
	Scope string `json:"scope,omitempty"`
}

type Server

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

func Listen

func Listen(ctx context.Context, dir, wingID string, bind Bind, attachments ...AttachBind) (*Server, error)

Listen never starts a wing. Only the wing calls it, before connecting to its relay.

func (*Server) AddCloser

func (s *Server) AddCloser(closer io.Closer)

AddCloser attaches wing-owned transports before publishing the server.

func (*Server) Close

func (s *Server) Close() error

type SessionStream

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

func (*SessionStream) Close

func (s *SessionStream) Close() error

func (*SessionStream) Recv

func (s *SessionStream) Recv() (*pb.SessionMsg, error)

func (*SessionStream) Send

func (s *SessionStream) Send(msg *pb.SessionMsg) error

type TransportError

type TransportError struct{ Err error }

TransportError distinguishes unknown delivery from authoritative tool errors.

func (*TransportError) Error

func (e *TransportError) Error() string

func (*TransportError) Unwrap

func (e *TransportError) Unwrap() error

type Welcome

type Welcome struct {
	LaunchDiagnostic *control.LaunchDiagnostic `json:"launch_diagnostic,omitempty"`
	Capabilities     []string                  `json:"capabilities,omitempty"`
	Isolation        string                    `json:"isolation,omitempty"`
	RemoteAllowed    bool                      `json:"remote_allowed,omitempty"`
	Version          string                    `json:"version"`
	WingID           string                    `json:"wing_id"`
	Principal        string                    `json:"principal,omitempty"`
	Actor            string                    `json:"actor,omitempty"`
	Grants           map[string]bool           `json:"grants"`
	Tools            map[string]bool           `json:"tools,omitempty"`
	Error            string                    `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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