Documentation
¶
Index ¶
- func IsScreenSnapshotFrame(data []byte) bool
- func IsServeSubcommand(arg string) bool
- func PrepareSessionInjectMode(listenAddr, sessionID string) error
- func ProcessAlive(pid int) bool
- func ReadSnapshot(listenAddr, sessionID string) (frame string, scrollback string, cols, rows int, err error)
- func RemoveRegistry(home, sessionID string)
- func RemoveRegistryIfMatch(home, sessionID, listenAddr string, pid int)
- func RenderObserverFrame(data []byte, cols, rows int) []byte
- func RenderSnapshotOutput(frame, scrollback string, cols, rows int) string
- func RenderSnapshotScrollback(raw string, cols, rows int) string
- func RenderVTStateToText(vt vt10x.Terminal, cols, rows int) ([]byte, bool)
- func ReserveCustomSessionID(home, sessionID string) (func(), error)
- func ReserveRegistrySessionID(home string) (string, func(), error)
- func SanitizeForPrint(data string) string
- func ScreenSnapshotToText(data []byte, cols, rows int) ([]byte, bool)
- func ServeSession(ctx context.Context, opts ServeOptions) error
- func ServeSubcommand(argv []string) string
- func SlugifyCommandLine(argv []string) string
- func SnapshotText(listenAddr, sessionID string) (string, error)
- func TCPReachable(addr string) bool
- func TTYWatchHome() (string, error)
- func WriteRegistry(home string, entry RegistryEntry) error
- type EphemeralSession
- func (s *EphemeralSession) Entry() *RegistryEntry
- func (s *EphemeralSession) Kill() error
- func (s *EphemeralSession) Send(message string) error
- func (s *EphemeralSession) Snapshot() (string, error)
- func (s *EphemeralSession) StartDetached(ctx context.Context, binaryPath string) error
- func (s *EphemeralSession) StartInProcess(ctx context.Context) error
- func (s *EphemeralSession) WaitWritable(provider ttyrunner.Provider, timeout time.Duration) ttyrunner.WritableStatus
- type RegistryEntry
- type ServeOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsScreenSnapshotFrame ¶
IsScreenSnapshotFrame reports ptywrap screen snapshot binary frames.
func IsServeSubcommand ¶
IsServeSubcommand reports whether arg is a slug-based serve reexec token.
func PrepareSessionInjectMode ¶
PrepareSessionInjectMode disables canonical mode before injecting input.
func ProcessAlive ¶
ProcessAlive reports whether pid responds to signal 0.
func ReadSnapshot ¶
func ReadSnapshot(listenAddr, sessionID string) (frame string, scrollback string, cols, rows int, err error)
ReadSnapshot fetches the current screen frame and scrollback for a live session.
func RemoveRegistry ¶
func RemoveRegistry(home, sessionID string)
RemoveRegistry deletes the registry file for a session.
func RemoveRegistryIfMatch ¶
RemoveRegistryIfMatch deletes the registry file only when the on-disk entry still belongs to the caller (same listen address and pid). Stale __serve__ cleanup can otherwise delete a newer session that reused the same session id.
func RenderObserverFrame ¶
RenderObserverFrame converts observer-mode PTY bytes to visible text without CSI/C0 leaks.
func RenderSnapshotOutput ¶
RenderSnapshotOutput converts a ptywrap screen snapshot frame and/or raw scrollback into printable snapshot text, matching the screen attach pipeline used by run.
func RenderSnapshotScrollback ¶
RenderSnapshotScrollback converts accumulated scrollback to printable snapshot text.
func RenderVTStateToText ¶
RenderVTStateToText extracts printable lines from a vt10x terminal state.
func ReserveCustomSessionID ¶
ReserveCustomSessionID validates id and ensures it is not held by a live session. Stale registry entries are pruned so the id can be reused.
func ReserveRegistrySessionID ¶
ReserveRegistrySessionID returns the next session-N id under flock.
func SanitizeForPrint ¶
SanitizeForPrint strips CSI, OSC, and C0 control sequences except \n \r \t.
func ScreenSnapshotToText ¶
ScreenSnapshotToText renders a screen snapshot frame to plain text.
func ServeSession ¶
func ServeSession(ctx context.Context, opts ServeOptions) error
ServeSession runs the embedded ptywrap HTTP server until the command exits.
func ServeSubcommand ¶
ServeSubcommand wraps SlugifyCommandLine as the internal reexec argv token.
func SlugifyCommandLine ¶
SlugifyCommandLine produces a stable slug from a session command argv.
func SnapshotText ¶
SnapshotText returns rendered printable snapshot text for a live session.
func TCPReachable ¶
TCPReachable reports whether a TCP listen address accepts connections.
func TTYWatchHome ¶
TTYWatchHome returns the tty-watch data directory.
func WriteRegistry ¶
func WriteRegistry(home string, entry RegistryEntry) error
WriteRegistry creates the registry file for a live session.
Types ¶
type EphemeralSession ¶
type EphemeralSession struct {
Home string
SessionID string
Command []string
ExtraPaths []string
// contains filtered or unexported fields
}
EphemeralSession manages a short-lived tty-watch session without CLI subprocesses.
func NewEphemeralSession ¶
func NewEphemeralSession(home, sessionID string, command []string) *EphemeralSession
NewEphemeralSession returns a session scoped to home, id, and command argv.
func (*EphemeralSession) Entry ¶
func (s *EphemeralSession) Entry() *RegistryEntry
Entry returns the current registry entry when available.
func (*EphemeralSession) Kill ¶
func (s *EphemeralSession) Kill() error
Kill terminates the session and removes its registry entry.
func (*EphemeralSession) Send ¶
func (s *EphemeralSession) Send(message string) error
Send injects follow-up text into the live session.
func (*EphemeralSession) Snapshot ¶
func (s *EphemeralSession) Snapshot() (string, error)
Snapshot returns rendered printable snapshot text.
func (*EphemeralSession) StartDetached ¶
func (s *EphemeralSession) StartDetached(ctx context.Context, binaryPath string) error
StartDetached re-executes binaryPath with a slug-based serve token.
func (*EphemeralSession) StartInProcess ¶
func (s *EphemeralSession) StartInProcess(ctx context.Context) error
StartInProcess launches ServeSession in the current process.
func (*EphemeralSession) WaitWritable ¶
func (s *EphemeralSession) WaitWritable(provider ttyrunner.Provider, timeout time.Duration) ttyrunner.WritableStatus
WaitWritable polls provider readiness against live scrollback.
type RegistryEntry ¶
type RegistryEntry struct {
SessionID string `json:"session_id"`
ListenAddr string `json:"listen_addr"`
PID int `json:"pid"`
CreatedAt string `json:"created_at"`
Command []string `json:"command"`
Cwd string `json:"cwd,omitempty"`
}
RegistryEntry maps a tty-watch session id to the embedded ptywrap listen address.
func ListRegistryEntries ¶
func ListRegistryEntries(home string, prune bool) ([]RegistryEntry, error)
ListRegistryEntries returns all registry entries, optionally pruning unreachable ones.
func ReadRegistry ¶
func ReadRegistry(home, sessionID string) (*RegistryEntry, error)
ReadRegistry loads a session registry entry.
func WaitForRegistryEntry ¶
func WaitForRegistryEntry(home, sessionID string, timeout time.Duration) (*RegistryEntry, error)
WaitForRegistryEntry polls until a session registry entry is available.