transcript

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDir

func DefaultDir() (string, error)

DefaultDir returns the default history directory.

func DefaultRetention

func DefaultRetention() time.Duration

DefaultRetention returns the default prune window.

func EventsFileName

func EventsFileName() string

EventsFileName returns the relative filename for transcript events.

func PruneOlderThan

func PruneOlderThan(rootDir string, cutoff time.Time) (int, error)

PruneOlderThan removes session directories older than the cutoff.

Types

type Event

type Event struct {
	SessionID string    `json:"sessionId"`
	Seq       uint64    `json:"seq"`
	TS        time.Time `json:"ts"`
	Stream    string    `json:"stream"`
	RawBase64 string    `json:"rawBase64"`
	Text      string    `json:"text,omitempty"`
}

Event is a single transcript record.

func ReadEvents

func ReadEvents(rootDir, sessionID string) (events []Event, err error)

ReadEvents reads all events for a given session.

func ReadLiveEventsFrom

func ReadLiveEventsFrom(rootDir, sessionID string, offset int64) (events []Event, nextOffset int64, err error)

ReadLiveEventsFrom reads live transcript events from a byte offset in the append-only JSONL file.

type Meta

type Meta struct {
	SessionID string     `json:"sessionId"`
	StartedAt time.Time  `json:"startedAt"`
	ClosedAt  *time.Time `json:"closedAt,omitempty"`
}

Meta stores session metadata for discovery and pruning.

type Session

type Session struct {
	SessionID string
	Path      string
	StartedAt time.Time
	ClosedAt  *time.Time
}

Session describes one stored transcript session.

func ListSessions

func ListSessions(rootDir string) ([]Session, error)

ListSessions returns transcript sessions sorted by newest start time first.

type Store

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

Store writes transcript events to compressed and live JSONL files and keeps an in-memory ring.

func NewStore

func NewStore(opts StoreOptions) (*Store, error)

NewStore creates a transcript store for one session.

func (*Store) Append

func (s *Store) Append(stream string, chunk []byte) error

Append writes one event and updates in-memory line ring.

func (*Store) Close

func (s *Store) Close() error

Close flushes and closes the transcript.

func (*Store) SessionID

func (s *Store) SessionID() string

SessionID returns the store's session id.

func (*Store) SnapshotLines

func (s *Store) SnapshotLines() []string

SnapshotLines returns the in-memory ring in chronological order.

type StoreOptions

type StoreOptions struct {
	SessionID string
	Dir       string
	MaxLines  int
}

StoreOptions controls transcript behavior.

Jump to

Keyboard shortcuts

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