detector

package
v0.66.16 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const OutputAgeUnknown = time.Duration(-1)

OutputAgeUnknown signals that output timing is not available.

View Source
const RecentOutputThreshold = 3 * time.Second

RecentOutputThreshold is the duration within which PTY output implies the agent is actively working. Used as a fallback when pattern matching cannot determine the state.

Variables

This section is empty.

Functions

func StripANSI

func StripANSI(content string) string

StripANSI removes ANSI escape codes from content.

Types

type AgentStatus

type AgentStatus string
const (
	StatusActive  AgentStatus = "active"
	StatusReady   AgentStatus = "ready"
	StatusUnknown AgentStatus = "unknown"
)

type Detector

type Detector struct {
	// contains filtered or unexported fields
}

func New

func New(tool string) *Detector

func (*Detector) Detect

func (d *Detector) Detect(content string, outputAge time.Duration) AgentStatus

Detect returns the detected status based on terminal content and how recently the PTY produced output. Pass OutputAgeUnknown if timing is not available.

func (*Detector) IsBusy

func (d *Detector) IsBusy(content string) bool

IsBusy returns true if the terminal content indicates the agent is actively working.

func (*Detector) IsReady

func (d *Detector) IsReady(content string) bool

IsReady returns true if the terminal shows an input prompt (agent waiting for input).

func (*Detector) NeedsApproval

func (*Detector) NeedsApproval(string) bool

NeedsApproval intentionally does not infer approval from terminal text. Approval state is too high-impact for PTY scraping: short strings like selected menu choices are indistinguishable from ordinary prompt history. Real approval status comes from hooks and the daemon approval queue.

Jump to

Keyboard shortcuts

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