imagebridge

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package imagebridge transports bounded normalized images into one live remote Coding TUI without creating files or durable Runtime events.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrProtocol means a bridge frame or token violated the fixed wire contract.
	ErrProtocol = errors.New("coding image bridge: invalid protocol")
	// ErrDeadline means a bridge frame expired or requested an excessive lifetime.
	ErrDeadline = errors.New("coding image bridge: invalid deadline")
	// ErrPeer means a Unix socket peer did not match the owning user.
	ErrPeer = errors.New("coding image bridge: invalid peer")
	// ErrUnavailable means the process-owned bridge endpoint is unavailable.
	ErrUnavailable = errors.New("coding image bridge: unavailable")
	// ErrBusy means the live TUI inbox has reached its fixed capacity.
	ErrBusy = errors.New("coding image bridge: busy")
	// ErrClosed means the live bridge has stopped.
	ErrClosed = errors.New("coding image bridge: closed")
)

Functions

func Encode

func Encode(writer io.Writer, frame Frame) error

Encode writes one complete strict frame. The caller owns framing EOF, such as closing the write half of a Unix connection after this function returns.

func NewNonce

func NewNonce() (string, error)

NewNonce returns a fresh 256-bit base64url bridge nonce.

func Send

Send returns ErrUnavailable on unsupported operating systems.

func ValidateNonce

func ValidateNonce(value string) error

ValidateNonce accepts only the canonical 256-bit base64url representation.

Types

type Frame

type Frame struct {
	Image    attachment.Image
	Notice   Notice
	Deadline time.Time
}

Frame is one validated image or notice with its original absolute deadline.

func Decode

func Decode(ctx context.Context, reader io.Reader, now time.Time) (Frame, error)

Decode reads exactly one strict frame and requires EOF after its body.

type Notice

type Notice uint8

Notice is an allowlisted bridge acknowledgement.

const (
	// NoticeUnknown is the zero value and never valid on the wire.
	NoticeUnknown Notice = iota
	// NoticeAccepted confirms that the live TUI accepted an image.
	NoticeAccepted
	// NoticeBusy reports that the fixed live TUI inbox is full.
	NoticeBusy
	// NoticeRejected reports invalid image input without echoing details.
	NoticeRejected
)

type Server

type Server struct{}

Server is unavailable on unsupported operating systems.

func Listen

func Listen(context.Context, string) (*Server, error)

Listen returns ErrUnavailable on unsupported operating systems.

func (*Server) Close

func (*Server) Close() error

Close is a no-op for an unavailable Server.

func (*Server) Receive

func (*Server) Receive(context.Context) (attachment.Image, error)

Receive returns ErrUnavailable on unsupported operating systems.

Jump to

Keyboard shortcuts

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