parser

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindSessionFile

func FindSessionFile(claudeDir, sessionID string) string

FindSessionFile finds the JSONL file for a session ID.

func SetPricingTable added in v0.3.0

func SetPricingTable(t *pricing.Table)

SetPricingTable sets the shared pricing table used for cost estimation.

Types

type SessionAggregate added in v0.4.0

type SessionAggregate struct {
	InputTokens       int     `json:"input_tokens"`
	OutputTokens      int     `json:"output_tokens"`
	CacheReadTokens   int     `json:"cache_read_tokens"`
	CacheCreateTokens int     `json:"cache_create_tokens"`
	CostUSD           float64 `json:"cost_usd"`
	SessionCount      int     `json:"session_count"`
	MessageCount      int     `json:"message_count"`
}

SessionAggregate holds aggregated token counts and cost across sessions.

func AggregateSessions added in v0.4.0

func AggregateSessions(sessions []*SessionSummary) SessionAggregate

AggregateSessions sums token counts, costs, and session/message counts.

type SessionMessage

type SessionMessage struct {
	Type      string    `json:"type"`
	Timestamp time.Time `json:"timestamp"`
	Model     string    `json:"model,omitempty"`
	Role      string    `json:"role"`
	Text      string    `json:"text"`
	TokensIn  int       `json:"tokens_in,omitempty"`
	TokensOut int       `json:"tokens_out,omitempty"`
	CacheRead int       `json:"cache_read,omitempty"`
	ToolUse   string    `json:"tool_use,omitempty"`
}

SessionMessage represents a single parsed message from a session for the detail view.

func ParseSessionDetail

func ParseSessionDetail(path string) ([]SessionMessage, error)

ParseSessionDetail returns the full message timeline for a session.

type SessionSummary

type SessionSummary struct {
	ID                string    `json:"id"`
	Project           string    `json:"project"`
	Model             string    `json:"model"`
	Title             string    `json:"title"`
	StartTime         time.Time `json:"start_time"`
	LastActivity      time.Time `json:"last_activity"`
	InputTokens       int       `json:"input_tokens"`
	OutputTokens      int       `json:"output_tokens"`
	CacheReadTokens   int       `json:"cache_read_tokens"`
	CacheCreateTokens int       `json:"cache_create_tokens"`
	EstimatedCostUSD  float64   `json:"estimated_cost_usd"`
	MessageCount      int       `json:"message_count"`
	CWD               string    `json:"cwd"`
	HasFileEdits      bool      `json:"has_file_edits"`
	CacheEfficiency   float64   `json:"cache_efficiency"`
	WasteFlags        []string  `json:"waste_flags"`
}

func DiscoverSessions

func DiscoverSessions(claudeDir string) ([]*SessionSummary, error)

func DiscoverTodaySessions

func DiscoverTodaySessions(claudeDir string) ([]*SessionSummary, error)

DiscoverTodaySessions returns only sessions with activity today.

func ParseSessionFile

func ParseSessionFile(path string) (*SessionSummary, error)

Jump to

Keyboard shortcuts

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