Documentation
¶
Overview ¶
Package conversation provides conversation state management for AgentPipe. It enables saving and resuming conversations across sessions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateStateFileName ¶
func GenerateStateFileName() string
GenerateStateFileName generates a filename for a conversation state. Format: conversation-YYYYMMDD-HHMMSS.json
func GetDefaultStateDir ¶
GetDefaultStateDir returns the default directory for saving conversation states. This is ~/.agentpipe/states by default.
func ListStates ¶
ListStates lists all saved conversation states in a directory.
Types ¶
type State ¶
type State struct {
// Version is the state file format version
Version string `json:"version"`
// SavedAt is when the state was saved
SavedAt time.Time `json:"saved_at"`
// Messages is the conversation history
Messages []agent.Message `json:"messages"`
// Config is the configuration used for this conversation
Config *config.Config `json:"config"`
// Metadata contains additional information about the conversation
Metadata StateMetadata `json:"metadata"`
}
State represents a saved conversation state. It contains all information needed to resume a conversation.
type StateInfo ¶
type StateInfo struct {
Path string
SavedAt time.Time
StartedAt time.Time
Messages int
Turns int
Description string
AgentCount int
Mode string
}
StateInfo contains summary information about a saved state.
func GetStateInfo ¶
GetStateInfo reads summary information from a state file without loading full state.
type StateMetadata ¶
type StateMetadata struct {
// TotalTurns is the number of conversation turns completed
TotalTurns int `json:"total_turns"`
// TotalMessages is the total number of messages
TotalMessages int `json:"total_messages"`
// TotalDuration is the total conversation duration in milliseconds
TotalDuration int64 `json:"total_duration_ms"`
// StartedAt is when the conversation was started
StartedAt time.Time `json:"started_at"`
// Description is an optional description of the conversation
Description string `json:"description,omitempty"`
// ShortSummary is an AI-generated 1-2 sentence summary of the conversation (optional)
ShortSummary string `json:"short_summary,omitempty"`
// Summary is an AI-generated comprehensive summary of the conversation (optional)
Summary string `json:"summary,omitempty"`
}
StateMetadata contains metadata about a saved conversation state.