monitor

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package monitor provides a shared session enrichment layer that both the TUI and web dashboard consume. It eliminates data drift by centralizing the session discovery, classification, session-index loading, transcript reading, and git metadata enrichment into a single Snapshot function.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadLastMeaningfulLine

func ReadLastMeaningfulLine(path string) string

ReadLastMeaningfulLine reads the tail of a transcript JSONL and extracts the last human-readable content. It looks for assistant text or user messages, skipping tool outputs, base64 data, and system events.

Types

type Session

type Session struct {
	ID             string
	PID            int
	CWD            string
	State          string // "busy", "waiting", "idle", "dead"
	Project        string
	StartedAt      time.Time
	WorkingOn      string // from session index summary
	LastLine       string // last meaningful transcript line
	TranscriptPath string
	GitBranch      string
	GitDirty       bool
	MessageCount   int // from session index
}

Session is the fully-enriched session type that both TUI and web consume. It is a flat struct (no embedding) to avoid coupling with discovery.Session.

func Snapshot

func Snapshot(sessionsDir, projectsDir string) []Session

Snapshot returns a fully-enriched session list by combining data from session files, session-index.json, transcripts, and git metadata. Both TUI and web should call this instead of doing their own enrichment.

The function is synchronous; the consumer drives the refresh cadence.

Jump to

Keyboard shortcuts

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