agentdetect

package
v0.16.24 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 7 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 agentdetect tells whether a coding agent (Claude Code, Codex) runs in a tab's terminal, which conversation it is in and whether that conversation can be resumed from its transcript: the check-agent answer, read the way the previous runtime read it, on top of internal/agents/claude and internal/agents/codex.

Index

Constants

This section is empty.

Variables

View Source
var (
	Claude = Provider{ID: claude.ProviderID, DisplayName: claude.DisplayName, PanelType: claude.PanelType}
	Codex  = Provider{ID: codex.ProviderID, DisplayName: codex.DisplayName, PanelType: codex.PanelType}
)
View Source
var ErrBadRecord = claude.ErrBadRecord

ErrBadRecord: an agent's own record of a session cannot be read the way the previous runtime expected, which made it fail the request.

Functions

This section is empty.

Types

type Answer

type Answer struct {
	Running   bool
	CheckedAt int64
	// SessionID is the conversation's id as the agent recorded it (normally a string), nil when not known.
	SessionID any
	Resumable bool
	Provider  *Provider
}

Answer is what the page is told about a tab.

func (Answer) JSON

func (a Answer) JSON() map[string]any

JSON is the answer as the page reads it.

type Detector

type Detector struct {
	Home  string
	Panes Panes
	Procs Procs
	Now   func() time.Time
}

Detector looks at a tab's pane.

func New

func New(home string, panes Panes) *Detector

func (*Detector) Check

func (d *Detector) Check(name string) (Answer, error)

Check looks at the session's pane: Claude Code first, then Codex.

type Panes

type Panes interface {
	HasSession(name string) bool
	PanePID(name string) int
}

Panes is what the detector asks the terminal multiplexer.

type Procs

type Procs struct {
	Children func(pid int) []int
	Args     func(pid int) (string, bool)
	Cwd      func(pid int) string
}

Procs reads the process table; the machine's by default.

type Provider

type Provider struct {
	ID          string
	DisplayName string
	PanelType   string
}

Provider is an agent the runtime knows.

Jump to

Keyboard shortcuts

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