Documentation
¶
Overview ¶
Package session provides persistent conversation storage using JSONL files. Each session is a file in XDG_DATA_HOME/ai-cli/sessions/<id>.jsonl. The first line is metadata; subsequent lines are messages.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendMessage ¶
AppendMessage adds a message to an existing session file and updates metadata.
func DataDir ¶
func DataDir() string
DataDir returns the session storage directory, respecting XDG_DATA_HOME.
func NewID ¶
func NewID() string
NewID returns an 8-character hex string derived from the current time.
Types ¶
type Metadata ¶
type Metadata struct {
ID string `json:"id"`
Title string `json:"title"`
Provider string `json:"provider"` // registry key: "ollama"
ProviderName string `json:"provider_name"` // display name: "Ollama"
Model string `json:"model"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Messages int `json:"messages"`
}
Metadata describes a saved session.
Click to show internal directories.
Click to hide internal directories.