sessions

package
v0.0.165 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CodexHomeFromEnv

func CodexHomeFromEnv(home string) string

func Find

func Find(codexHome string, sessionID string) (string, error)

func FormatBriefJSON

func FormatBriefJSON(brief *SessionBrief) ([]byte, error)

func FormatBriefText

func FormatBriefText(brief *SessionBrief, home string) string

func FormatInfoText added in v0.0.43

func FormatInfoText(info *SessionInfo, home string, now time.Time) string

func FormatListJSON

func FormatListJSON(sessions []Session) ([]byte, error)

func FormatListTable

func FormatListTable(sessions []Session, home string, now time.Time) string

func NewestTimestamp added in v0.0.165

func NewestTimestamp(rolloutPath string) (time.Time, error)

NewestTimestamp returns the latest line-level "timestamp" in a Codex rollout JSONL file. Zero time if the file is missing, empty, or has no parseable stamps. This is the activity watermark for sink cursor / sinkability (not StartedAt, not mtime).

func PrintLog

func PrintLog(path string, w io.Writer, tail int) error

func TipForSession added in v0.0.165

func TipForSession(codexHome, sessionID string) (time.Time, error)

TipForSession resolves the rollout via Find and returns NewestTimestamp.

Types

type DisplayEvent

type DisplayEvent struct {
	Kind      string `json:"kind"`
	Text      string `json:"text"`
	Formatted string `json:"formatted"`
}

type Session

type Session struct {
	ID               string    `json:"id"`
	StartedAt        time.Time `json:"started_at"`
	CWD              string    `json:"cwd"`
	Title            string    `json:"title,omitempty"`
	Path             string    `json:"path"`
	NumDisplayEvents int       `json:"num_display_events,omitempty"`
}

func List

func List(codexHome string, limit int) ([]Session, error)

type SessionBrief

type SessionBrief struct {
	Session
	Status         string         `json:"status"`
	LineCount      int            `json:"line_count"`
	RecentMessages []DisplayEvent `json:"recent_messages"`
}

func Brief

func Brief(codexHome string, sessionID string, lastN int) (*SessionBrief, error)

type SessionInfo added in v0.0.43

type SessionInfo struct {
	Session
	Status            string         `json:"status"`
	LineCount         int            `json:"line_count"`
	NumDisplayEvents  int            `json:"num_display_events"`
	RecentMessages    []DisplayEvent `json:"recent_messages"`
	TotalInputTokens  int            `json:"total_input_tokens"`
	TotalOutputTokens int            `json:"total_output_tokens"`
}

func Info added in v0.0.43

func Info(codexHome string, sessionID string, lastN int) (*SessionInfo, error)

Jump to

Keyboard shortcuts

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