Documentation
¶
Index ¶
- func AgentCommand(agentType AgentType, agentSessionID string) (string, []string)
- func AgentContinueCommand(agentType AgentType, agentSessionID string) (string, []string)
- func SaveState(filePath string, sessions []*Session) error
- type AgentType
- type Manager
- func (m *Manager) Add(s *Session)
- func (m *Manager) CloseTerminal(s *Session) tea.Cmd
- func (m *Manager) Count() int
- func (m *Manager) Get(id string) *Session
- func (m *Manager) List() []*Session
- func (m *Manager) OpenTerminal(s *Session) tea.Cmd
- func (m *Manager) Remove(id string)
- func (m *Manager) RestartSession(s *Session) tea.Cmd
- func (m *Manager) Running() []*Session
- func (m *Manager) RunningCount() int
- func (m *Manager) StartSession(s *Session) tea.Cmd
- func (m *Manager) StopSession(sessionID string) tea.Cmd
- type PersistedSession
- type PersistedState
- type Session
- func (s *Session) ExitCode() int
- func (s *Session) HasTerminal() bool
- func (s *Session) IsRunning() bool
- func (s *Session) LastRestart() time.Time
- func (s *Session) SetExitCode(code int)
- func (s *Session) SetLastRestart(t time.Time)
- func (s *Session) SetState(state State)
- func (s *Session) SetTerminalPane(target string)
- func (s *Session) SetTmuxTarget(target string)
- func (s *Session) State() State
- func (s *Session) TerminalPane() string
- func (s *Session) TmuxTarget() string
- type SessionLostMsg
- type SessionStartedMsg
- type SessionStoppedMsg
- type State
- type TerminalClosedMsg
- type TerminalOpenedMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgentCommand ¶
AgentCommand returns the command and arguments for the agent type. If agentSessionID is non-empty, it is passed to the CLI for session tracking.
func AgentContinueCommand ¶
AgentContinueCommand returns the command and arguments to resume/continue a session. If agentSessionID is non-empty, it is used for precise session resume.
Types ¶
type AgentType ¶
type AgentType string
AgentType identifies the AI agent being run.
func AvailableAgents ¶
func AvailableAgents() []AgentType
AvailableAgents returns the agent types whose CLI binary is found in PATH.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles the lifecycle of agent sessions.
func NewManager ¶
NewManager creates a new session manager.
func (*Manager) CloseTerminal ¶
CloseTerminal closes the terminal split pane for a session.
func (*Manager) OpenTerminal ¶
OpenTerminal opens a terminal split pane in the session's tmux window.
func (*Manager) RestartSession ¶
RestartSession restarts a stopped session in a new tmux window. For Claude it uses --continue to resume the conversation; for others it starts fresh.
func (*Manager) RunningCount ¶
RunningCount returns the number of running sessions.
func (*Manager) StartSession ¶
StartSession creates and starts a new agent session in a tmux window.
type PersistedSession ¶
type PersistedSession struct {
ID string `json:"id"`
AgentType AgentType `json:"agent_type"`
AgentSessionID string `json:"agent_session_id,omitempty"`
ProjectID string `json:"project_id"`
FeatureID string `json:"feature_id"`
WorkDir string `json:"work_dir"`
State string `json:"state"`
TmuxTarget string `json:"tmux_target,omitempty"`
}
PersistedSession holds the serializable parts of a session.
func ToPersistedSession ¶
func ToPersistedSession(s *Session) PersistedSession
ToPersistedSession converts a session to its persisted form.
type PersistedState ¶
type PersistedState struct {
Version int `json:"version"`
Sessions []PersistedSession `json:"sessions"`
}
PersistedState holds all session state for persistence.
func LoadState ¶
func LoadState(filePath string) (*PersistedState, error)
LoadState loads session state from a file.
type Session ¶
type Session struct {
ID string `json:"id"`
AgentType AgentType `json:"agent_type"`
AgentSessionID string `json:"agent_session_id,omitempty"`
ProjectID string `json:"project_id"`
FeatureID string `json:"feature_id"`
WorkDir string `json:"work_dir"`
CreatedAt time.Time `json:"created_at"`
StoppedAt *time.Time `json:"stopped_at,omitempty"`
// contains filtered or unexported fields
}
Session represents a running agent session backed by a tmux window.
func NewSession ¶
NewSession creates a new session in the starting state.
func (*Session) HasTerminal ¶
HasTerminal returns true if a terminal split pane is open.
func (*Session) LastRestart ¶
LastRestart returns the timestamp of the last restart attempt.
func (*Session) SetExitCode ¶
SetExitCode records the process exit code.
func (*Session) SetLastRestart ¶
SetLastRestart records the timestamp of a restart attempt.
func (*Session) SetTerminalPane ¶
SetTerminalPane sets the tmux pane target for the terminal split.
func (*Session) SetTmuxTarget ¶
SetTmuxTarget sets the tmux target for this session.
func (*Session) TerminalPane ¶
TerminalPane returns the tmux pane target for the terminal split.
func (*Session) TmuxTarget ¶
TmuxTarget returns the tmux target (session:window) for this session.
type SessionLostMsg ¶
type SessionLostMsg struct {
SessionID string
}
SessionLostMsg is sent when a running session's tmux window disappears (e.g. after app restart). The app should attempt to restart the session.
type SessionStartedMsg ¶
type SessionStartedMsg struct {
SessionID string
}
SessionStartedMsg is sent when a session successfully starts.
type SessionStoppedMsg ¶
SessionStoppedMsg is sent when a session stops (normally or due to error).
type TerminalClosedMsg ¶
type TerminalClosedMsg struct {
SessionID string
}
TerminalClosedMsg is sent when a terminal split pane is closed.
type TerminalOpenedMsg ¶
TerminalOpenedMsg is sent when a terminal split pane is successfully opened.