session

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

type Session struct {
	Key               string              `json:"key"`
	SessionID         string              `json:"session_id,omitempty"`
	Kind              string              `json:"kind,omitempty"`
	Messages          []providers.Message `json:"messages"`
	Summary           string              `json:"summary,omitempty"`
	CompactionCount   int                 `json:"compaction_count,omitempty"`
	LastLanguage      string              `json:"last_language,omitempty"`
	PreferredLanguage string              `json:"preferred_language,omitempty"`
	Created           time.Time           `json:"created"`
	Updated           time.Time           `json:"updated"`
	// contains filtered or unexported fields
}

type SessionManager

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

func NewSessionManager

func NewSessionManager(storage string) *SessionManager

func (*SessionManager) AddMessage

func (sm *SessionManager) AddMessage(sessionKey, role, content string)

func (*SessionManager) AddMessageFull

func (sm *SessionManager) AddMessageFull(sessionKey string, msg providers.Message)

func (*SessionManager) CompactSession

func (sm *SessionManager) CompactSession(key string, keepLast int, note string) bool

func (*SessionManager) Count

func (sm *SessionManager) Count() int

func (*SessionManager) GetHistory

func (sm *SessionManager) GetHistory(key string) []providers.Message

func (*SessionManager) GetLanguagePreferences

func (sm *SessionManager) GetLanguagePreferences(key string) (preferred string, last string)

func (*SessionManager) GetOrCreate

func (sm *SessionManager) GetOrCreate(key string) *Session

func (*SessionManager) GetSummary

func (sm *SessionManager) GetSummary(key string) string

func (*SessionManager) Keys

func (sm *SessionManager) Keys() []string

func (*SessionManager) List

func (sm *SessionManager) List(limit int) []Session

func (*SessionManager) PurgeOrphanToolOutputs

func (sm *SessionManager) PurgeOrphanToolOutputs(key string) int

func (*SessionManager) ResetSession

func (sm *SessionManager) ResetSession(key string)

func (*SessionManager) Save

func (sm *SessionManager) Save(session *Session) error

func (*SessionManager) SetLastLanguage

func (sm *SessionManager) SetLastLanguage(key, lang string)

func (*SessionManager) SetPreferredLanguage

func (sm *SessionManager) SetPreferredLanguage(key, lang string)

func (*SessionManager) SetSummary

func (sm *SessionManager) SetSummary(key string, summary string)

func (*SessionManager) TruncateHistory

func (sm *SessionManager) TruncateHistory(key string, keepLast int)

Jump to

Keyboard shortcuts

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