Documentation
¶
Index ¶
- type Config
- type Manager
- func (m *Manager) AppendMessage(id string, msg Message) bool
- func (m *Manager) Clear() int
- func (m *Manager) Close(id string) bool
- func (m *Manager) Create() *Session
- func (m *Manager) Delete(id string) bool
- func (m *Manager) Get(id string) (*Session, bool)
- func (m *Manager) GetContext(id string, key string) (interface{}, bool)
- func (m *Manager) GetMessages(id string) ([]Message, bool)
- func (m *Manager) GetOrLoad(id string) (*Session, bool)
- func (m *Manager) GetRequest(id string) (string, bool)
- func (m *Manager) GetStats() map[string]interface{}
- func (m *Manager) List() []*Session
- func (m *Manager) SetCompleted(id string, response string) bool
- func (m *Manager) SetContext(id string, key string, value interface{}) bool
- func (m *Manager) SetFailed(id string, err string) bool
- func (m *Manager) SetRequest(id string, request string) bool
- func (m *Manager) SetRunning(id string) bool
- func (m *Manager) Stats() map[string]int
- func (m *Manager) Stop()
- func (m *Manager) Update(id string, fn func(*Session)) bool
- type Message
- type MessageStore
- func (s *MessageStore) ClearAllMessages() error
- func (s *MessageStore) ClearAllSessions() error
- func (s *MessageStore) Close() error
- func (s *MessageStore) DeleteMessagesForSession(sessionID string) error
- func (s *MessageStore) DeleteSession(sessionID string) error
- func (s *MessageStore) GetMessages(sessionID string) ([]Message, error)
- func (s *MessageStore) GetSession(sessionID string) (*Session, error)
- func (s *MessageStore) InsertMessage(sessionID string, msg Message) error
- func (s *MessageStore) LoadSessions() ([]*Session, error)
- func (s *MessageStore) PurgeOlderThan(cutoff time.Time) error
- func (s *MessageStore) PurgeSessionsOlderThan(cutoff time.Time) error
- func (s *MessageStore) UpsertSession(sess *Session) error
- type Session
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Timeout time.Duration // Session timeout duration
MessageRetention time.Duration // Message retention window
}
Config holds session manager configuration
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles session lifecycle
func NewManager ¶
func NewManager(cfg Config, store *MessageStore) *Manager
NewManager creates a new session manager
func (*Manager) AppendMessage ¶
AppendMessage adds a message to a session
func (*Manager) GetContext ¶
GetContext retrieves context data for a session
func (*Manager) GetMessages ¶
GetMessages retrieves messages for a session
func (*Manager) GetOrLoad ¶
GetOrLoad retrieves a session by ID, falling back to the store if needed
func (*Manager) GetRequest ¶
GetRequest retrieves the request for a session
func (*Manager) SetCompleted ¶
SetCompleted marks a session as completed with response
func (*Manager) SetContext ¶
SetContext stores context data for a session
func (*Manager) SetRequest ¶
SetRequest stores the request for a session
func (*Manager) SetRunning ¶
SetRunning marks a session as running
type Message ¶
type Message struct {
Role string // "user" or "assistant"
Content string // Full content
Summary string // Optional summary for assistant responses
Timestamp time.Time // When the message was created
}
Message represents a chat message within a session
type MessageStore ¶
type MessageStore struct {
// contains filtered or unexported fields
}
MessageStore persists session messages to SQLite
func NewMessageStore ¶
func NewMessageStore(dbPath string) (*MessageStore, error)
NewMessageStore creates a SQLite-backed message store
func (*MessageStore) ClearAllMessages ¶
func (s *MessageStore) ClearAllMessages() error
ClearAllMessages removes all messages
func (*MessageStore) ClearAllSessions ¶
func (s *MessageStore) ClearAllSessions() error
ClearAllSessions removes all sessions from storage
func (*MessageStore) DeleteMessagesForSession ¶
func (s *MessageStore) DeleteMessagesForSession(sessionID string) error
DeleteMessagesForSession removes all messages for a session
func (*MessageStore) DeleteSession ¶
func (s *MessageStore) DeleteSession(sessionID string) error
DeleteSession removes a session from storage
func (*MessageStore) GetMessages ¶
func (s *MessageStore) GetMessages(sessionID string) ([]Message, error)
GetMessages returns messages for a session in chronological order
func (*MessageStore) GetSession ¶
func (s *MessageStore) GetSession(sessionID string) (*Session, error)
GetSession retrieves a single session from storage
func (*MessageStore) InsertMessage ¶
func (s *MessageStore) InsertMessage(sessionID string, msg Message) error
InsertMessage writes a message to storage
func (*MessageStore) LoadSessions ¶
func (s *MessageStore) LoadSessions() ([]*Session, error)
LoadSessions loads all sessions from storage
func (*MessageStore) PurgeOlderThan ¶
func (s *MessageStore) PurgeOlderThan(cutoff time.Time) error
PurgeOlderThan deletes messages older than a cutoff
func (*MessageStore) PurgeSessionsOlderThan ¶
func (s *MessageStore) PurgeSessionsOlderThan(cutoff time.Time) error
PurgeSessionsOlderThan deletes sessions older than a cutoff
func (*MessageStore) UpsertSession ¶
func (s *MessageStore) UpsertSession(sess *Session) error
UpsertSession writes session metadata to storage
type Session ¶
type Session struct {
ID string // Unique session identifier
Status Status // Current session status
Request string // User's request payload
Response string // Claude Code response summary
Error string // Error message if failed
CreatedAt time.Time // Session creation timestamp
LastActivity time.Time // Last activity timestamp
ExpiresAt time.Time // Session expiration timestamp
Context map[string]interface{} // Request context for continued communication
Messages []Message // Chat message history
}
Session represents an execution session