Documentation
¶
Index ¶
- type Checkpoint
- type CheckpointManager
- func (cm *CheckpointManager) ClearInterrupted(sessionID string) error
- func (cm *CheckpointManager) Delete(sessionID string) error
- func (cm *CheckpointManager) ListAll() ([]*Checkpoint, error)
- func (cm *CheckpointManager) ListInterrupted() ([]*Checkpoint, error)
- func (cm *CheckpointManager) Load(sessionID string) (*Checkpoint, error)
- func (cm *CheckpointManager) MarkInterrupted(sessionID string) error
- func (cm *CheckpointManager) Prune(maxAge time.Duration) error
- func (cm *CheckpointManager) Save(cp *Checkpoint) error
- type Session
- type SessionData
- type Store
- func (s *Store) Close() error
- func (s *Store) DeleteSession(ctx context.Context, id string) error
- func (s *Store) ListSessions(ctx context.Context, profile string) ([]*Session, error)
- func (s *Store) LoadSession(ctx context.Context, id string) (*Session, error)
- func (s *Store) SaveSession(ctx context.Context, session *Session) error
- func (s *Store) SaveSessionData(ctx context.Context, data *SessionData) error
- func (s *Store) SaveSessionDataFromMap(ctx context.Context, id, platform string, ...) error
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"`
Model string `json:"model"`
Messages []types.Message `json:"messages"`
InputTokens int `json:"input_tokens"`
OutputTokens int `json:"output_tokens"`
CacheReadTokens int `json:"cache_read_tokens"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type SessionData ¶ added in v0.3.0
type SessionData struct {
ID string `json:"id"`
Platform string `json:"platform"`
InputTokens int `json:"input_tokens"`
OutputTokens int `json:"output_tokens"`
CacheReadTokens int `json:"cache_read_tokens"`
CreatedAt time.Time `json:"created_at"`
LastActive time.Time `json:"last_active"`
}
SessionData represents minimal session data for Gateway analytics
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) ListSessions ¶
func (*Store) LoadSession ¶
func (*Store) SaveSession ¶
func (*Store) SaveSessionData ¶ added in v0.3.0
func (s *Store) SaveSessionData(ctx context.Context, data *SessionData) error
SaveSessionData saves session token data (used by Gateway for analytics) This method accepts a generic map to avoid import cycle issues