Documentation
¶
Overview ¶
Package geminicli provides an adapter for Gemini CLI that parses JSON session files with project-specific conversation tracking.
Index ¶
- func NewWatcher(chatsDir string) (<-chan adapter.Event, io.Closer, error)
- type Adapter
- func (a *Adapter) Capabilities() adapter.CapabilitySet
- func (a *Adapter) Detect(projectRoot string) (bool, error)
- func (a *Adapter) ID() string
- func (a *Adapter) Icon() string
- func (a *Adapter) Messages(sessionID string) ([]adapter.Message, error)
- func (a *Adapter) Name() string
- func (a *Adapter) SearchMessages(sessionID, query string, opts adapter.SearchOptions) ([]adapter.MessageMatch, error)
- func (a *Adapter) Sessions(projectRoot string) ([]adapter.Session, error)
- func (a *Adapter) Usage(sessionID string) (*adapter.UsageStats, error)
- func (a *Adapter) Watch(projectRoot string) (<-chan adapter.Event, io.Closer, error)
- type Message
- type Session
- type SessionMetadata
- type Thought
- type Tokens
- type ToolCall
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements the adapter.Adapter interface for Gemini CLI sessions.
func (*Adapter) Capabilities ¶
func (a *Adapter) Capabilities() adapter.CapabilitySet
Capabilities returns the supported features.
func (*Adapter) SearchMessages ¶
func (a *Adapter) SearchMessages(sessionID, query string, opts adapter.SearchOptions) ([]adapter.MessageMatch, error)
SearchMessages searches message content within a session. Implements adapter.MessageSearcher interface.
func (*Adapter) Sessions ¶
Sessions returns all sessions for the given project, sorted by update time.
type Message ¶
type Message struct {
ID string `json:"id"`
Timestamp time.Time `json:"timestamp"`
Type string `json:"type"` // "user", "gemini", "info"
Content string `json:"content"`
Model string `json:"model,omitempty"`
Tokens *Tokens `json:"tokens,omitempty"`
ToolCalls []ToolCall `json:"toolCalls,omitempty"`
Thoughts []Thought `json:"thoughts,omitempty"`
}
Message represents a message in a Gemini CLI session.
type Session ¶
type Session struct {
SessionID string `json:"sessionId"`
ProjectHash string `json:"projectHash"`
StartTime time.Time `json:"startTime"`
LastUpdated time.Time `json:"lastUpdated"`
Messages []Message `json:"messages"`
}
Session represents a Gemini CLI session JSON file.
type SessionMetadata ¶
type SessionMetadata struct {
Path string
SessionID string
ProjectHash string
StartTime time.Time
LastUpdated time.Time
MsgCount int
TotalTokens int
EstCost float64
PrimaryModel string
FirstUserMessage string // Content of the first user message (for title)
}
SessionMetadata holds parsed metadata about a session file.
type Thought ¶
type Thought struct {
Subject string `json:"subject"`
Description string `json:"description"`
Timestamp string `json:"timestamp,omitempty"`
}
Thought represents a thinking step from Gemini.
type Tokens ¶
type Tokens struct {
Input int `json:"input"`
Output int `json:"output"`
Cached int `json:"cached"`
Thoughts int `json:"thoughts"`
Tool int `json:"tool"`
Total int `json:"total"`
}
Tokens holds token usage for a message.
type ToolCall ¶
type ToolCall struct {
ID string `json:"id"`
Name string `json:"name"`
Args any `json:"args,omitempty"`
Result any `json:"result,omitempty"`
Status string `json:"status"`
Timestamp string `json:"timestamp,omitempty"`
DisplayName string `json:"displayName,omitempty"`
}
ToolCall represents a tool invocation.