session

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

func Age(now, t time.Time) string

Age is how long ago t was, coarse: "5m", "3h", "1d"; empty under a minute (it just happened) or for a zero time.

func NeedYou

func NeedYou(n int) string

NeedYou counts sessions waiting on the user: "1 needs you", "2 need you".

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.

func Build

func Build(d Deps) []Session

Build produces one Session per registry entry, in registry order.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL