{"modulePath":"github.com/castingcode/tuicast","version":"v0.2.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package driver\n\nPackage driver exposes TUICast through a language-neutral JSON-RPC protocol.\n\n## Types\n\n```go\ntype ConnectionOptions struct {\n\tProtocol                   string `json:\"protocol\"`\n\tAddress                    string `json:\"address\"`\n\tUsername                   string `json:\"username,omitempty\"`\n\tPassword                   string `json:\"password,omitempty\"`\n\tPrivateKey                 string `json:\"privateKey,omitempty\"`\n\tPrivateKeyPassphrase       string `json:\"privateKeyPassphrase,omitempty\"`\n\tKnownHostsFile             string `json:\"knownHostsFile,omitempty\"`\n\tHostKeyFingerprint         string `json:\"hostKeyFingerprint,omitempty\"`\n\tInsecureSkipHostKeyCheck   bool   `json:\"insecureSkipHostKeyCheck,omitempty\"`\n\tConnectTimeoutMilliseconds int64  `json:\"connectTimeoutMilliseconds,omitempty\"`\n}\n```\nConnectionOptions describes a transport connection requested through the driver. SSH host-key verification must use either KnownHostsFile, HostKeyFingerprint, or the explicit insecure option.\n\n```go\ntype ConnectionSnapshot struct {\n\tID       uint64 `json:\"id\"`\n\tProtocol string `json:\"protocol\"`\n\tAddress  string `json:\"address\"`\n}\n```\nConnectionSnapshot contains non-sensitive connection metadata.\n\n```go\ntype ConnectorFactory func(ConnectionOptions) (tuicast.Connector, error)\n```\nConnectorFactory creates concrete transport connectors at the driver composition boundary.\n\n```go\ntype CursorMatcher = tuicast.CursorMatcherSpec\n```\nCursorMatcher describes an expected cursor position.\n\n```go\ntype LineMatcher = tuicast.LineMatcherSpec\n```\nLineMatcher describes an exact screen-row expectation.\n\n```go\ntype Matcher = tuicast.MatcherSpec\n```\nMatcher describes a serializable screen expectation. Exactly one field must be set.\n\n```go\ntype Option func(*Server)\n```\nOption configures a driver server.\n\n```go\nfunc WithDumpDirectory(directory string) Option\n```\nWithDumpDirectory writes the flight-recorder dump of each failed wait to a file in directory and returns its path in the wait error data. Wait errors include the dump inline whether or not a directory is configured.\n\n```go\ntype Server struct {\n\t// contains filtered or unexported fields\n}\n```\nServer owns the JSON-RPC object registry and delegates terminal behavior to the TUICast library.\n\n```go\nfunc New(logger *slog.Logger, connectors ConnectorFactory, terminals TerminalFactory, options ...Option) (*Server, error)\n```\nNew creates a driver server using injected concrete factories.\n\n```go\nfunc (s *Server) AcquireSessionControl(id uint64) (*SessionControl, error)\n```\nAcquireSessionControl acquires exclusive input control for a session.\n\n```go\nfunc (s *Server) Close() error\n```\nClose closes subscriptions, sessions, and connections. It is idempotent.\n\n```go\nfunc (s *Server) DriverSnapshot() Snapshot\n```\nDriverSnapshot returns a detached view that never contains connection credentials or terminal screen contents.\n\n```go\nfunc (s *Server) Run(input io.Reader, output io.Writer) error\n```\nRun serves JSON-RPC 2.0 objects from input and writes responses and notifications to output. Requests may complete out of order.\n\n```go\nfunc (s *Server) SessionScreens(ctx context.Context, id uint64) (\u003c-chan tuicast.Screen, error)\n```\nSessionScreens observes detached snapshots for a registered session.\n\n```go\ntype SessionControl struct {\n\t// contains filtered or unexported fields\n}\n```\nSessionControl grants one caller exclusive input control over a registered driver session. Release returns input control to JSON-RPC clients.\n\n```go\nfunc (c *SessionControl) Press(key tuicast.Key, modifiers ...tuicast.KeyModifier) error\n```\nPress sends a named key through the controlled session.\n\n```go\nfunc (c *SessionControl) Release()\n```\nRelease relinquishes exclusive control. It is idempotent.\n\n```go\nfunc (c *SessionControl) Screen() tuicast.Screen\n```\nScreen returns the controlled session's current detached screen.\n\n```go\nfunc (c *SessionControl) Send(data []byte) error\n```\nSend writes terminal input through the controlled session.\n\n```go\nfunc (c *SessionControl) WaitFor(ctx context.Context, matcher tuicast.ScreenMatcher) (tuicast.Screen, error)\n```\nWaitFor waits for a screen condition on the controlled session.\n\n```go\ntype SessionSnapshot struct {\n\tID           uint64 `json:\"id\"`\n\tConnectionID uint64 `json:\"connectionId\"`\n\tTerminal     string `json:\"terminal\"`\n\tWidth        int    `json:\"width\"`\n\tHeight       int    `json:\"height\"`\n\tRevision     uint64 `json:\"revision\"`\n\tState        string `json:\"state\"`\n\tError        string `json:\"error,omitempty\"`\n\t// Unsupported counts the sequences the terminal ignored, in the order they\n\t// first appeared. Sequences are named in notation such as \"CSI ? 2004 h\"\n\t// and never include control-string content.\n\tUnsupported []UnsupportedSnapshot `json:\"unsupported\"`\n}\n```\nSessionSnapshot describes one registered terminal session.\n\n```go\ntype Snapshot struct {\n\tState       string               `json:\"state\"`\n\tConnections []ConnectionSnapshot `json:\"connections\"`\n\tSessions    []SessionSnapshot    `json:\"sessions\"`\n}\n```\nSnapshot is a detached, UI-safe view of the driver's current object graph.\n\n```go\ntype TerminalFactory func(profile string, width, height int) (tuicast.Terminal, error)\n```\nTerminalFactory creates a terminal profile at the driver composition boundary.\n\n```go\ntype UnsupportedSnapshot struct {\n\tSequence string `json:\"sequence\"`\n\tCount    uint64 `json:\"count\"`\n}\n```\nUnsupportedSnapshot counts one sequence the session's terminal ignored.\n\n","path":"github.com/castingcode/tuicast/driver","name":"driver","synopsis":"Package driver exposes TUICast through a language-neutral JSON-RPC protocol.","isRedistributable":true}
