Documentation
¶
Index ¶
- func GenerateName() string
- type Compaction
- type ContextSnapshot
- type Entry
- type EntryKind
- type Header
- type History
- type HistoryEntry
- type Manager
- type ModelChange
- type PlanFile
- type PlanStore
- type SessionInfo
- type Store
- func (s *Store) AppendCompaction(summary string, keptMessages []json.RawMessage) error
- func (s *Store) AppendMessage(msg agentcore.Message) error
- func (s *Store) AppendModelChange(provider, model string) error
- func (s *Store) AppendThinkingLevelChange(level string) error
- func (s *Store) BuildSnapshot() (ContextSnapshot, error)
- func (s *Store) Close() error
- func (s *Store) Header() Header
- func (s *Store) Path() string
- func (s *Store) SetName(name string) error
- type ThinkingLevelChange
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateName ¶
func GenerateName() string
GenerateName returns a random name in adjective-gerund-noun format.
Types ¶
type Compaction ¶
type Compaction struct {
Summary string `json:"summary"`
Messages []json.RawMessage `json:"messages,omitempty"`
}
Compaction stores a compaction summary and optionally kept messages.
type ContextSnapshot ¶
type ContextSnapshot struct {
Messages []agentcore.AgentMessage
Provider string
Model string
Thinking string
}
ContextSnapshot is the projected runtime state from a session log.
type Entry ¶
type Entry struct {
Kind EntryKind `json:"kind"`
ID string `json:"id"`
ParentID string `json:"parent_id,omitempty"`
Timestamp time.Time `json:"timestamp"`
Data json.RawMessage `json:"data"`
}
Entry is a single JSONL line in the session file.
type Header ¶
type Header struct {
Version int `json:"version"`
SessionID string `json:"session_id"`
Name string `json:"name,omitempty"`
Cwd string `json:"cwd"`
Created time.Time `json:"created"`
}
Header is the first line of a session file.
type History ¶
type History struct {
// contains filtered or unexported fields
}
History provides append-only input history with per-project filtering. The backing file (~/.codebot/history.jsonl) is shared across all projects; only entries matching the current project are surfaced.
func NewHistory ¶
NewHistory loads history from path, filtering by project.
func (*History) SetSessionID ¶
SetSessionID updates the session ID for subsequent entries (e.g. after session switch).
type HistoryEntry ¶
type HistoryEntry struct {
Display string `json:"display"`
PastedContents map[string]any `json:"pastedContents"`
Timestamp int64 `json:"timestamp"`
Project string `json:"project"`
SessionID string `json:"sessionId,omitempty"`
}
HistoryEntry is one line in the JSONL history file.
type Manager ¶
type Manager struct {
Dir string
}
Manager manages session files in a directory.
func NewManager ¶
NewManager creates a Manager for the given sessions directory.
func (*Manager) List ¶
func (m *Manager) List() ([]SessionInfo, error)
List returns all sessions sorted by updated time (newest first).
func (*Manager) MostRecent ¶
func (m *Manager) MostRecent() (*SessionInfo, error)
MostRecent returns the most recently updated session.
type ModelChange ¶
ModelChange records a model switch event.
type PlanStore ¶
type PlanStore struct {
// contains filtered or unexported fields
}
PlanStore manages plan markdown files in a single directory.
func NewPlanStore ¶
NewPlanStore creates a PlanStore and ensures the directory exists.
type SessionInfo ¶
type SessionInfo struct {
ID string
Name string
Path string
Cwd string
Created time.Time
Updated time.Time
MessageCount int
FirstMessage string // first user message, truncated to 80 chars
}
SessionInfo is a summary of a session for listing.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages a single session JSONL file.
func (*Store) AppendCompaction ¶
func (s *Store) AppendCompaction(summary string, keptMessages []json.RawMessage) error
AppendCompaction records a compaction event with summary and optional kept messages.
func (*Store) AppendMessage ¶
AppendMessage serializes and appends an agentcore.Message.
func (*Store) AppendModelChange ¶
AppendModelChange records a model switch.
func (*Store) AppendThinkingLevelChange ¶
AppendThinkingLevelChange records a thinking level switch.
func (*Store) BuildSnapshot ¶
func (s *Store) BuildSnapshot() (ContextSnapshot, error)
BuildSnapshot reconstructs runtime state by walking the tree from the current leaf.
type ThinkingLevelChange ¶
type ThinkingLevelChange struct {
Level string `json:"level"`
}
ThinkingLevelChange records a thinking level switch event.