agent

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FadeHex added in v0.11.0

func FadeHex(startHex, endHex string, elapsed, duration time.Duration) string

FadeHex interpolates between two hex colors (#RRGGBB) using a square-root curve for perceptual smoothness. elapsed/duration controls the progress: 0 returns startHex, >= duration returns endHex.

func StatusFadeColor added in v0.11.0

func StatusFadeColor(s Status, lastActivity time.Time) string

StatusFadeColor returns a foreground hex color string for statuses that should fade over time. Currently only StatusIdle fades (bright grey to dark grey over 1 hour). Returns "" for statuses that don't fade.

Types

type Agent

type Agent struct {
	PID            int
	SessionID      string
	Name           string // project name, derived from WorkingDir
	ProviderName   string // "claude", "codex"
	SessionFile    string // path to conversation log
	Model          string // e.g. "claude-opus-4-6[1m]"
	PermissionMode string
	WorkingDir     string
	Source         SourceType
	StartTime      time.Time
	Status         Status
	TMuxSession    string
	CPUPercent     float64
	MemoryMB       uint64
	GitBranch      string
	TokensIn       int64
	TokensOut      int64
	EstCostUSD     float64
	TeamName       string
	TaskID         string
	TaskSubject    string
	LastActivity   time.Time
	GroupCount     int           // number of processes grouped into this entry (0 or 1 = single)
	GroupPIDs      []int         // PIDs of grouped processes (for drill-down)
	LastAction     string        // most recent tool call, e.g. "Ed main.go", "Sh go test"
	ParentPID      int           // process tree parent (0 = top-level)
	Subagent       subagent.Info // from OTEL correlation
	Badges         []BadgeValue  // evaluated badge results from project files
	Location       string        // "local", "container", or "remote"
	SandboxName    string        // OpenShell sandbox name (remote only)
}

Agent represents a running AI coding agent session.

func (Agent) AgeTime added in v0.3.0

func (a Agent) AgeTime() time.Time

AgeTime returns the effective time used for age calculation: StartTime if available, otherwise LastActivity. Returns the zero time if neither is set.

func (Agent) FormatAge

func (a Agent) FormatAge() string

FormatAge returns a human-friendly age string based on StartTime or LastActivity.

func (Agent) FormatCPU added in v0.10.1

func (a Agent) FormatCPU() string

FormatCPU returns a human-friendly CPU percentage string.

func (Agent) FormatCost

func (a Agent) FormatCost() string

FormatCost returns the estimated cost formatted as a dollar amount.

Examples:

0.82  -> "$0.82"
12.5  -> "$12.50"
0     -> "$0.00"

func (Agent) FormatMemory

func (a Agent) FormatMemory() string

FormatMemory returns a human-friendly memory string.

Examples:

405  -> "405M"
1400 -> "1.4G"
0    -> "0M"

func (Agent) Icon

func (a Agent) Icon() string

Icon returns the status icon for this agent.

func (Agent) IsSubagent added in v0.5.0

func (a Agent) IsSubagent() bool

IsSubagent returns true if this agent is nested under another agent.

func (Agent) ShortDir

func (a Agent) ShortDir() string

ShortDir returns the parent directory name — the directory containing the project. This disambiguates agents with the same project name in different locations. The full path is available in the preview pane.

Examples:

"/Users/me/go/src/github.com/zanetworker/aimux" -> "zanetworker"
"/Users/me/projects/myapp"                          -> "projects"
"/tmp/test"                                         -> "tmp"

func (Agent) ShortModel

func (a Agent) ShortModel() string

ShortModel returns a human-friendly shortened model name.

Examples:

"claude-opus-4-6[1m]"           -> "opus-4.6"
"claude-sonnet-4-5@20250929"    -> "sonnet-4.5"
"claude-haiku-3-5"              -> "haiku-3.5"

func (Agent) ShortProject

func (a Agent) ShortProject() string

ShortProject returns the last path segment of WorkingDir.

type BadgeValue added in v0.11.0

type BadgeValue struct {
	Label string
	Value string
	Color string
}

BadgeValue is an evaluated badge for display.

type SourceType

type SourceType int

SourceType represents how an agent was launched.

const (
	SourceCLI    SourceType = iota // launched from CLI
	SourceVSCode                   // launched from VS Code extension
	SourceSDK                      // launched from SDK
)

func (SourceType) String

func (s SourceType) String() string

type Status

type Status int

Status represents the current state of an agent.

const (
	StatusActive            Status = iota // actively processing
	StatusIdle                            // idle, waiting for input
	StatusWaitingPermission               // blocked on permission prompt
	StatusError                           // crashed, context overflow, or process gone
	StatusUnknown                         // status could not be determined
)

func (Status) Icon

func (s Status) Icon() string

Icon returns a single-character icon representing the status.

func (Status) String

func (s Status) String() string

Jump to

Keyboard shortcuts

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