Documentation
¶
Index ¶
- func BuildProcessMap(claudeDir string) map[string]ProcessStatus
- func EnrichSessionsWithProcessStatus(sessions []*SessionSummary, claudeDir string, stuckThreshold time.Duration)
- func FindSessionFile(claudeDir, sessionID string) string
- func KillProcess(claudeDir string, pid int) error
- func KillSession(claudeDir, sessionID string) error
- func SetPricingTable(t *pricing.Table)
- type PIDInfo
- type ProcessStatus
- type SessionAggregate
- type SessionMessage
- type SessionSummary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildProcessMap ¶ added in v0.6.0
func BuildProcessMap(claudeDir string) map[string]ProcessStatus
BuildProcessMap returns a map from session ID to ProcessStatus for all running sessions.
func EnrichSessionsWithProcessStatus ¶ added in v0.6.0
func EnrichSessionsWithProcessStatus(sessions []*SessionSummary, claudeDir string, stuckThreshold time.Duration)
EnrichSessionsWithProcessStatus sets IsRunning, IsStuck, PID, and IdleMinutes on each SessionSummary based on live process data.
func FindSessionFile ¶
FindSessionFile finds the JSONL file for a session ID.
func KillProcess ¶ added in v0.6.0
KillProcess sends SIGINT to a Claude Code process by PID. It verifies the PID belongs to a known Claude session before killing.
func KillSession ¶ added in v0.6.0
KillSession sends SIGINT to the process running a given session.
func SetPricingTable ¶ added in v0.3.0
SetPricingTable sets the shared pricing table used for cost estimation.
Types ¶
type PIDInfo ¶ added in v0.6.0
type PIDInfo struct {
PID int `json:"pid"`
SessionID string `json:"sessionId"`
CWD string `json:"cwd"`
StartedAt int64 `json:"startedAt"`
Kind string `json:"kind"`
Entrypoint string `json:"entrypoint"`
Title string `json:"title,omitempty"`
Project string `json:"project,omitempty"`
}
PIDInfo represents a running Claude Code session from ~/.claude/sessions/{PID}.json.
func DiscoverPIDFiles ¶ added in v0.6.0
DiscoverPIDFiles reads ~/.claude/sessions/*.json and returns entries with running PIDs.
type ProcessStatus ¶ added in v0.6.0
ProcessStatus holds the live status of a running session process.
type SessionAggregate ¶ added in v0.4.0
type SessionAggregate struct {
InputTokens int `json:"input_tokens"`
OutputTokens int `json:"output_tokens"`
CacheReadTokens int `json:"cache_read_tokens"`
CacheCreateTokens int `json:"cache_create_tokens"`
CostUSD float64 `json:"cost_usd"`
SessionCount int `json:"session_count"`
MessageCount int `json:"message_count"`
}
SessionAggregate holds aggregated token counts and cost across sessions.
func AggregateSessions ¶ added in v0.4.0
func AggregateSessions(sessions []*SessionSummary) SessionAggregate
AggregateSessions sums token counts, costs, and session/message counts.
type SessionMessage ¶
type SessionMessage struct {
Type string `json:"type"`
Timestamp time.Time `json:"timestamp"`
Model string `json:"model,omitempty"`
Role string `json:"role"`
Text string `json:"text"`
TokensIn int `json:"tokens_in,omitempty"`
TokensOut int `json:"tokens_out,omitempty"`
CacheRead int `json:"cache_read,omitempty"`
ToolUse string `json:"tool_use,omitempty"`
}
SessionMessage represents a single parsed message from a session for the detail view.
func ParseSessionDetail ¶
func ParseSessionDetail(path string) ([]SessionMessage, error)
ParseSessionDetail returns the full message timeline for a session.
type SessionSummary ¶
type SessionSummary struct {
ID string `json:"id"`
Project string `json:"project"`
Model string `json:"model"`
Title string `json:"title"`
StartTime time.Time `json:"start_time"`
LastActivity time.Time `json:"last_activity"`
InputTokens int `json:"input_tokens"`
OutputTokens int `json:"output_tokens"`
CacheReadTokens int `json:"cache_read_tokens"`
CacheCreateTokens int `json:"cache_create_tokens"`
EstimatedCostUSD float64 `json:"estimated_cost_usd"`
MessageCount int `json:"message_count"`
CWD string `json:"cwd"`
HasFileEdits bool `json:"has_file_edits"`
CacheEfficiency float64 `json:"cache_efficiency"`
WasteFlags []string `json:"waste_flags"`
IsRunning bool `json:"is_running"`
IsStuck bool `json:"is_stuck"`
PID int `json:"pid,omitempty"`
IdleMinutes float64 `json:"idle_minutes,omitempty"`
}
func DiscoverRecentSessions ¶ added in v0.6.0
func DiscoverRecentSessions(claudeDir string, limit int) ([]*SessionSummary, error)
DiscoverRecentSessions returns at most limit sessions, sorted by file modification time. This avoids parsing all JSONL files by only parsing the most recently modified ones.
func DiscoverSessions ¶
func DiscoverSessions(claudeDir string) ([]*SessionSummary, error)
func DiscoverTodaySessions ¶
func DiscoverTodaySessions(claudeDir string) ([]*SessionSummary, error)
DiscoverTodaySessions returns only sessions with activity today.
func ParseSessionFile ¶
func ParseSessionFile(path string) (*SessionSummary, error)