Documentation
¶
Overview ¶
Package session merges Claude's registry, agentbar's hook state, and the transcript tail into the rows the sidebar shows. It is pure: all IO is injected through Deps so the merge rules are unit-testable.
Index ¶
Constants ¶
const ( SourceHook = "hook" SourceRegistry = "registry" SourceTranscript = "transcript" SourceNone = "none" )
Where a session's status came from, most to least trusted.
Variables ¶
This section is empty.
Functions ¶
func Age ¶
Age is how long ago t was, coarse: "5m", "3h", "1d"; empty under a minute (it just happened) or for a zero time.
func Resolve ¶
func Resolve(e registry.Entry, rec state.Record, hasRec bool, ti transcript.Info, now time.Time) (status, detail, source string)
Resolve decides a session's status: a hook record newer than the process start is exact; else the registry's own waiting flag; else the transcript heuristic; else unknown. Claude's "busy"/"idle" registry values are not used: they were observed stale.
Types ¶
type Agent ¶
type Agent struct {
ID string
Type string // Explore, Plan, general-purpose, a custom agent name
Description string // Claude's short task label, once its meta file exists
Model string
Tool string // last tool called
Detail string // last tool summary, "Bash go test ./..."
StartedAt time.Time
UpdatedAt time.Time
}
Agent is one running subagent of a session.
type Deps ¶
type Deps struct {
Registry []registry.Entry
States map[string]state.Record
Agents map[string][]state.Agent // by session id
Transcript func(cwd, sessionID string) transcript.Info
AgentMeta func(cwd, sessionID, agentID string) transcript.Meta
Now time.Time
}
Deps are the inputs Build merges.
type Session ¶
type Session struct {
ID string // Claude session id
PID int
CWD string
Project string // display name for the group header
Name string // Claude's own display name, e.g. "miivo-ef"
Title string // aiTitle → first prompt → Name
Model string
Branch string
ContextTokens int64
Status string // state.Status*
Detail string // permission detail, error message, ...
Source string // Source*
StartedAt time.Time
LastActivity time.Time
InTmux bool
TmuxSession string
TmuxWindowID string
TmuxPaneID string
TmuxTarget string // "work:2.1" display label, filled in by the UI from tmux
Agents []Agent // running subagents, oldest first
}
Session is one row in the sidebar.