Documentation
¶
Index ¶
- Variables
- type AccessGate
- func (g *AccessGate) AgentResize(cols, rows int) error
- func (g *AccessGate) AgentWrite() error
- func (g *AccessGate) Controller() Controller
- func (g *AccessGate) HumanResize() error
- func (g *AccessGate) HumanWrite() error
- func (g *AccessGate) Release() (cols, rows int, restore bool)
- func (g *AccessGate) Takeover()
- type Controller
- type Manager
- func (m *Manager) Close(id string) error
- func (m *Manager) CloseExcept(keep map[string]struct{}) ([]string, error)
- func (m *Manager) Create(workspace string, opts config.Session) (*Session, error)
- func (m *Manager) Get(id string) (*Session, bool)
- func (m *Manager) List() []SessionInfo
- func (m *Manager) Release(id string) error
- func (m *Manager) ResizeAgent(id string, cols, rows int) error
- func (m *Manager) ResizeHuman(id string, cols, rows int) error
- func (m *Manager) Takeover(id string) error
- func (m *Manager) WriteAgentInput(id string, data []byte, raw bool, submit bool) error
- func (m *Manager) WriteHumanInput(id string, data []byte, raw bool, submit bool) error
- func (m *Manager) WritePTYResponse(id string, data []byte) error
- type Session
- func (s *Session) ReplayForBrowser() []byte
- func (s *Session) ReplayRaw() []byte
- func (s *Session) ScreenDiffSince(since uint64) (term.ScreenDiff, bool)
- func (s *Session) ScreenSnapshot(includeCells bool) term.ScreenSnapshot
- func (s *Session) ScreenVersion() uint64
- func (s *Session) SubscribeOutput(buf int) chan []byte
- func (s *Session) UnsubscribeOutput(ch chan []byte)
- type SessionInfo
Constants ¶
This section is empty.
Variables ¶
var ( ErrHumanControls = errors.New("human controls session") ErrObserveOnly = errors.New("human is observe-only until takeover") ErrAgentControls = errors.New("agent controls session") )
Concurrency errors for API mapping.
var ErrNotFound = errors.New("session not found")
ErrNotFound indicates an unknown session ID.
Functions ¶
This section is empty.
Types ¶
type AccessGate ¶
type AccessGate struct {
// contains filtered or unexported fields
}
AccessGate tracks concurrent agent/human access for one session.
func (*AccessGate) AgentResize ¶
func (g *AccessGate) AgentResize(cols, rows int) error
AgentResize records agent-requested dimensions and checks authority.
func (*AccessGate) AgentWrite ¶
func (g *AccessGate) AgentWrite() error
AgentWrite checks whether agent input is allowed.
func (*AccessGate) Controller ¶
func (g *AccessGate) Controller() Controller
Controller returns the active PTY controller.
func (*AccessGate) HumanResize ¶
func (g *AccessGate) HumanResize() error
HumanResize checks human resize authority.
func (*AccessGate) HumanWrite ¶
func (g *AccessGate) HumanWrite() error
HumanWrite checks whether human input is allowed.
func (*AccessGate) Release ¶
func (g *AccessGate) Release() (cols, rows int, restore bool)
Release returns control to the agent and reports whether agent size should be restored.
type Controller ¶
type Controller string
Controller identifies who may write to the PTY and resize it (R14, KTD5).
const ( ControllerAgent Controller = "agent" ControllerHuman Controller = "human" )
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns active sessions keyed by ID.
func (*Manager) CloseExcept ¶
CloseExcept terminates all sessions whose IDs are not in keep.
func (*Manager) Create ¶
Create starts a new session in workspace with optional dimension overrides.
func (*Manager) List ¶
func (m *Manager) List() []SessionInfo
List returns summaries of all active sessions sorted newest-first by creation time.
func (*Manager) Release ¶
Release returns PTY control to the agent, restoring last agent size when set (KTD5).
func (*Manager) ResizeAgent ¶
ResizeAgent updates PTY size when the agent controls the session (R2, R14).
func (*Manager) ResizeHuman ¶
ResizeHuman updates PTY size when the human controls the session (R14).
func (*Manager) WriteAgentInput ¶
WriteAgentInput sends agent bytes when the agent controls the session.
func (*Manager) WriteHumanInput ¶
WriteHumanInput sends human bytes when the human has taken over.
type Session ¶
type Session struct {
ID string
Workspace string
CLIName string
CreatedAt time.Time
LastMeaningfulActivityAt time.Time
PTY *pty.Master
Emulator *term.Emulator
Access *AccessGate
// contains filtered or unexported fields
}
Session is one workspace-bound PTY with a shared emulator (R1).
func (*Session) ReplayForBrowser ¶
ReplayForBrowser prefers raw PTY bytes (preserves truecolor) over emulator serialize.
func (*Session) ScreenDiffSince ¶
func (s *Session) ScreenDiffSince(since uint64) (term.ScreenDiff, bool)
ScreenDiffSince returns an incremental diff when the client's since version is cached.
func (*Session) ScreenSnapshot ¶
func (s *Session) ScreenSnapshot(includeCells bool) term.ScreenSnapshot
ScreenSnapshot captures the current structured screen, optionally with per-cell detail.
func (*Session) ScreenVersion ¶
ScreenVersion returns a monotonic counter bumped on PTY output.
func (*Session) SubscribeOutput ¶
SubscribeOutput registers for raw PTY output broadcasts (browser WS).
func (*Session) UnsubscribeOutput ¶
UnsubscribeOutput removes a PTY output subscriber.
type SessionInfo ¶
type SessionInfo struct {
SessionID string `json:"session_id"`
Workspace string `json:"workspace"`
CLI string `json:"cli,omitempty"`
Cols int `json:"cols"`
Rows int `json:"rows"`
Controller string `json:"controller"`
CreatedAt time.Time `json:"created_at"`
LastMeaningfulActivityAt time.Time `json:"last_meaningful_activity_at"`
}
SessionInfo is a read-only summary for discovery APIs.