packagebridgesdk

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package packagebridgesdk is the narrow client surface available to a package-host executable. It communicates only over its inherited bridge FD.

Index

Constants

View Source
const BridgeFDEnvironment = "ANIX_CONTROL_PACKAGE_BRIDGE_FD"

Variables

View Source
var (
	ErrBridgeUnavailable  = errors.New("package bridge unavailable")
	ErrCapabilityRejected = errors.New("package bridge capability rejected")
)

Functions

This section is empty.

Types

type Client

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

func DialFile

func DialFile(_ context.Context, file *os.File) (*Client, error)

DialFile consumes a duplicate of file and leaves no filesystem-addressable bridge endpoint for a package to discover or replace.

func DialFromEnvironment

func DialFromEnvironment(ctx context.Context) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) Invoke

func (c *Client) Invoke(ctx context.Context, capability []byte, operation string, payload []byte) (Response, error)

func (*Client) OpenWebSocket

func (c *Client) OpenWebSocket(ctx context.Context, capability []byte, operation string) (WebSocketStream, error)
type Header struct {
	Name  string
	Value string
}

type Response

type Response struct {
	StatusCode uint32
	Body       []byte
	Headers    []Header
}

type WebSocketClose

type WebSocketClose struct {
	Code   uint32
	Reason string
}

type WebSocketFrame

type WebSocketFrame struct {
	Data  []byte
	Close *WebSocketClose
}

WebSocketFrame is exchanged after the private bridge opening frame. A nil Close denotes a data frame, including an empty payload.

type WebSocketStream

type WebSocketStream interface {
	Recv() (WebSocketFrame, error)
	Send(WebSocketFrame) error
	CloseSend() error
}

Jump to

Keyboard shortcuts

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