monitor

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DaemonState

type DaemonState struct {
	PID              int
	Alive            bool
	ProxyAddr        string // proxy listen address from daemon.json
	ProxyActiveConns int64  // number of currently active proxy connections
}

DaemonState holds the daemon liveness info.

type InstanceView

type InstanceView struct {
	Usage   claude.InstanceUsage
	Session *logparser.SessionState // nil if no session matched
}

InstanceView pairs a discovered instance with its matched session (if any).

type Monitor

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

Monitor owns the data-fetching and state-reconciliation cycle for the TUI.

func New

New creates a Monitor. dockerClient may be nil when Docker is unavailable.

func (*Monitor) FetchFull

func (m *Monitor) FetchFull(ctx context.Context) *Snapshot

FetchFull performs complete discovery, JSONL parsing, and hook event reading. Used for periodic full refreshes after the initial skeleton+heavy load.

func (*Monitor) FetchHeavy

func (m *Monitor) FetchHeavy(ctx context.Context, base *Snapshot) *Snapshot

FetchHeavy performs discovery, daemon RPCs, and JSONL parsing on top of a skeleton snapshot. Independent daemon RPCs run in parallel with instance discovery so the total time is max(discovery, RPCs) rather than a sum.

func (*Monitor) FetchSkeleton

func (m *Monitor) FetchSkeleton() *Snapshot

FetchSkeleton returns a minimal snapshot from cheap local file reads. The TUI renders immediately from this so the user sees the dashboard layout (daemon status, status line) while heavier work runs in the background via FetchHeavy.

type Snapshot

type Snapshot struct {
	FetchedAt  time.Time
	Err        error
	Daemon     DaemonState
	Telegram   string
	Slack      string
	Trackers   []tracker.TrackerStatus
	Instances  []InstanceView
	Panes      []claude.TmuxPane
	TotalUsage *claude.UsageSummary

	// NetworkEvents is the deduplicated ambient network activity list
	// from the daemon store, in insertion order (oldest first). The
	// renderer reverses this for newest-on-top display.
	NetworkEvents []daemon.NetworkEvent

	// ToolStats holds pre-aggregated historical tool call statistics
	// fetched from the daemon's SQLite store. Populated on fullTick only.
	ToolStats *stats.ToolStats
	// contains filtered or unexported fields
}

Snapshot holds the complete TUI display state at a point in time.

Jump to

Keyboard shortcuts

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