session

package
v0.260414.2000 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeProjectPath

func DecodeProjectPath(encoded string) string

DecodeProjectPath decodes an encoded project path back to the original path -root-tingly-polish -> /root/tingly-polish

func WithFilter

func WithFilter(sessions []common.SessionMetadata, filter SessionFilter) []common.SessionMetadata

WithFilter creates a new slice with only sessions that pass the filter

Types

type ProjectStats

type ProjectStats struct {
	TotalSessions     int       `json:"total_sessions"`
	ActiveSessions    int       `json:"active_sessions"`
	CompletedSessions int       `json:"completed_sessions"`
	ErrorSessions     int       `json:"error_sessions"`
	TotalCostUSD      float64   `json:"total_cost_usd"`
	TotalTokens       int64     `json:"total_tokens"`
	OldestSession     time.Time `json:"oldest_session"`
	NewestSession     time.Time `json:"newest_session"`
}

GetProjectStats returns statistics about sessions in a project

type SessionFilter

type SessionFilter func(metadata common.SessionMetadata) bool

SessionFilter defines a function to filter sessions Returns true if the session should be included, false to exclude

func CombineFilters

func CombineFilters(filters ...SessionFilter) SessionFilter

CombineFilters returns a filter that only passes if all filters pass

func DefaultSessionFilter

func DefaultSessionFilter() SessionFilter

DefaultSessionFilter returns the default filter that excludes: - Meta messages (isMeta=true) - Empty or very short content (< 5 chars) - Sessions with no meaningful content

func ExcludePatterns

func ExcludePatterns(patterns []string) SessionFilter

ExcludePatterns returns a filter that excludes sessions containing specific patterns

func ExcludeShortContent

func ExcludeShortContent(minLength int) SessionFilter

ExcludeShortContent returns a filter that excludes sessions with very short content

type Store

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

Store implements session.Store for Claude Code

func NewStore

func NewStore(projectsDir string) (*Store, error)

NewStore creates a new Claude session store

func (*Store) GetProjectSessionsDir

func (s *Store) GetProjectSessionsDir(projectPath string) string

GetProjectSessionsDir returns the directory where sessions are stored for a project

func (*Store) GetProjectStats

func (s *Store) GetProjectStats(ctx context.Context, projectPath string) (*ProjectStats, error)

GetProjectStats returns statistics for a project

func (*Store) GetProjectsDir

func (s *Store) GetProjectsDir() string

GetProjectsDir returns the base projects directory

func (*Store) GetRecentSessions

func (s *Store) GetRecentSessions(ctx context.Context, projectPath string, limit int) ([]common.SessionMetadata, error)

GetRecentSessions returns the N most recent sessions

func (*Store) GetRecentSessionsFiltered

func (s *Store) GetRecentSessionsFiltered(ctx context.Context, projectPath string, limit int, filter SessionFilter) ([]common.SessionMetadata, error)

GetRecentSessionsFiltered returns the N most recent sessions that pass the filter

func (*Store) GetSession

func (s *Store) GetSession(ctx context.Context, sessionID string) (*common.SessionMetadata, error)

GetSession retrieves a specific session's metadata

func (*Store) GetSessionEvents

func (s *Store) GetSessionEvents(ctx context.Context, sessionID string, offset, limit int) ([]common.SessionEvent, error)

GetSessionEvents retrieves events from a session

func (*Store) GetSessionSummary

func (s *Store) GetSessionSummary(ctx context.Context, sessionID string, firstN, lastM int) (*common.SessionSummary, error)

GetSessionSummary returns a summary (first N and last M events)

func (*Store) ListProjects

func (s *Store) ListProjects(ctx context.Context) ([]string, error)

ListProjects returns all project directories that have sessions

func (*Store) ListSessions

func (s *Store) ListSessions(ctx context.Context, projectPath string) ([]common.SessionMetadata, error)

ListSessions returns all sessions for a project, ordered by start time (newest first)

func (*Store) ListSessionsFiltered

func (s *Store) ListSessionsFiltered(ctx context.Context, projectPath string, filter SessionFilter) ([]common.SessionMetadata, error)

ListSessionsFiltered returns sessions that pass the filter, ordered by start time (newest first)

Jump to

Keyboard shortcuts

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