- shell.nix with go and gopls for NixOS dev environment - go.mod for github.com/pieMusic/vmux module - types.go with Process, Session, SessionState (Working/NeedsInput/Idle/Unknown) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
43 lines
861 B
Go
43 lines
861 B
Go
package main
|
|
|
|
// 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)
|
|
}
|