Documentation
¶
Overview ¶
Package cuxdata reads cux's on-disk state. cuxdeck never links cux (its packages are internal); the JSON files under ~/.cux are the contract, and mutations go through the cux CLI so business rules stay in one place.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClaudeProjectsDir ¶
func ClaudeProjectsDir() string
ClaudeProjectsDir is where Claude Code stores session transcripts.
func FindTranscript ¶
FindTranscript resolves a conversation id to its transcript path, or "" if no project holds it. IDs are validated by the caller.
func LoadUsage ¶
func LoadUsage() map[string]AccountUsage
Types ¶
type Account ¶
type AccountUsage ¶
type Conversation ¶
type Conversation struct {
ID string `json:"id"`
CWD string `json:"cwd"`
Title string `json:"title"`
UpdatedAt time.Time `json:"updatedAt"`
Active bool `json:"active"` // transcript written within the last 2 minutes
Path string `json:"-"`
}
Conversation is one Claude Code transcript on disk. Unlike Session it does not depend on the cux registry at all — it is discovered straight from ~/.claude/projects, so conversations started outside cux (desktop app tabs, plain `claude`) show up too, and a dead wrapper can never leave a ghost behind.
func LoadConversations ¶
func LoadConversations(limit int) []Conversation
LoadConversations returns the most recently touched transcripts across every project, newest first.
type Deck ¶
type Deck struct {
DeckID string `json:"deckId"` // stable machine+install identifier
Hostname string `json:"hostname"` // human label in the fleet view
OS string `json:"os"`
Version string `json:"version"` // cuxdeck version serving this deck
SnappedAt time.Time `json:"snappedAt"`
Sessions []Session `json:"sessions"`
Accounts map[string]Account `json:"accounts"`
Usage map[string]AccountUsage `json:"usage"`
Projects map[string]Project `json:"projects,omitempty"`
ActiveSlot int `json:"activeSlot"`
}
Deck is the identity and full snapshot of one machine's cux state. Every API response carries a Deck so the phone can namespace it: the fleet view is assembled client-side by merging the snapshots from several decks, with no central server holding them. DeckID is stable per machine+install so a deck keeps its identity across restarts and tunnel-address changes.
func Snapshot ¶
Snapshot reads everything the panel needs in one pass and stamps it with this machine's identity. The zero values of missing pieces (no projects, empty usage) are valid — a fresh cux install snapshots cleanly. version is the caller's build string.
clock is injected so callers/tests control SnappedAt; pass time.Now.
type Session ¶
type Session struct {
PID int `json:"pid"`
CWD string `json:"cwd"`
SessionID string `json:"sessionId,omitempty"`
Seat string `json:"seat,omitempty"`
State string `json:"state"`
Attachable bool `json:"attachable,omitempty"`
Detail string `json:"detail,omitempty"`
StartedAt time.Time `json:"startedAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
Session is one running cux wrapper, from the heartbeat registry.
func LoadSessions ¶
func LoadSessions() []Session
type State ¶
type Task ¶
type Task struct {
ID string `json:"id"`
Subject string `json:"subject"`
Status string `json:"status"`
}
Task is one entry in Claude Code's on-disk task store (~/.claude/tasks/<session-id>/<n>.json). This store is the live, authoritative state: every session that resumes the conversation — including under a different account after a cux seat swap — updates these files. Reconstructing task state from a single transcript goes stale the moment another session touches the list; this never does.