agentactivity

package
v0.98.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 4 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 agentactivity classifies live agent terminal observations without depending on tmux, Bubble Tea, or persistent conversation storage.

Spinner glyph sets are provider-owned

Every provider file declares its own spinner pattern, even where two of them would look identical today. Sharing one is a standing bug: the sets are not the same and they drift independently as each CLI ships. Codex animates the classic ten braille dots frames; Claude, Grok and Cursor cycle the whole Braille block (U+2800–U+28FF).

A set that is too narrow does not merely miss activity, it inverts the verdict. Claude shares one shared eleven-glyph pattern with Codex until this was fixed, so the frames outside that set left the title rule unmatched; evaluation fell through to the prompt-box idle rule while subagents were still running, and the tracker turned that working→idle transition into a completed turn. Sessions reported "done" with work in flight.

When adding or revising a provider, harvest the real frames rather than assuming a set, and prefer anchoring the pattern to where the glyph actually appears — braille elsewhere in a title or task name is not a spinner.

Index

Constants

View Source
const IdleDebounce = 400 * time.Millisecond
View Source
const SkipRetentionCap = 2 * time.Minute

SkipRetentionCap bounds how long an overlay rule may retain the prior state. Retention exists so a transcript or model picker does not erase a live turn, but an overlay left open — or a rule matching chrome that never clears — would otherwise hold a confident badge forever. Past the cap the tracker admits it no longer knows rather than continuing to assert stale evidence.

Variables

This section is empty.

Functions

func Identify added in v0.94.0

func Identify(ob Observation) string

Identify returns the live program owning an agent pane when the existing tmux metadata or current UI makes that identity unambiguous. It deliberately returns an empty string for shared runtimes such as node and bun unless the current screen distinguishes the provider. Callers can retain their prior identity in that case without paying for a process-tree scan.

func Supports added in v0.94.0

func Supports(agent string) bool

Supports reports whether Sidecar has provider-owned activity evidence rules.

Types

type Observation

type Observation struct {
	Agent          string
	Screen         string
	PaneTitle      string
	CurrentCommand string
	CapturedAt     time.Time
}

type Region

type Region string
const (
	RegionScreen    Region = "screen"
	RegionLastLines Region = "last_lines"
	RegionCurrent   Region = "current_bottom"
	RegionTitle     Region = "pane_title"
)

type Result

type Result struct {
	State           State
	Evidence        string
	VisibleIdle     bool
	VisibleWorking  bool
	VisibleBlocker  bool
	SkipStateUpdate bool
	// FallbackIdle distinguishes provider-owned explicit idle evidence from the
	// conservative no-match policy for a positively identified live process.
	// Fallback idle may establish/display idle, but cannot announce completion.
	FallbackIdle bool
}

func Detect

func Detect(ob Observation) Result

Detect dispatches an observation to the expected provider probe. Keeping dispatch here lets the workspace poll remain product-neutral while each provider owns its evidence table.

func DetectAmp

func DetectAmp(ob Observation) Result

func DetectAntigravity

func DetectAntigravity(ob Observation) Result

func DetectClaude

func DetectClaude(ob Observation) Result

func DetectCodex

func DetectCodex(ob Observation) Result

DetectCodex requires live process identity before evaluating Codex-owned UI. tmux commonly reports "node" for the npm-installed Codex launcher.

func DetectCopilot

func DetectCopilot(ob Observation) Result

func DetectCursor

func DetectCursor(ob Observation) Result

func DetectGrok

func DetectGrok(ob Observation) Result

func DetectOpenCode

func DetectOpenCode(ob Observation) Result

func DetectPi

func DetectPi(ob Observation) Result

func Evaluate

func Evaluate(ob Observation, rules []Rule) Result

Evaluate applies rules in caller-supplied priority order. Rules are kept deliberately small: provider files own their evidence and ordering.

type Rule

type Rule struct {
	ID       string
	State    State
	Region   Region
	Contains []string
	// Any holds alternative corroborating groups: the rule matches when at
	// least one group has all of its literals present. It exists so a retain
	// rule can demand a distinctive phrase *and* surrounding chrome, rather
	// than firing on a word the agent might merely be discussing. Compared
	// case-insensitively, since these are rendered UI hints.
	Any    [][]string
	Regexp *regexp.Regexp
	Not    []string
	LastN  int
	Skip   bool
}

type Snapshot added in v0.96.0

type Snapshot struct {
	State        string    `json:"state"`
	Evidence     string    `json:"evidence,omitempty"`
	ChangedAt    time.Time `json:"changedAt"`
	Seen         bool      `json:"seen"`
	IdleInferred bool      `json:"idleInferred,omitempty"`
}

Snapshot is the persistable projection of a tracker. It carries only the fields that survive a restart meaningfully: transition policy timers are in-process concerns and are deliberately dropped.

type State

type State string
const (
	StateUnknown State = "unknown"
	StateIdle    State = "idle"
	StateWorking State = "working"
	StateBlocked State = "blocked"
)

type Tracker

type Tracker struct {
	State          State
	Evidence       string
	ChangedAt      time.Time
	Seen           bool
	VisibleBlocker bool
	// IdleInferred records that the current idle state came from the absence
	// of activity rather than an explicit completion marker. Providers without
	// a completion signal can never assert "done", and views use this to say so
	// instead of letting their absence from the done lane read as a bug.
	IdleInferred bool
	// contains filtered or unexported fields
}

Tracker owns transition policy while Evaluate remains state-free.

func Restore added in v0.96.0

func Restore(s Snapshot) Tracker

Restore rebuilds a tracker from persisted state. A restored idle keeps its original ChangedAt, so a turn that finished before the restart still reads as recently finished rather than as "just observed".

func (*Tracker) Acknowledge

func (t *Tracker) Acknowledge()

func (*Tracker) Apply

func (t *Tracker) Apply(result Result, now time.Time) bool

func (Tracker) DisplayState

func (t Tracker) DisplayState() string

func (*Tracker) ResetForProcessChange added in v0.94.0

func (t *Tracker) ResetForProcessChange(now time.Time)

ResetForProcessChange clears semantic state from the prior pane owner while allowing a confirmed new process's first explicit idle observation to land immediately. That first idle is initialization, not a completion event.

func (Tracker) Snapshot added in v0.96.0

func (t Tracker) Snapshot() Snapshot

Jump to

Keyboard shortcuts

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