Versions in this module Expand all Collapse all v1 v1.30.1 Mar 11, 2026 v1.30.0 Mar 9, 2026 Changes in this version + const MaxToolCallTokens + var ErrEmptyID = errors.New("session ID cannot be empty") + var ErrNotFound = errors.New("session not found") + func ResolveSessionID(ctx context.Context, store Store, ref string) (string, error) + type EvalCriteria struct + Relevance []string + Setup string + Size string + WorkingDir string + type InMemorySessionStore struct + func (s *InMemorySessionStore) AddMessage(_ context.Context, sessionID string, msg *Message) (int64, error) + func (s *InMemorySessionStore) AddSession(_ context.Context, session *Session) error + func (s *InMemorySessionStore) AddSubSession(_ context.Context, parentSessionID string, subSession *Session) error + func (s *InMemorySessionStore) AddSummary(_ context.Context, sessionID, summary string) error + func (s *InMemorySessionStore) Close() error + func (s *InMemorySessionStore) DeleteSession(_ context.Context, id string) error + func (s *InMemorySessionStore) GetSession(_ context.Context, id string) (*Session, error) + func (s *InMemorySessionStore) GetSessionSummaries(_ context.Context) ([]Summary, error) + func (s *InMemorySessionStore) GetSessions(_ context.Context) ([]*Session, error) + func (s *InMemorySessionStore) SetSessionStarred(_ context.Context, id string, starred bool) error + func (s *InMemorySessionStore) UpdateMessage(_ context.Context, messageID int64, msg *Message) error + func (s *InMemorySessionStore) UpdateSession(_ context.Context, session *Session) error + func (s *InMemorySessionStore) UpdateSessionTitle(_ context.Context, sessionID, title string) error + func (s *InMemorySessionStore) UpdateSessionTokens(_ context.Context, sessionID string, inputTokens, outputTokens int64, ...) error + type Item struct + Cost float64 + Message *Message + SubSession *Session + Summary string + func NewMessageItem(msg *Message) Item + func NewSubSessionItem(subSession *Session) Item + func (si *Item) IsMessage() bool + func (si *Item) IsSubSession() bool + type Message struct + AgentName string + ID int64 + Implicit bool + Message chat.Message + func ImplicitUserMessage(content string) *Message + func NewAgentMessage(a *agent.Agent, message *chat.Message) *Message + func SystemMessage(content string) *Message + func UserMessage(content string, multiContent ...chat.MessagePart) *Message + type MessageUsageRecord struct + AgentName string + Cost float64 + Model string + Usage chat.Usage + type Migration struct + AppliedAt time.Time + Description string + DownSQL string + ID int + Name string + UpFunc func(ctx context.Context, db *sql.DB) error + UpSQL string + type MigrationManager struct + func NewMigrationManager(db *sql.DB) *MigrationManager + func (m *MigrationManager) GetAppliedMigrations(ctx context.Context) ([]Migration, error) + func (m *MigrationManager) InitializeMigrations(ctx context.Context) error + func (m *MigrationManager) RunPendingMigrations(ctx context.Context) error + type Opt func(s *Session) + func WithAgentName(name string) Opt + func WithHideToolResults(hideToolResults bool) Opt + func WithImplicitUserMessage(content string) Opt + func WithMaxIterations(maxIterations int) Opt + func WithParentID(parentID string) Opt + func WithPermissions(perms *PermissionsConfig) Opt + func WithSendUserMessage(sendUserMessage bool) Opt + func WithSystemMessage(content string) Opt + func WithThinking(thinking bool) Opt + func WithTitle(title string) Opt + func WithToolsApproved(toolsApproved bool) Opt + func WithUserMessage(content string) Opt + func WithWorkingDir(workingDir string) Opt + type PermissionsConfig struct + Allow []string + Ask []string + Deny []string + type SQLiteSessionStore struct + func (s *SQLiteSessionStore) AddMessage(ctx context.Context, sessionID string, msg *Message) (int64, error) + func (s *SQLiteSessionStore) AddSession(ctx context.Context, session *Session) error + func (s *SQLiteSessionStore) AddSubSession(ctx context.Context, parentSessionID string, subSession *Session) error + func (s *SQLiteSessionStore) AddSummary(ctx context.Context, sessionID, summary string) error + func (s *SQLiteSessionStore) Close() error + func (s *SQLiteSessionStore) DeleteSession(ctx context.Context, id string) error + func (s *SQLiteSessionStore) GetSession(ctx context.Context, id string) (*Session, error) + func (s *SQLiteSessionStore) GetSessionSummaries(ctx context.Context) ([]Summary, error) + func (s *SQLiteSessionStore) GetSessions(ctx context.Context) ([]*Session, error) + func (s *SQLiteSessionStore) SetSessionStarred(ctx context.Context, id string, starred bool) error + func (s *SQLiteSessionStore) UpdateMessage(ctx context.Context, messageID int64, msg *Message) error + func (s *SQLiteSessionStore) UpdateSession(ctx context.Context, session *Session) error + func (s *SQLiteSessionStore) UpdateSessionTitle(ctx context.Context, sessionID, title string) error + func (s *SQLiteSessionStore) UpdateSessionTokens(ctx context.Context, sessionID string, inputTokens, outputTokens int64, ...) error + type Session struct + AgentModelOverrides map[string]string + AgentName string + BranchCreatedAt *time.Time + BranchParentPosition *int + BranchParentSessionID string + Cost float64 + CreatedAt time.Time + CustomModelsUsed []string + Evals *EvalCriteria + HideToolResults bool + ID string + InputTokens int64 + MaxIterations int + MessageUsageHistory []MessageUsageRecord + Messages []Item + OutputTokens int64 + ParentID string + Permissions *PermissionsConfig + SendUserMessage bool + Starred bool + Thinking bool + Title string + ToolsApproved bool + WorkingDir string + func BranchSession(parent *Session, branchAtPosition int) (*Session, error) + func New(opts ...Opt) *Session + func (s *Session) AddMessage(msg *Message) + func (s *Session) AddMessageUsageRecord(agentName, model string, cost float64, usage *chat.Usage) + func (s *Session) AddSubSession(subSession *Session) + func (s *Session) AllowedDirectories() []string + func (s *Session) Duration() time.Duration + func (s *Session) GetAllMessages() []Message + func (s *Session) GetLastAssistantMessageContent() string + func (s *Session) GetLastUserMessageContent() string + func (s *Session) GetLastUserMessages(n int) []string + func (s *Session) GetMessages(a *agent.Agent) []chat.Message + func (s *Session) IsSubSession() bool + func (s *Session) MessageCount() int + func (s *Session) OwnCost() float64 + func (s *Session) TotalCost() float64 + type Store interface + AddMessage func(ctx context.Context, sessionID string, msg *Message) (int64, error) + AddSession func(ctx context.Context, session *Session) error + AddSubSession func(ctx context.Context, parentSessionID string, subSession *Session) error + AddSummary func(ctx context.Context, sessionID, summary string) error + Close func() error + DeleteSession func(ctx context.Context, id string) error + GetSession func(ctx context.Context, id string) (*Session, error) + GetSessionSummaries func(ctx context.Context) ([]Summary, error) + GetSessions func(ctx context.Context) ([]*Session, error) + SetSessionStarred func(ctx context.Context, id string, starred bool) error + UpdateMessage func(ctx context.Context, messageID int64, msg *Message) error + UpdateSession func(ctx context.Context, session *Session) error + UpdateSessionTitle func(ctx context.Context, sessionID, title string) error + UpdateSessionTokens func(ctx context.Context, sessionID string, inputTokens, outputTokens int64, ...) error + func NewInMemorySessionStore() Store + func NewSQLiteSessionStore(path string) (Store, error) + type Summary struct + BranchParentSessionID string + CreatedAt time.Time + ID string + NumMessages int + Starred bool + Title string