session

package
v0.0.0-...-8c5cae0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSessionNotFound = errors.New("session: not found")

Functions

func Iterator

func Iterator(events []*Event) iter.Seq[*Event]

Iterator returns a sequence over events.

Types

type ContextWindowStore

type ContextWindowStore interface {
	ListContextWindowEvents(context.Context, *Session) ([]*Event, error)
}

ContextWindowStore optionally provides a reduced event window optimized for model context construction (typically latest compaction event and newer).

type Event

type Event struct {
	ID        string
	SessionID string
	Time      time.Time
	Message   model.Message
	Meta      map[string]any
}

Event is the persisted unit of runtime history used to rebuild invocation context and state.

type Session

type Session struct {
	AppName string
	UserID  string
	ID      string
}

Session identifies a conversation thread.

type Store

type Store interface {
	GetOrCreate(context.Context, *Session) (*Session, error)
	AppendEvent(context.Context, *Session, *Event) error
	ListEvents(context.Context, *Session) ([]*Event, error)
	SnapshotState(context.Context, *Session) (map[string]any, error)
}

Store provides session and event persistence.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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