- Enrich Session with Workspace, Label, WaitingSince fields - Protocol types: Request, Response, SessionInfo, SwitchArgs, LabelArgs - SessionRegistry with WaitingSince transition tracking - LabelStore with JSON file persistence
48 lines
1.0 KiB
Go
48 lines
1.0 KiB
Go
package main
|
|
|
|
import "time"
|
|
|
|
// SessionState represents the current activity state of a Claude Code session.
|
|
type SessionState int
|
|
|
|
const (
|
|
Working SessionState = iota
|
|
NeedsInput
|
|
Idle
|
|
Unknown
|
|
)
|
|
|
|
func (s SessionState) String() string {
|
|
switch s {
|
|
case Working:
|
|
return "Working"
|
|
case NeedsInput:
|
|
return "Needs Input"
|
|
case Idle:
|
|
return "Idle"
|
|
default:
|
|
return "Unknown"
|
|
}
|
|
}
|
|
|
|
// Process represents a Claude Code OS process detected via /proc.
|
|
type Process struct {
|
|
PID int
|
|
Cmd []string // cmdline arguments
|
|
Cwd string // readlink /proc/PID/cwd
|
|
}
|
|
|
|
// Session represents a Claude Code session enriched with JSONL metadata.
|
|
type Session struct {
|
|
Process Process
|
|
SessionID string
|
|
GitBranch string
|
|
State SessionState
|
|
Preview string // last lines of output
|
|
CwdPath string // process cwd
|
|
Worktree string // git worktree (may differ from cwd)
|
|
Workspace string // i3 workspace number
|
|
Label string // user-assigned label
|
|
WaitingSince *time.Time // when session started waiting for input
|
|
}
|