session

package
v0.0.47 Latest Latest
Warning

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

Go to latest
Published: May 14, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventSessionCreated pubsub.EventType = "session_created"
	EventSessionUpdated pubsub.EventType = "session_updated"
	EventSessionDeleted pubsub.EventType = "session_deleted"
)

Variables

This section is empty.

Functions

func Delete

func Delete(ctx context.Context, id string) error

func InitService

func InitService(dbConn *sql.DB) error

func Subscribe

func Subscribe(ctx context.Context) <-chan pubsub.Event[Session]

Types

type Service

type Service interface {
	pubsub.Subscriber[Session]

	Create(ctx context.Context, title 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)
	Update(ctx context.Context, session Session) (Session, error)
	Delete(ctx context.Context, id string) error
}

func GetService

func GetService() Service

type Session

type Session struct {
	ID               string
	ParentSessionID  string
	Title            string
	MessageCount     int64
	PromptTokens     int64
	CompletionTokens int64
	Cost             float64
	Summary          string
	SummarizedAt     time.Time
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

func Create

func Create(ctx context.Context, title string) (Session, error)

func CreateTaskSession

func CreateTaskSession(ctx context.Context, toolCallID, parentSessionID, title string) (Session, error)

func Get

func Get(ctx context.Context, id string) (Session, error)

func List

func List(ctx context.Context) ([]Session, error)

func Update

func Update(ctx context.Context, session Session) (Session, error)

Jump to

Keyboard shortcuts

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