Versions in this module Expand all Collapse all v0 v0.28.0 Apr 16, 2026 Changes in this version + type ContextBlock struct + Content string + Timestamp time.Time + Tokens int + Type ContextBlockType + type ContextBlockType string + const BlockTypeError + const BlockTypeSummary + const BlockTypeSystem + const BlockTypeToolResult + const BlockTypeUserQuery + type Hook func(ctx context.Context, session *Session, data interface{}) error + type HookType string + const HookPostToolUse + const HookPreCompact + const HookPreToolUse + const HookSessionStart + type PreCompactOptions struct + IncludeMetadata bool + IncludeState bool + MaxTokens int + PreserveRecent int + type PreCompactResult struct + BlocksKept int + BlocksTotal int + Summary string + TokensUsed int + type Session struct + Agent string + ContextBlocks []ContextBlock + ExpiresAt *time.Time + ID string + IsActive bool + LastActivity time.Time + Metadata SessionMetadata + ProjectPath string + StartedAt time.Time + State SessionState + type SessionListOptions struct + ActiveOnly bool + Agent string + Limit int + Offset int + ProjectPath string + type SessionListResult struct + HasMore bool + Sessions []Session + Total int64 + type SessionManager struct + func NewSessionManager() (*SessionManager, error) + func (sm *SessionManager) AddContextBlock(blockType ContextBlockType, content string, tokens int) error + func (sm *SessionManager) CleanupExpired() error + func (sm *SessionManager) Close() error + func (sm *SessionManager) CreateSession(agent, projectPath string) (*Session, error) + func (sm *SessionManager) CreateSnapshot(sessionID string) (*SessionSnapshot, error) + func (sm *SessionManager) GetActiveSession() *Session + func (sm *SessionManager) GetSession(id string) (*Session, error) + func (sm *SessionManager) PreCompact(ctx context.Context, maxTokens int) (string, error) + func (sm *SessionManager) RegisterHook(hookType HookType, hook Hook) + func (sm *SessionManager) RestoreSnapshot(snapshotID int64) (*Session, error) + func (sm *SessionManager) SetActiveSession(id string) error + type SessionMetadata struct + CompressionRatio float64 + TotalTokens int + TotalTurns int + type SessionSnapshot struct + Content string + CreatedAt time.Time + ID int64 + SessionID string + TokenCount int + type SessionState struct + Focus string + NextAction string + Variables map[string]interface{}