timeline

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 13 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

Overview

Package timeline manages the persistent, append-only chronological log of session events (messages, model/effort/agent/mode transitions, and permission resolutions) stored in the timeline SQLite table, ordered by UUIDv7 id ASC.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidConfig  = errors.New("timeline: invalid configuration")
	ErrEmptySessionID = errors.New("timeline: session ID must not be empty")
	ErrInvalidEntry   = errors.New("timeline: invalid entry")
	ErrEntryNotFound  = errors.New("timeline: entry not found")
)

Sentinel errors returned by the timeline package.

Functions

func Migrate

func Migrate(ctx context.Context, db *sql.DB) error

Migrate executes SQLite migrations for timeline schema.

Types

type Entry

type Entry struct {
	api.TimelineEntry
	Message message.Message `json:"-"`
}

Entry is a single append-only timeline event in a session log.

func NewAgentEntry

func NewAgentEntry(change api.AgentChange) *Entry

NewAgentEntry creates an Entry initialized with an AgentChange payload.

func NewCacheBrokenEntry

func NewCacheBrokenEntry(rec api.CacheBrokenRecord) *Entry

NewCacheBrokenEntry creates an Entry initialized with a CacheBrokenRecord payload.

func NewCommandEntry

func NewCommandEntry(cmd api.CommandRecord) *Entry

NewCommandEntry creates an Entry initialized with a CommandRecord payload.

func NewCompactedEntry

func NewCompactedEntry(rec api.CompactedRecord) *Entry

NewCompactedEntry creates an Entry initialized with a CompactedRecord payload.

func NewEffortEntry

func NewEffortEntry(change api.EffortChange) *Entry

NewEffortEntry creates an Entry initialized with an EffortChange payload.

func NewForkedEntry

func NewForkedEntry(rec api.ForkRecord) *Entry

NewForkedEntry creates an Entry initialized with a ForkRecord payload.

func NewInterruptedEntry

func NewInterruptedEntry() *Entry

NewInterruptedEntry creates an Entry recording that a turn was interrupted/canceled by the user.

func NewMessageEntry

func NewMessageEntry(msg message.Message) *Entry

NewMessageEntry creates an Entry initialized with a message.Message payload.

func NewModeEntry

func NewModeEntry(change api.ModeChange) *Entry

NewModeEntry creates an Entry initialized with a ModeChange payload.

func NewModelEntry

func NewModelEntry(change api.ModelChange) *Entry

NewModelEntry creates an Entry initialized with a ModelChange payload.

func NewPermissionEntry

func NewPermissionEntry(record api.PermissionRecord) *Entry

NewPermissionEntry creates an Entry initialized with a PermissionRecord payload.

func NewPlanReviewEntry

func NewPlanReviewEntry(record api.PlanReviewRecord) *Entry

NewPlanReviewEntry creates an Entry initialized with a PlanReviewRecord payload.

func NewQuestionEntry

func NewQuestionEntry(record api.QuestionRecord) *Entry

NewQuestionEntry creates an Entry initialized with a QuestionRecord payload.

func NewRuleEntry

func NewRuleEntry(rec api.RuleRecord) *Entry

NewRuleEntry creates an Entry initialized with a RuleRecord payload.

func NewThinkingEntry

func NewThinkingEntry(change api.ThinkingChange) *Entry

NewThinkingEntry creates an Entry initialized with a ThinkingChange payload.

func NewTurnCompletedEntry

func NewTurnCompletedEntry(rec api.TurnCompletedRecord) *Entry

NewTurnCompletedEntry creates an Entry initialized with a TurnCompletedRecord payload.

func (Entry) Clone

func (e Entry) Clone() Entry

Clone returns a deep copy of the timeline entry.

type Timeline

type Timeline interface {
	Append(ctx context.Context, entry *Entry) error
	Get(ctx context.Context, id string) (*Entry, error)
	List(ctx context.Context) ([]Entry, error)
	Messages(ctx context.Context) (message.MessageList, error)
	Delete(ctx context.Context) error
}

Timeline provides append-only persistence and querying for a single session timeline.

func New

func New(ctx context.Context, db *sql.DB, sessionID string) (Timeline, error)

New creates and initializes a session-scoped Timeline, running migrations on the provided db.

Jump to

Keyboard shortcuts

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