Documentation
¶
Overview ¶
Package warp provides an adapter for Warp terminal AI that queries its SQLite database for conversation history filtered by working directory.
Index ¶
- Variables
- func NewWatcher(dbPath string) (<-chan adapter.Event, io.Closer, error)
- type AIQueryRow
- type Adapter
- func (a *Adapter) Capabilities() adapter.CapabilitySet
- func (a *Adapter) Close() error
- 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)
- func (a *Adapter) WatchScope() adapter.WatchScope
- type AgentConversationRow
- type BlockAIMetadata
- type BlockRow
- type CodebaseContext
- type ConversationData
- type ConversationUsageMetadata
- type CurrentTimeContext
- type DiffStats
- type DirectoryContext
- type ExecutionEnvironmentContext
- type GitContext
- type OSInfo
- type ProjectRulesContext
- type QueryContext
- type QueryInput
- type TokenUsageItem
- type ToolStats
- type ToolUsageMetadata
Constants ¶
This section is empty.
Variables ¶
var ModelDisplayNames = map[string]string{
"claude-4-5-opus": "Claude Opus 4.5",
"claude-4-5-opus-thinking": "Claude Opus 4.5 (Thinking)",
"gpt-5-1-high-reasoning": "GPT-5",
}
ModelDisplayNames maps Warp model IDs to display names.
Functions ¶
Types ¶
type AIQueryRow ¶
type AIQueryRow struct {
ID int
ExchangeID string
ConversationID string
Input string // JSON array
OutputStatus string
ModelID string
PlanningModelID string
CodingModelID string
WorkingDirectory string
StartTS time.Time
}
AIQueryRow represents a row from the ai_queries table.
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements the adapter.Adapter interface for Warp terminal AI 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.
func (*Adapter) Usage ¶
func (a *Adapter) Usage(sessionID string) (*adapter.UsageStats, error)
Usage returns aggregate usage stats for the given session.
func (*Adapter) WatchScope ¶
func (a *Adapter) WatchScope() adapter.WatchScope
WatchScope returns Global because warp watches a global database file (td-7a72b6f7).
type AgentConversationRow ¶
type AgentConversationRow struct {
ID int
ConversationID string
ConversationData string // JSON
LastModifiedAt time.Time
}
AgentConversationRow represents a row from agent_conversations.
type BlockAIMetadata ¶
type BlockAIMetadata struct {
ActionID string `json:"action_id"`
ConversationID string `json:"conversation_id"`
ConversationPhase json.RawMessage `json:"conversation_phase"`
}
BlockAIMetadata represents the parsed ai_metadata JSON from blocks.
type BlockRow ¶
type BlockRow struct {
ID int
PaneLeafUUID []byte
StylizedCommand []byte
StylizedOutput []byte
PWD string
ExitCode int
StartTS time.Time
CompletedTS time.Time
AIMetadata string // JSON, nullable
}
BlockRow represents a row from the blocks table.
type CodebaseContext ¶
CodebaseContext contains project info.
type ConversationData ¶
type ConversationData struct {
ServerConversationToken string `json:"server_conversation_token"`
UsageMetadata *ConversationUsageMetadata `json:"conversation_usage_metadata"`
}
ConversationData represents the parsed conversation_data JSON.
type ConversationUsageMetadata ¶
type ConversationUsageMetadata struct {
WasSummarized bool `json:"was_summarized"`
ContextWindowUsage float64 `json:"context_window_usage"`
CreditsSpent float64 `json:"credits_spent"`
CreditsSpentLastBlock float64 `json:"credits_spent_for_last_block"`
TokenUsage []TokenUsageItem `json:"token_usage"`
ToolUsageMetadata *ToolUsageMetadata `json:"tool_usage_metadata"`
}
ConversationUsageMetadata contains usage statistics.
type CurrentTimeContext ¶
type CurrentTimeContext struct {
CurrentTime string `json:"current_time"`
}
CurrentTimeContext contains the timestamp.
type DiffStats ¶
type DiffStats struct {
Count int `json:"count"`
LinesAdded int `json:"lines_added"`
LinesRemoved int `json:"lines_removed"`
}
DiffStats contains file diff statistics.
type DirectoryContext ¶
DirectoryContext contains the working directory info.
type ExecutionEnvironmentContext ¶
type ExecutionEnvironmentContext struct {
OS *OSInfo `json:"os"`
ShellName string `json:"shell_name"`
}
ExecutionEnvironmentContext contains OS/shell info.
type GitContext ¶
type GitContext struct {
Head string `json:"head"`
}
GitContext contains git state.
type ProjectRulesContext ¶
type ProjectRulesContext struct {
RootPath string `json:"root_path"`
ActiveRules json.RawMessage `json:"active_rules"` // Complex nested structure, not parsed
}
ProjectRulesContext contains project rules.
type QueryContext ¶
type QueryContext struct {
Directory *DirectoryContext `json:",omitempty"`
Git *GitContext `json:",omitempty"`
ProjectRules *ProjectRulesContext `json:",omitempty"`
CurrentTime *CurrentTimeContext `json:",omitempty"`
ExecutionEnvironment *ExecutionEnvironmentContext `json:",omitempty"`
Codebase *CodebaseContext `json:",omitempty"`
}
QueryContext represents context items in the query.
type QueryInput ¶
type QueryInput struct {
Query struct {
Text string `json:"text"`
Context []QueryContext `json:"context"`
ReferencedAttachments json.RawMessage `json:"referenced_attachments"`
} `json:"Query"`
}
QueryInput represents the parsed input JSON from ai_queries. Format: [{"Query": {...}}]
type TokenUsageItem ¶
type TokenUsageItem struct {
ModelID string `json:"model_id"`
WarpTokens int `json:"warp_tokens"`
BYOKTokens int `json:"byok_tokens"`
WarpTokensByCategory map[string]int `json:"warp_token_usage_by_category"`
}
TokenUsageItem contains token usage for a specific model.
type ToolStats ¶
type ToolStats struct {
Count int `json:"count"`
CommandsExecuted int `json:"commands_executed,omitempty"`
}
ToolStats contains basic tool call counts.
type ToolUsageMetadata ¶
type ToolUsageMetadata struct {
RunCommand *ToolStats `json:"run_command_stats"`
ReadFiles *ToolStats `json:"read_files_stats"`
Grep *ToolStats `json:"grep_stats"`
FileGlob *ToolStats `json:"file_glob_stats"`
ApplyFileDiff *DiffStats `json:"apply_file_diff_stats"`
ReadShellOutput *ToolStats `json:"read_shell_command_output_stats"`
}
ToolUsageMetadata contains tool call statistics.