Documentation
¶
Index ¶
- func CompositeKey(workstationID, projectID, sessionID string) string
- func GitRemoteProjectID(cwdPath string) (string, error)
- func ProjectID(cwdPath string) string
- func WorkstationID() string
- type Exchange
- type ListOptions
- type SessionMeta
- type SessionSearchResult
- type Store
- func (s *Store) CheckSessionsExist(ctx context.Context, ids []string) ([]string, error)
- func (s *Store) GetSession(ctx context.Context, id string) (*gormdb.IndexedSession, error)
- func (s *Store) GetSessionMtime(ctx context.Context, id string) (time.Time, bool, error)
- func (s *Store) ListSessions(ctx context.Context, opts ListOptions) ([]gormdb.IndexedSession, error)
- func (s *Store) SearchSessions(ctx context.Context, query string, limit int) ([]SessionSearchResult, error)
- func (s *Store) UpsertSession(ctx context.Context, session *gormdb.IndexedSession) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompositeKey ¶
CompositeKey builds the isolation key: workstation_id:project_id:session_id.
func GitRemoteProjectID ¶ added in v0.4.0
GitRemoteProjectID computes a stable 8-char project ID from the git remote origin URL and the repository-relative path of cwdPath (via git rev-parse --show-prefix). Returns "", error if cwdPath is not inside a git repo or has no remote configured.
func ProjectID ¶
ProjectID computes a deterministic project ID with directory name prefix. Tries git remote origin URL first (stable across machines and OS path layouts), falls back to SHA-256 of the absolute path if not a git repo or has no remote. Format: "dirname_xxxxxxxx" (name + 8-char hex hash)
func WorkstationID ¶
func WorkstationID() string
WorkstationID computes a deterministic 8-char hexadecimal ID from hostname + machine_id.
Types ¶
type Exchange ¶
type Exchange struct {
UserText string
AssistantText string
ToolsUsed []string
Timestamp time.Time
}
Exchange represents a user-assistant message pair.
type ListOptions ¶
type SessionMeta ¶
type SessionMeta struct {
SessionID string
ProjectPath string
GitBranch string
FirstMsgAt time.Time
LastMsgAt time.Time
Exchanges []Exchange
ToolCounts map[string]int
ExchangeCount int
}
SessionMeta holds metadata extracted from a parsed session.
func ParseSession ¶
func ParseSession(path string) (*SessionMeta, error)
ParseSession reads a Claude JSONL session file and returns parsed session metadata.
func ParseSessionReader ¶
func ParseSessionReader(r io.Reader) (*SessionMeta, error)
ParseSessionReader reads Claude JSONL session data from an io.Reader.
type SessionSearchResult ¶
type SessionSearchResult struct {
Session gormdb.IndexedSession
Rank float64
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) CheckSessionsExist ¶ added in v0.4.0
CheckSessionsExist returns the subset of provided IDs that already exist in the database.
func (*Store) GetSession ¶
GetSession retrieves by ID.
func (*Store) GetSessionMtime ¶
GetSessionMtime returns (mtime, found, error) for skip check.
func (*Store) ListSessions ¶
func (s *Store) ListSessions(ctx context.Context, opts ListOptions) ([]gormdb.IndexedSession, error)
ListSessions lists with optional WorkstationID/ProjectID filters + Limit/Offset.
func (*Store) SearchSessions ¶
func (s *Store) SearchSessions(ctx context.Context, query string, limit int) ([]SessionSearchResult, error)
SearchSessions FTS via ts_rank + websearch_to_tsquery.
func (*Store) UpsertSession ¶
UpsertSession upserts via raw SQL ON CONFLICT(id) DO UPDATE.