session

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checkpoint

type Checkpoint struct {
	SessionID   string          `json:"session_id"`
	Platform    string          `json:"platform"`
	ChannelID   string          `json:"channel_id"`
	UserID      string          `json:"user_id"`
	Messages    []types.Message `json:"messages"`
	AgentState  json.RawMessage `json:"agent_state,omitempty"`
	CreatedAt   time.Time       `json:"created_at"`
	UpdatedAt   time.Time       `json:"updated_at"`
	Interrupted bool            `json:"interrupted"` // true if gateway was shutdown while session was active
}

Checkpoint represents a session checkpoint for recovery

type CheckpointManager

type CheckpointManager struct {
	// contains filtered or unexported fields
}

CheckpointManager manages session checkpoints

func NewCheckpointManager

func NewCheckpointManager() (*CheckpointManager, error)

NewCheckpointManager creates a new checkpoint manager

func (*CheckpointManager) ClearInterrupted

func (cm *CheckpointManager) ClearInterrupted(sessionID string) error

ClearInterrupted clears the interrupted flag after successful recovery

func (*CheckpointManager) Delete

func (cm *CheckpointManager) Delete(sessionID string) error

Delete removes a checkpoint from disk

func (*CheckpointManager) ListAll

func (cm *CheckpointManager) ListAll() ([]*Checkpoint, error)

ListAll returns all checkpoints

func (*CheckpointManager) ListInterrupted

func (cm *CheckpointManager) ListInterrupted() ([]*Checkpoint, error)

ListInterrupted returns all checkpoints marked as interrupted

func (*CheckpointManager) Load

func (cm *CheckpointManager) Load(sessionID string) (*Checkpoint, error)

Load loads a checkpoint from disk

func (*CheckpointManager) MarkInterrupted

func (cm *CheckpointManager) MarkInterrupted(sessionID string) error

MarkInterrupted marks a session as interrupted (gateway shutdown)

func (*CheckpointManager) Prune

func (cm *CheckpointManager) Prune(maxAge time.Duration) error

Prune removes checkpoints older than maxAge (default 7 days)

func (*CheckpointManager) Save

func (cm *CheckpointManager) Save(cp *Checkpoint) error

Save saves a checkpoint to disk

type Session

type Session struct {
	ID        string          `json:"id"`
	Profile   string          `json:"profile"`
	Platform  string          `json:"platform"`
	Messages  []types.Message `json:"messages"`
	CreatedAt time.Time       `json:"created_at"`
	UpdatedAt time.Time       `json:"updated_at"`
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(dbPath string) (*Store, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) DeleteSession

func (s *Store) DeleteSession(ctx context.Context, id string) error

func (*Store) ListSessions

func (s *Store) ListSessions(ctx context.Context, profile string) ([]*Session, error)

func (*Store) LoadSession

func (s *Store) LoadSession(ctx context.Context, id string) (*Session, error)

func (*Store) SaveSession

func (s *Store) SaveSession(ctx context.Context, session *Session) error

Jump to

Keyboard shortcuts

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