Documentation
¶
Index ¶
- func FindSessionFile(sessionID, projectsDir string) string
- func FindSessionFileDefault(sessionID string) string
- func GetProcessCwd(pid int) (string, error)
- func MatchTmuxSession(sessions []TmuxSession, workingDir string) string
- func ScanProcesses() ([]agent.Agent, error)
- func SessionFilesForDir(workingDir string) []string
- type AgentProvider
- type Orchestrator
- type SessionInfo
- type TmuxSession
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindSessionFile ¶
FindSessionFile searches for a session JSONL file matching the given session ID within the projects directory.
func FindSessionFileDefault ¶
FindSessionFileDefault searches for a session file using the default ~/.claude/projects/ directory.
func GetProcessCwd ¶
GetProcessCwd returns the current working directory of a process. Uses `lsof -a -d cwd -p PID -Fn` which only queries the cwd file descriptor instead of listing all open files. Times out after 3 seconds to avoid blocking the discovery loop when lsof hangs on a process.
func MatchTmuxSession ¶
func MatchTmuxSession(sessions []TmuxSession, workingDir string) string
MatchTmuxSession finds a tmux session matching the "claude-<project>" naming convention based on the working directory's base name.
func ScanProcesses ¶
ScanProcesses runs `ps aux`, parses each line, and returns Instance stubs for every detected Claude process. Subagent processes (whose parent PID is also a Claude process) are automatically filtered out so that only top-level sessions appear.
func SessionFilesForDir ¶
SessionFilesForDir finds all JSONL session files associated with a working directory. Claude converts directory paths by replacing "/" with "-" to form the project directory key.
Types ¶
type AgentProvider ¶
AgentProvider is the minimal interface that the orchestrator requires from each provider. It is intentionally kept small to avoid a circular dependency between the discovery and provider packages. Any type implementing provider.Provider automatically satisfies this interface.
type Orchestrator ¶
type Orchestrator struct {
// contains filtered or unexported fields
}
Orchestrator coordinates multiple providers to produce a unified list of agents.
func NewOrchestrator ¶
func NewOrchestrator(providers ...AgentProvider) *Orchestrator
NewOrchestrator creates an orchestrator that iterates the given providers.
func (*Orchestrator) Discover ¶
func (o *Orchestrator) Discover() ([]agent.Agent, error)
Discover queries every registered provider and merges the results. Individual provider errors are silently skipped so that one failing provider does not prevent the others from returning agents.
func (*Orchestrator) ProviderFor ¶
func (o *Orchestrator) ProviderFor(name string) AgentProvider
ProviderFor returns the first provider whose Name() matches the given name, or nil if no provider matches.
type SessionInfo ¶
type SessionInfo struct {
SessionID string
GitBranch string
Model string
TokensIn int64
TokensOut int64
CacheReadTokens int64
CacheWriteTokens int64
MessageCount int
LastTimestamp time.Time
LastAction string // most recent tool call, e.g. "Ed main.go"
}
SessionInfo holds aggregated data parsed from a Claude JSONL session file.
func ParseSessionFile ¶
func ParseSessionFile(path string) (SessionInfo, error)
ParseSessionFile reads a JSONL session file and aggregates token usage across all messages.
type TmuxSession ¶
TmuxSession represents a tmux session with its name and attachment state.
func ListTmuxSessions ¶
func ListTmuxSessions() []TmuxSession
ListTmuxSessions runs `tmux list-sessions` and returns the parsed results. Returns nil if tmux is not running or not installed.