session

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager manages sessions, keyed by "channel:chat_id".

func NewManager

func NewManager(dataDir string) *Manager

NewManager creates a new session manager.

func (*Manager) Get

func (m *Manager) Get(channel, chatID string) *Session

Get returns or creates a session for the given channel and chat ID.

type Session

type Session struct {
	Messages         []provider.Message
	LastConsolidated int // index of last consolidated message
	// contains filtered or unexported fields
}

Session holds the message history for a channel:chat_id pair.

func (*Session) Append

func (s *Session) Append(msg provider.Message)

Append adds a message to the session and persists it.

func (*Session) Clear

func (s *Session) Clear()

Clear resets the session messages.

func (*Session) GetMessages

func (s *Session) GetMessages() []provider.Message

GetMessages returns a copy of all messages.

func (*Session) MarkConsolidated

func (s *Session) MarkConsolidated(index int)

MarkConsolidated updates the consolidation pointer.

func (*Session) ReplaceMessages

func (s *Session) ReplaceMessages(msgs []provider.Message)

ReplaceMessages replaces all session messages with the given list. This is used after context compaction to trim the session.

func (*Session) UnconsolidatedCount

func (s *Session) UnconsolidatedCount() int

UnconsolidatedCount returns the number of messages since last consolidation.

Jump to

Keyboard shortcuts

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