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 ¶
- Variables
- func Migrate(ctx context.Context, db *sql.DB) error
- type Entry
- func NewAgentEntry(change api.AgentChange) *Entry
- func NewCacheBrokenEntry(rec api.CacheBrokenRecord) *Entry
- func NewCommandEntry(cmd api.CommandRecord) *Entry
- func NewCompactedEntry(rec api.CompactedRecord) *Entry
- func NewEffortEntry(change api.EffortChange) *Entry
- func NewForkedEntry(rec api.ForkRecord) *Entry
- func NewInterruptedEntry() *Entry
- func NewMessageEntry(msg message.Message) *Entry
- func NewModeEntry(change api.ModeChange) *Entry
- func NewModelEntry(change api.ModelChange) *Entry
- func NewPermissionEntry(record api.PermissionRecord) *Entry
- func NewPlanReviewEntry(record api.PlanReviewRecord) *Entry
- func NewQuestionEntry(record api.QuestionRecord) *Entry
- func NewRuleEntry(rec api.RuleRecord) *Entry
- func NewThinkingEntry(change api.ThinkingChange) *Entry
- func NewTurnCompletedEntry(rec api.TurnCompletedRecord) *Entry
- type Timeline
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
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.
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.