Documentation
¶
Overview ¶
Package session provides shared session management for agent runners. Sessions track the state of agent runs (Claude Code, Codex, etc.) and persist metadata to disk for later retrieval.
Index ¶
- Constants
- type Manager
- func (m *Manager) CleanupOldSessions(maxAge time.Duration) error
- func (m *Manager) Create(workspace, runID, name string, grants []string) (*Session, error)
- func (m *Manager) Delete(id string) error
- func (m *Manager) Dir() string
- func (m *Manager) Get(idOrName string) (*Session, error)
- func (m *Manager) GetByWorkspace(workspace string) (*Session, error)
- func (m *Manager) List() ([]*Session, error)
- func (m *Manager) Touch(id string) error
- func (m *Manager) UpdateState(id, state string) error
- type Session
Constants ¶
View Source
const ( StateRunning = "running" StateStopped = "stopped" StateCompleted = "completed" )
State constants for session lifecycle.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles session persistence and lookup.
func NewManager ¶
NewManager creates a session manager for the given directory.
func (*Manager) CleanupOldSessions ¶
CleanupOldSessions removes sessions older than the given duration.
func (*Manager) GetByWorkspace ¶
GetByWorkspace returns the most recent session for a workspace.
func (*Manager) UpdateState ¶
UpdateState updates the state of a session.
type Session ¶
type Session struct {
ID string `json:"id"`
Name string `json:"name"`
Workspace string `json:"workspace"`
RunID string `json:"runId"`
Grants []string `json:"grants"`
CreatedAt time.Time `json:"createdAt"`
LastAccessedAt time.Time `json:"lastAccessedAt"`
State string `json:"state"` // "running", "stopped", "completed"
}
Session represents an agent session (Claude Code, Codex, etc.).
Click to show internal directories.
Click to hide internal directories.