Documentation
¶
Index ¶
- Constants
- func CheckNotificationPermissions() bool
- func Cleanup(captures []*ScreenCapture) error
- func CleanupPath(path string) error
- func CompareImages(path1, path2 string, threshold float64) (bool, error)
- func ComputeHash(imagePath string) (uint64, error)
- func GetDisplayCount() int
- func GetDisplayInfo() string
- func HammingDistance(hash1, hash2 uint64) int
- func HasSignificantChange(oldHash, newHash uint64, threshold float64) bool
- func HashDifferenceRatio(hash1, hash2 uint64) float64
- func QuickDiff(path1, path2 string) bool
- func SendAnalysisNotification(result *AnalysisResult) error
- func SendFindingNotification(finding Finding) error
- func SendNotification(title, message string) error
- func SendNotificationWithSound(title, message, sound string) error
- func SendNotificationWithSubtitle(title, subtitle, message string) error
- type AnalysisResult
- type AnalyzeFunc
- type Finding
- type FindingType
- type MonitorStatus
- type ScreenCapture
- type WatchConfig
- type WatchMonitor
- type WatchState
Constants ¶
const AnalysisPrompt = `` /* 536-byte string literal not displayed */
AnalysisPrompt is the prompt template for screen analysis
Variables ¶
This section is empty.
Functions ¶
func CheckNotificationPermissions ¶
func CheckNotificationPermissions() bool
CheckNotificationPermissions checks if notifications are likely to work Note: This is a best-effort check; macOS doesn't provide a programmatic way to verify
func CompareImages ¶
CompareImages compares two image files and returns if they differ significantly
func ComputeHash ¶
ComputeHash generates a perceptual hash for an image file Returns a 64-bit hash where similar images have similar hash values
func GetDisplayCount ¶
func GetDisplayCount() int
GetDisplayCount returns the number of connected displays
func GetDisplayInfo ¶
func GetDisplayInfo() string
GetDisplayInfo returns formatted display information string
func HammingDistance ¶
HammingDistance returns the number of differing bits between two hashes
func HasSignificantChange ¶
HasSignificantChange determines if two images differ significantly threshold is the minimum difference ratio (0.0-1.0) to consider significant Default recommendation: 0.15 (15% difference)
func HashDifferenceRatio ¶
HashDifferenceRatio returns the percentage of differing bits (0.0-1.0)
func QuickDiff ¶
QuickDiff performs a quick file-size based diff before computing hash Returns true if files are likely different (different sizes or missing)
func SendAnalysisNotification ¶
func SendAnalysisNotification(result *AnalysisResult) error
SendAnalysisNotification sends a summary notification for analysis results
func SendFindingNotification ¶
SendFindingNotification sends a notification for a watch finding
func SendNotification ¶
SendNotification sends a macOS system notification
func SendNotificationWithSound ¶
SendNotificationWithSound sends a macOS notification with sound
func SendNotificationWithSubtitle ¶
SendNotificationWithSubtitle sends a notification with a subtitle
Types ¶
type AnalysisResult ¶
type AnalysisResult struct {
Timestamp time.Time `json:"timestamp"`
ScreenCount int `json:"screen_count"`
Findings []Finding `json:"findings"`
RawResponse string `json:"raw_response,omitempty"`
AnalysisTime time.Duration `json:"analysis_time"`
}
AnalysisResult contains the LLM's findings from analyzing a screenshot
func AnalyzeOnce ¶
func AnalyzeOnce(ctx context.Context, analyzeFunc AnalyzeFunc, tempDir string) (*AnalysisResult, error)
AnalyzeOnce performs a one-time screen capture and analysis
func (*AnalysisResult) ErrorCount ¶
func (r *AnalysisResult) ErrorCount() int
ErrorCount returns the number of ERROR findings
func (*AnalysisResult) HasFindings ¶
func (r *AnalysisResult) HasFindings() bool
HasFindings returns true if the analysis found any issues
func (*AnalysisResult) WarningCount ¶
func (r *AnalysisResult) WarningCount() int
WarningCount returns the number of WARNING findings
type AnalyzeFunc ¶
AnalyzeFunc is the function signature for analyzing screenshots
type Finding ¶
type Finding struct {
Type FindingType `json:"type"`
Description string `json:"description"`
Suggestion string `json:"suggestion,omitempty"`
}
Finding represents a single detected issue from screen analysis
type FindingType ¶
type FindingType string
FindingType represents the type of finding from analysis
const ( FindingError FindingType = "ERROR" FindingWarning FindingType = "WARNING" FindingImprovement FindingType = "IMPROVEMENT" )
type MonitorStatus ¶
type MonitorStatus struct {
State WatchState `json:"state"`
DisplayCount int `json:"display_count"`
TotalCaptures int `json:"total_captures"`
TotalAnalyses int `json:"total_analyses"`
LastCapture time.Time `json:"last_capture,omitempty"`
LastAnalysis time.Time `json:"last_analysis,omitempty"`
AnalysesThisMin int `json:"analyses_this_min"`
Uptime time.Duration `json:"uptime,omitempty"`
StartTime time.Time `json:"start_time,omitempty"`
}
MonitorStatus provides information about the current monitoring state
type ScreenCapture ¶
type ScreenCapture struct {
Path string `json:"path"`
DisplayID int `json:"display_id"`
Width int `json:"width"`
Height int `json:"height"`
Timestamp time.Time `json:"timestamp"`
Hash uint64 `json:"hash"`
}
ScreenCapture represents a captured screenshot
func CaptureAll ¶
func CaptureAll(tempDir string) ([]*ScreenCapture, error)
CaptureAll captures all screens and returns ScreenCapture structs
func CaptureOne ¶
func CaptureOne(tempDir string) (*ScreenCapture, error)
CaptureOne captures a single screenshot of all screens combined
type WatchConfig ¶
type WatchConfig struct {
// Enabled determines if the watch feature is active
Enabled bool `mapstructure:"enabled"`
// ChangeThreshold is the percentage difference (0.0-1.0) that triggers analysis
// Default: 0.15 (15%)
ChangeThreshold float64 `mapstructure:"change_threshold"`
// CaptureInterval is how often to check for screen changes
// Default: 2s
CaptureInterval time.Duration `mapstructure:"capture_interval"`
// DebounceInterval is the minimum time between analyses
// Default: 5s
DebounceInterval time.Duration `mapstructure:"debounce_interval"`
// MaxAnalysisPerMin is the rate limit for analyses per minute
// Default: 6
MaxAnalysisPerMin int `mapstructure:"max_analysis_per_min"`
// Notify enables macOS system notifications
// Default: true
Notify bool `mapstructure:"notify"`
}
WatchConfig holds configuration for the watch monitor
func DefaultConfig ¶
func DefaultConfig() WatchConfig
DefaultConfig returns the default watch configuration
type WatchMonitor ¶
type WatchMonitor struct {
// contains filtered or unexported fields
}
WatchMonitor coordinates screen monitoring and analysis
func NewWatchMonitor ¶
func NewWatchMonitor(config WatchConfig, analyzeFunc AnalyzeFunc, tempDir string) *WatchMonitor
NewWatchMonitor creates a new monitor with the given configuration
func (*WatchMonitor) IsRunning ¶
func (m *WatchMonitor) IsRunning() bool
IsRunning returns true if the monitor is actively running
func (*WatchMonitor) Results ¶
func (m *WatchMonitor) Results() <-chan *AnalysisResult
Results returns the channel for receiving analysis results
func (*WatchMonitor) Start ¶
func (m *WatchMonitor) Start() error
Start begins continuous screen monitoring
func (*WatchMonitor) Status ¶
func (m *WatchMonitor) Status() MonitorStatus
Status returns the current monitor status
type WatchState ¶
type WatchState int
WatchState represents the current state of the monitor
const ( StateIdle WatchState = iota StateMonitoring StateAnalyzing )
func (WatchState) String ¶
func (s WatchState) String() string
String returns the string representation of WatchState