Documentation
¶
Index ¶
- func DiscoverAll() ([]*models.Session, error)
- func DiscoverFlowJobs() ([]*models.Session, error)
- func DiscoverFlowJobsWithNodes(nodes []*workspace.WorkspaceNode) ([]*models.Session, error)
- func DiscoverFlowJobsWithProvider(provider *workspace.Provider, coreCfg *coreconfig.Config) ([]*models.Session, error)
- func DiscoverJobsFromFiles(dirs []string) ([]*models.Session, error)
- func DiscoverLiveSessions() ([]*models.Session, error)
- func DiscoverOpenCodeSessions() ([]*models.Session, error)
- func GetJobStatus(jobFilePath string) (string, error)
- type FileSystemRegistry
- type Registry
- type SessionMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiscoverAll ¶ added in v0.6.2
DiscoverAll returns all active sessions from all sources (Interactive, Flow Jobs, OpenCode). This is the main entry point for LocalClient and can be used as a complete fallback when the daemon is not available.
func DiscoverFlowJobs ¶ added in v0.6.2
DiscoverFlowJobs scans all workspace directories for job files (plans, chats, notes). This is the core-level implementation that mirrors the hooks discovery logic but without caching (caching is handled at the daemon level).
NOTE: This function performs a full workspace discovery which is expensive. For daemon use, prefer DiscoverFlowJobsWithNodes which reuses cached workspace data.
func DiscoverFlowJobsWithNodes ¶ added in v0.6.2
func DiscoverFlowJobsWithNodes(nodes []*workspace.WorkspaceNode) ([]*models.Session, error)
DiscoverFlowJobsWithNodes scans workspace directories for job files using pre-built nodes. This is much more efficient than DiscoverFlowJobs as it avoids the expensive workspace discovery step. Use this when you already have workspace data (e.g., from daemon cache).
func DiscoverFlowJobsWithProvider ¶ added in v0.6.2
func DiscoverFlowJobsWithProvider(provider *workspace.Provider, coreCfg *coreconfig.Config) ([]*models.Session, error)
DiscoverFlowJobsWithProvider scans workspace directories for job files using an existing provider. This is the core implementation shared by DiscoverFlowJobs and DiscoverFlowJobsWithNodes.
func DiscoverJobsFromFiles ¶ added in v0.6.2
DiscoverJobsFromFiles scans directories for job files and returns sessions. This uses the lightweight frontmatter parser to avoid importing flow packages.
func DiscoverLiveSessions ¶ added in v0.6.2
DiscoverLiveSessions scans ~/.grove/hooks/sessions/ directory and returns live sessions. A session is considered live if its PID is still alive. This is a core-only implementation without storage dependencies.
func DiscoverOpenCodeSessions ¶ added in v0.6.2
DiscoverOpenCodeSessions scans ~/.local/share/opencode/storage/ for OpenCode sessions.
func GetJobStatus ¶ added in v0.6.2
GetJobStatus reads the current status of a job file.
Types ¶
type FileSystemRegistry ¶
type FileSystemRegistry struct {
// contains filtered or unexported fields
}
FileSystemRegistry implements Registry using the filesystem at ~/.grove/hooks/sessions/
func NewFileSystemRegistry ¶
func NewFileSystemRegistry() (*FileSystemRegistry, error)
func (*FileSystemRegistry) Find ¶
func (r *FileSystemRegistry) Find(jobID string) (*SessionMetadata, error)
Find searches for a session by Grove job ID in the SessionMetadata.
func (*FileSystemRegistry) IsAlive ¶
func (r *FileSystemRegistry) IsAlive(sessionID string) (bool, error)
IsAlive checks if a session with the given ID is still running.
func (*FileSystemRegistry) Register ¶
func (r *FileSystemRegistry) Register(metadata SessionMetadata) error
Register creates the tracking files for a live session.
type Registry ¶
type Registry interface {
Register(metadata SessionMetadata) error
IsAlive(sessionID string) (bool, error)
Find(jobID string) (*SessionMetadata, error)
}
Registry defines the interface for managing live session tracking.
type SessionMetadata ¶
type SessionMetadata struct {
SessionID string `json:"session_id"`
ClaudeSessionID string `json:"claude_session_id,omitempty"` // For Claude provider (or native agent ID)
Provider string `json:"provider"` // "claude" or "codex"
PID int `json:"pid"`
Repo string `json:"repo,omitempty"`
Branch string `json:"branch,omitempty"`
TmuxKey string `json:"tmux_key,omitempty"`
WorkingDirectory string `json:"working_directory"`
User string `json:"user"`
StartedAt time.Time `json:"started_at"`
TranscriptPath string `json:"transcript_path,omitempty"`
Type string `json:"type,omitempty"`
JobTitle string `json:"job_title,omitempty"`
PlanName string `json:"plan_name,omitempty"`
JobFilePath string `json:"job_file_path,omitempty"`
}
SessionMetadata is the data stored on disk to track a live session.