Documentation
¶
Index ¶
- type Compactor
- type Config
- type SessionInfo
- type Store
- func (s *Store) CountMessages(ctx context.Context, sessionID string) (int, error)
- func (s *Store) DeleteSession(ctx context.Context, sessionID string) error
- func (s *Store) GetMessages(ctx context.Context, sessionID string) ([]fantasy.Message, error)
- func (s *Store) LastAssistantMessage(ctx context.Context, sessionID string) (StoredMessage, error)
- func (s *Store) ListMessages(ctx context.Context, sessionID string) ([]StoredMessage, error)
- func (s *Store) ListSessions(ctx context.Context) ([]SessionInfo, error)
- func (s *Store) ReplaceMessages(ctx context.Context, sessionID string, messages []fantasy.Message) error
- func (s *Store) SaveMessage(ctx context.Context, sessionID, role, content string) error
- func (s *Store) UpdateBranches(ctx context.Context, id int64, content, branchesJSON string, active int) error
- type StoredMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SessionInfo ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) CountMessages ¶
func (*Store) DeleteSession ¶
func (*Store) GetMessages ¶
func (*Store) LastAssistantMessage ¶
LastAssistantMessage returns the most recent assistant row for sessionID, or sql.ErrNoRows if none exists. Used by the regenerate path to append a branch onto the prior turn instead of inserting a new row.
func (*Store) ListMessages ¶
ListMessages returns the persisted messages for sessionID with their stored timestamps. Order ASC, capped at 50 rows like GetMessages.
func (*Store) ListSessions ¶
func (s *Store) ListSessions(ctx context.Context) ([]SessionInfo, error)
func (*Store) ReplaceMessages ¶
func (*Store) SaveMessage ¶
func (*Store) UpdateBranches ¶
func (s *Store) UpdateBranches(ctx context.Context, id int64, content, branchesJSON string, active int) error
UpdateBranches rewrites a single message's content + branches + active index. Used by the regenerate path: the old content slides into branches, the new parts become the new content, and active flips to point at it.
type StoredMessage ¶
type StoredMessage struct {
ID int64
Role string
Content string
BranchesJSON string
ActiveBranch int
CreatedAt time.Time
}
StoredMessage is the timestamp-bearing shape used by ListMessages. Used by the runtime's gRPC ListSessionMessages path so the dashboard can render real wall-clock timestamps on hydrated history.
Content shapes (alpha — no retro compat):
- user role: plain prompt text.
- assistant role: JSON-encoded array of "parts" representing the active branch (text + tool blocks). BranchesJSON, when non-empty, is a JSON-encoded array of alternative parts arrays produced by Regenerate.