Documentation
¶
Overview ¶
Package driver exposes TUICast through a language-neutral JSON-RPC protocol.
Index ¶
- type ConnectionOptions
- type ConnectionSnapshot
- type ConnectorFactory
- type CursorMatcher
- type LineMatcher
- type Matcher
- type Server
- func (s *Server) AcquireSessionControl(id uint64) (*SessionControl, error)
- func (s *Server) Close() error
- func (s *Server) DriverSnapshot() Snapshot
- func (s *Server) Run(input io.Reader, output io.Writer) error
- func (s *Server) SessionScreens(ctx context.Context, id uint64) (<-chan tuicast.Screen, error)
- type SessionControl
- func (c *SessionControl) Press(key tuicast.Key, modifiers ...tuicast.KeyModifier) error
- func (c *SessionControl) Release()
- func (c *SessionControl) Screen() tuicast.Screen
- func (c *SessionControl) Send(data []byte) error
- func (c *SessionControl) WaitFor(ctx context.Context, matcher tuicast.ScreenMatcher) (tuicast.Screen, error)
- type SessionSnapshot
- type Snapshot
- type TerminalFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionOptions ¶
type ConnectionOptions struct {
Protocol string `json:"protocol"`
Address string `json:"address"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
PrivateKey string `json:"privateKey,omitempty"`
PrivateKeyPassphrase string `json:"privateKeyPassphrase,omitempty"`
KnownHostsFile string `json:"knownHostsFile,omitempty"`
HostKeyFingerprint string `json:"hostKeyFingerprint,omitempty"`
InsecureSkipHostKeyCheck bool `json:"insecureSkipHostKeyCheck,omitempty"`
ConnectTimeoutMilliseconds int64 `json:"connectTimeoutMilliseconds,omitempty"`
}
ConnectionOptions describes a transport connection requested through the driver. SSH host-key verification must use either KnownHostsFile, HostKeyFingerprint, or the explicit insecure option.
type ConnectionSnapshot ¶
type ConnectionSnapshot struct {
ID uint64 `json:"id"`
Protocol string `json:"protocol"`
Address string `json:"address"`
}
ConnectionSnapshot contains non-sensitive connection metadata.
type ConnectorFactory ¶
type ConnectorFactory func(ConnectionOptions) (tuicast.Connector, error)
ConnectorFactory creates concrete transport connectors at the driver composition boundary.
type CursorMatcher ¶
type CursorMatcher = tuicast.CursorMatcherSpec
CursorMatcher describes an expected cursor position.
type LineMatcher ¶
type LineMatcher = tuicast.LineMatcherSpec
LineMatcher describes an exact screen-row expectation.
type Matcher ¶
type Matcher = tuicast.MatcherSpec
Matcher describes a serializable screen expectation. Exactly one field must be set.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server owns the JSON-RPC object registry and delegates terminal behavior to the TUICast library.
func New ¶
func New(logger *slog.Logger, connectors ConnectorFactory, terminals TerminalFactory) (*Server, error)
New creates a driver server using injected concrete factories.
func (*Server) AcquireSessionControl ¶
func (s *Server) AcquireSessionControl(id uint64) (*SessionControl, error)
AcquireSessionControl acquires exclusive input control for a session.
func (*Server) DriverSnapshot ¶
DriverSnapshot returns a detached view that never contains connection credentials or terminal screen contents.
type SessionControl ¶
type SessionControl struct {
// contains filtered or unexported fields
}
SessionControl grants one caller exclusive input control over a registered driver session. Release returns input control to JSON-RPC clients.
func (*SessionControl) Press ¶
func (c *SessionControl) Press(key tuicast.Key, modifiers ...tuicast.KeyModifier) error
Press sends a named key through the controlled session.
func (*SessionControl) Release ¶
func (c *SessionControl) Release()
Release relinquishes exclusive control. It is idempotent.
func (*SessionControl) Screen ¶
func (c *SessionControl) Screen() tuicast.Screen
Screen returns the controlled session's current detached screen.
func (*SessionControl) Send ¶
func (c *SessionControl) Send(data []byte) error
Send writes terminal input through the controlled session.
func (*SessionControl) WaitFor ¶
func (c *SessionControl) WaitFor(ctx context.Context, matcher tuicast.ScreenMatcher) (tuicast.Screen, error)
WaitFor waits for a screen condition on the controlled session.
type SessionSnapshot ¶
type SessionSnapshot struct {
ID uint64 `json:"id"`
ConnectionID uint64 `json:"connectionId"`
Terminal string `json:"terminal"`
Width int `json:"width"`
Height int `json:"height"`
Revision uint64 `json:"revision"`
State string `json:"state"`
Error string `json:"error,omitempty"`
}
SessionSnapshot describes one registered terminal session.
type Snapshot ¶
type Snapshot struct {
State string `json:"state"`
Connections []ConnectionSnapshot `json:"connections"`
Sessions []SessionSnapshot `json:"sessions"`
}
Snapshot is a detached, UI-safe view of the driver's current object graph.