remote

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LANIP

func LANIP() string

LANIP returns the first non-loopback IPv4 address, or "" if none.

func RenderQR

func RenderQR(s string) (string, error)

RenderQR encodes s as a QR code and renders it as a multi-line string of unicode block runes suitable for a terminal. Returns error if encoding fails.

Types

type Engine

type Engine interface {
	// Send runs ONE turn with the given user text. It streams assistant text
	// deltas via onDelta (may be called many times) and returns the final text.
	Send(ctx context.Context, text string, onDelta func(string)) (string, error)
}

Engine is the minimal surface the relay needs to drive a session. The cmd layer adapts *loop.Engine to this.

type Msg

type Msg struct {
	Role string `json:"role"`
	Text string `json:"text"`
}

Msg is one transcript entry.

type Options

type Options struct {
	Addr  string    // listen addr, e.g. ":0" or "0.0.0.0:8765"; default ":0"
	Title string    // page title / shown in UI
	Log   io.Writer // activity log sink; nil => io.Discard
}

Options configure a Server.

type Server

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

Server is a local web relay that drives a single bee session over LAN.

func New

func New(eng Engine, opts Options) *Server

New builds a Server. Defaults: Addr ":0", Title "bee remote", Log io.Discard. A random bearer token is generated; it is embedded in every route as a URL path prefix so only clients that received the printed URL (or scanned the QR) can reach the agent-execution endpoint.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the http mux. All routes are scoped under /<token>/ so only clients that received the printed URL can reach the agent endpoints.

func (*Server) History

func (s *Server) History() []Msg

History returns a copy of the current transcript.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, ln net.Listener) error

Serve blocks serving on ln until ctx is done, then shuts down gracefully.

func (*Server) Start

func (s *Server) Start() (net.Listener, string, error)

Start binds a listener and returns it plus the best LAN URL to advertise. The URL includes the bearer token path so the QR code carries full auth.

func (*Server) Token

func (s *Server) Token() string

Token returns the per-instance bearer token embedded in the URL path.

Jump to

Keyboard shortcuts

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