Documentation
¶
Overview ¶
Package conversations defines types and interfaces for conversation data structures, query options, and conversation records used throughout kodelet's conversation management system.
Index ¶
- func GenerateID() string
- func GetDefaultBasePath() (string, error)
- type ConversationRecord
- type ConversationSummary
- func (cs ConversationSummary) GetCreatedAt() time.Time
- func (cs ConversationSummary) GetID() string
- func (cs ConversationSummary) GetMessageCount() int
- func (cs ConversationSummary) GetProvider() string
- func (cs ConversationSummary) GetUpdatedAt() time.Time
- func (cs ConversationSummary) GetUsage() llmtypes.Usage
- type QueryOptions
- type QueryResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateID ¶
func GenerateID() string
GenerateID creates a unique identifier for a conversation
func GetDefaultBasePath ¶
GetDefaultBasePath returns the default path for storing conversations
Types ¶
type ConversationRecord ¶
type ConversationRecord struct {
ID string `json:"id"`
CWD string `json:"cwd,omitempty"`
RawMessages json.RawMessage `json:"rawMessages"` // Raw LLM provider messages
Provider string `json:"provider"` // e.g., "anthropic"
FileLastAccess map[string]time.Time `json:"fileLastAccess"`
Usage llmtypes.Usage `json:"usage"`
Summary string `json:"summary,omitempty"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
Metadata map[string]any `json:"metadata,omitempty"`
ToolResults map[string]tools.StructuredToolResult `json:"toolResults,omitempty"` // Maps tool_call_id to structured result
}
ConversationRecord represents a persisted conversation with its messages and metadata
func NewConversationRecord ¶
func NewConversationRecord(id string) ConversationRecord
NewConversationRecord creates a new conversation record with a unique ID
func (*ConversationRecord) ToSummary ¶
func (cr *ConversationRecord) ToSummary() ConversationSummary
ToSummary converts a ConversationRecord to a ConversationSummary
type ConversationSummary ¶
type ConversationSummary struct {
ID string `json:"id"`
CWD string `json:"cwd,omitempty"`
MessageCount int `json:"messageCount"`
FirstMessage string `json:"firstMessage"`
Summary string `json:"summary,omitempty"`
Provider string `json:"provider"`
Metadata map[string]any `json:"metadata,omitempty"`
Usage llmtypes.Usage `json:"usage"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
ConversationSummary provides a brief overview of a conversation
func (ConversationSummary) GetCreatedAt ¶
func (cs ConversationSummary) GetCreatedAt() time.Time
GetCreatedAt returns the creation timestamp of the conversation
func (ConversationSummary) GetID ¶
func (cs ConversationSummary) GetID() string
GetID returns the conversation ID for usage.ConversationSummary compatibility
func (ConversationSummary) GetMessageCount ¶
func (cs ConversationSummary) GetMessageCount() int
GetMessageCount returns the number of messages in the conversation
func (ConversationSummary) GetProvider ¶
func (cs ConversationSummary) GetProvider() string
GetProvider returns the LLM provider name used for the conversation
func (ConversationSummary) GetUpdatedAt ¶
func (cs ConversationSummary) GetUpdatedAt() time.Time
GetUpdatedAt returns the last update timestamp of the conversation
func (ConversationSummary) GetUsage ¶
func (cs ConversationSummary) GetUsage() llmtypes.Usage
GetUsage returns the LLM usage statistics for the conversation
type QueryOptions ¶
type QueryOptions struct {
StartDate *time.Time // Filter by start date
EndDate *time.Time // Filter by end date
SearchTerm string // Text to search for in messages
Provider string // Filter by LLM provider (e.g., "anthropic", "openai")
CWD string // Filter by canonical working directory
Limit int // Maximum number of results
Offset int // Offset for pagination
SortBy string // Field to sort by
SortOrder string // "asc" or "desc"
}
QueryOptions provides filtering and sorting options for conversation queries
type QueryResult ¶
type QueryResult struct {
ConversationSummaries []ConversationSummary `json:"conversationSummaries"`
Total int `json:"total"` // Represents the total number of the entries that match the query without pagination
QueryOptions
}
QueryResult represents the result of a query operation