session

package
v0.110.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetEvaluator added in v0.26.2

func SetEvaluator(e evaluatorService)

SetEvaluator sets the evaluator service used to trigger self-evaluation at session end.

func SetLuaManager added in v0.8.0

func SetLuaManager(fm *luaengine.FilterManager)

SetLuaManager sets the Lua filter manager used for session lifecycle hooks.

func SetSnapshotCreator added in v0.26.2

func SetSnapshotCreator(sc SnapshotCreator)

SetSnapshotCreator sets the snapshot creator used for session lifecycle snapshots.

Types

type Service

type Service interface {
	pubsub.Suscriber[Session]
	Create(ctx context.Context, title string) (Session, error)
	CreateTitleSession(ctx context.Context, parentSessionID string) (Session, error)
	CreateTaskSession(ctx context.Context, toolCallID, parentSessionID, title string) (Session, error)
	Get(ctx context.Context, id string) (Session, error)
	List(ctx context.Context) ([]Session, error)
	Save(ctx context.Context, session Session) (Session, error)
	Delete(ctx context.Context, id string) error
	EndSession(ctx context.Context, id string) error
}

func NewService

func NewService(q db.Querier) Service

type Session

type Session struct {
	ID               string
	ParentSessionID  string
	Title            string
	MessageCount     int64
	PromptTokens     int64
	CompletionTokens int64
	SummaryMessageID string
	Cost             float64
	CreatedAt        int64
	UpdatedAt        int64
}

type SnapshotCreator added in v0.26.2

type SnapshotCreator interface {
	CreateSessionSnapshot(ctx context.Context, sessionID, snapshotType, description string) error
}

SnapshotCreator is an interface for creating snapshots without importing the snapshot package directly.

Jump to

Keyboard shortcuts

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