Documentation
¶
Index ¶
- Constants
- func BoolSettingValue(value bool) string
- func ParseBoolSetting(value string, defaultValue bool) bool
- type MessageRecord
- type Project
- type ProjectStats
- type Session
- type SettingScope
- type Store
- func (s *Store) Close() error
- func (s *Store) ConversationsByProject(projectID int64, limit int) ([]Session, error)
- func (s *Store) CreateProject(name, description string) (Project, error)
- func (s *Store) CreateSession(projectID int64, label string) (Session, error)
- func (s *Store) DeleteProject(id int64) error
- func (s *Store) DeleteSession(sessionID int64) error
- func (s *Store) EnsureProject(name string) (Project, error)
- func (s *Store) GetProject(id int64) (Project, error)
- func (s *Store) GetProjectByName(name string) (Project, error)
- func (s *Store) GetSession(id int64) (Session, error)
- func (s *Store) ListProjectsWithStats(limit int) ([]ProjectStats, error)
- func (s *Store) LoadSessionMessages(sessionID int64) ([]MessageRecord, error)
- func (s *Store) LoadSetting(scope SettingScope, targetID int64, key string) (string, bool, error)
- func (s *Store) LoadSettings(scope SettingScope, targetID int64) (map[string]string, error)
- func (s *Store) RecentSessions(limit int) ([]Session, error)
- func (s *Store) RenameProject(id int64, name string) (Project, error)
- func (s *Store) SaveMessage(sessionID int64, rec MessageRecord) error
- func (s *Store) SaveSetting(scope SettingScope, targetID int64, key, value string) error
- func (s *Store) UpdateSessionTitle(sessionID int64, title string) error
Constants ¶
const ( SettingKeyShowStatusBar = "ui.showStatusBar" SettingKeyShowTimestamps = "ui.showTimestamps" SettingKeyDefaultModel = "ui.defaultModel" SettingKeyDefaultAgent = "ui.defaultAgent" )
Preference keys used throughout the UI layer.
const DefaultProjectName = "General"
DefaultProjectName is used when no project exists yet.
Variables ¶
This section is empty.
Functions ¶
func BoolSettingValue ¶
BoolSettingValue encodes a bool for storage.
func ParseBoolSetting ¶
ParseBoolSetting converts a stored string into a bool with a fallback.
Types ¶
type MessageRecord ¶
type MessageRecord struct {
Role string
Content string
Display string
Model string
CreatedAt time.Time
}
MessageRecord captures a single message for persistence.
type Project ¶
type Project struct {
ID int64
Name string
Description string
CreatedAt time.Time
UpdatedAt time.Time
}
Project represents a logical grouping of conversations.
type ProjectStats ¶
ProjectStats provides aggregate info for menu listings.
type Session ¶
type Session struct {
ID int64
ProjectID int64
Title string
LastSummary string
CreatedAt time.Time
UpdatedAt time.Time
}
Session represents a single saved conversation.
type SettingScope ¶
type SettingScope string
SettingScope identifies whether a preference targets the whole user or a specific project.
const ( // SettingScopeUser stores preferences that apply globally for the current user. SettingScopeUser SettingScope = "user" // SettingScopeProject stores preferences scoped to a single project. SettingScopeProject SettingScope = "project" )
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store wraps a SQLite database for conversation persistence.
func OpenDefault ¶
OpenDefault tries a series of writable locations and returns the first successful store handle.
func (*Store) ConversationsByProject ¶
ConversationsByProject returns the conversations for a given project.
func (*Store) CreateProject ¶
CreateProject inserts a new project row.
func (*Store) CreateSession ¶
CreateSession creates a new empty conversation row for a project.
func (*Store) DeleteProject ¶
DeleteProject removes a project and all of its conversations.
func (*Store) DeleteSession ¶
DeleteSession removes a single conversation and its messages.
func (*Store) EnsureProject ¶
EnsureProject finds or creates a project with the given name.
func (*Store) GetProject ¶
GetProject fetches a project by id.
func (*Store) GetProjectByName ¶
GetProjectByName fetches a project with an exact name match.
func (*Store) GetSession ¶
GetSession returns metadata for a single session.
func (*Store) ListProjectsWithStats ¶
func (s *Store) ListProjectsWithStats(limit int) ([]ProjectStats, error)
ListProjectsWithStats returns projects ordered by recent activity.
func (*Store) LoadSessionMessages ¶
func (s *Store) LoadSessionMessages(sessionID int64) ([]MessageRecord, error)
LoadSessionMessages returns all messages for a session ordered by creation time.
func (*Store) LoadSetting ¶
LoadSetting fetches a single key/value pair for the provided scope + target.
func (*Store) LoadSettings ¶
LoadSettings returns all key/value pairs for the provided scope + target.
func (*Store) RecentSessions ¶
RecentSessions returns the most recently updated sessions.
func (*Store) RenameProject ¶
RenameProject updates a project's name and returns the updated record.
func (*Store) SaveMessage ¶
func (s *Store) SaveMessage(sessionID int64, rec MessageRecord) error
SaveMessage persists a message to the session and updates metadata.
func (*Store) SaveSetting ¶
func (s *Store) SaveSetting(scope SettingScope, targetID int64, key, value string) error
SaveSetting upserts a key/value pair for the provided scope + target.