Documentation
¶
Overview ¶
Package cursor provides an adapter for Cursor that reads SQLite databases to extract conversation history with workspace-based organization.
Index ¶
- func NewWatcher(workspaceDir 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 ContentBlock
- type CursorOpts
- type MessageBlob
- type ProviderOpts
- type SessionInfo
- type SessionMeta
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 Cursor 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 ContentBlock ¶
type ContentBlock struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
ToolCallID string `json:"toolCallId,omitempty"`
ToolName string `json:"toolName,omitempty"`
Args json.RawMessage `json:"args,omitempty"`
Result json.RawMessage `json:"result,omitempty"` // For tool-result blocks
IsError bool `json:"isError,omitempty"` // For tool-result error status
ProviderOptions *ProviderOpts `json:"providerOptions,omitempty"`
Signature string `json:"signature,omitempty"`
}
ContentBlock represents a single block in the content array. Content can be a plain string or an array of these blocks.
type CursorOpts ¶
type CursorOpts struct {
ModelName string `json:"modelName,omitempty"`
RawToolCallArgs string `json:"rawToolCallArgs,omitempty"`
}
CursorOpts holds Cursor-specific message metadata.
type MessageBlob ¶
type MessageBlob struct {
ID string `json:"id,omitempty"`
Role string `json:"role"`
Content json.RawMessage `json:"content"`
}
MessageBlob represents a raw message blob from the SQLite database. Messages are stored as JSON with role and content fields.
type ProviderOpts ¶
type ProviderOpts struct {
Cursor *CursorOpts `json:"cursor,omitempty"`
}
ProviderOpts holds provider-specific options embedded in content blocks.
type SessionInfo ¶
type SessionInfo struct {
Path string // Path to store.db
SessionID string // UUID of the session
WorkspaceHash string // Hash of the workspace path
Name string // Session name from metadata
Mode string // Agent mode (e.g., "auto-run")
Model string // Last used model
CreatedAt time.Time // When the session was created
UpdatedAt time.Time // Estimated from file mtime or blob analysis
MessageCount int // Number of user/assistant messages
TotalTokens int // Estimated token count (if available)
FirstUserMessage string // Content of the first user message (for title)
}
SessionInfo holds parsed session information for display.
type SessionMeta ¶
type SessionMeta struct {
AgentID string `json:"agentId"`
LatestRootBlobID string `json:"latestRootBlobId"`
Name string `json:"name"`
Mode string `json:"mode"`
CreatedAt int64 `json:"createdAt"` // Unix timestamp in milliseconds
LastUsedModel string `json:"lastUsedModel"`
}
SessionMeta holds metadata stored in the meta table at key "0". The value is hex-encoded JSON.
func (SessionMeta) CreatedTime ¶
func (m SessionMeta) CreatedTime() time.Time
CreatedTime returns the createdAt timestamp as time.Time.