providers

package
v0.3.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package providers defines the provider interface and registry for productivity tools

Index

Constants

View Source
const (
	ErrNotImplemented      = "tool not implemented by this provider"
	ErrNotAuthenticated    = "provider not authenticated"
	ErrRateLimitExceeded   = "rate limit exceeded"
	ErrInvalidParameters   = "invalid tool parameters"
	ErrProviderUnavailable = "provider temporarily unavailable"
)

Common error messages

Variables

View Source
var ErrNoProvider = fmt.Errorf("no productivity provider configured. Run 'jeff auth google' to connect your Google account")

ErrNoProvider is returned when no provider is configured

Functions

This section is empty.

Types

type Provider

type Provider interface {
	// Metadata
	Name() string             // Provider name (e.g., "gmail", "outlook")
	SupportedTools() []string // List of tool names this provider implements

	// Lifecycle
	Initialize(config map[string]string) error // Setup and configuration
	Authenticate() error                       // Perform OAuth or other auth flow
	Close() error                              // Cleanup resources

	// Health (for future multi-provider routing)
	Status() ProviderStatus             // Current provider health status
	Capabilities() ProviderCapabilities // Provider capabilities and limits

	// Tool execution
	ExecuteTool(toolName string, params map[string]interface{}) (ToolResult, error)
}

Provider is the interface that all productivity providers must implement Providers handle authentication and execution of productivity tools (email, calendar, tasks)

type ProviderCapabilities

type ProviderCapabilities struct {
	RateLimits map[string]int // tool_name -> calls per hour
	Features   []string       // Feature flags (e.g., "attachments", "calendar_sharing")
	MaxResults int            // Maximum results for list/search operations
}

ProviderCapabilities describes what a provider can do

type ProviderInfo

type ProviderInfo struct {
	Name           string   // Provider name
	Authenticated  bool     // Whether provider has valid credentials
	Active         bool     // Whether this is the active provider
	SupportedTools []string // Tools this provider implements
}

ProviderInfo contains metadata about a registered provider

type ProviderStatus

type ProviderStatus struct {
	Healthy   bool      // Whether provider is operational
	Message   string    // Status message or error description
	LastCheck time.Time // When status was last checked
}

ProviderStatus represents the current health status of a provider

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry manages available productivity providers

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new provider registry

func (*Registry) Count

func (r *Registry) Count() int

Count returns the number of registered providers

func (*Registry) ExecuteTool

func (r *Registry) ExecuteTool(toolName string, params map[string]interface{}) (ToolResult, error)

ExecuteTool routes a tool call to the active provider

func (*Registry) Get

func (r *Registry) Get(name string) (Provider, error)

Get retrieves a provider by name

func (*Registry) GetActive

func (r *Registry) GetActive() (Provider, error)

GetActive returns the currently active provider

func (*Registry) GetActiveName

func (r *Registry) GetActiveName() string

GetActiveName returns the name of the currently active provider

func (*Registry) HasProvider

func (r *Registry) HasProvider(name string) bool

HasProvider checks if a provider with the given name exists

func (*Registry) List

func (r *Registry) List() []ProviderInfo

List returns information about all registered providers

func (*Registry) ListNames

func (r *Registry) ListNames() []string

ListNames returns all registered provider names sorted alphabetically

func (*Registry) Register

func (r *Registry) Register(p Provider) error

Register adds a provider to the registry

func (*Registry) SetActive

func (r *Registry) SetActive(name string) error

SetActive sets the currently active provider

type ToolResult

type ToolResult struct {
	Success  bool                   `json:"success"`            // Whether operation succeeded
	Data     interface{}            `json:"data,omitempty"`     // Result data (format varies by tool)
	Error    string                 `json:"error,omitempty"`    // Error message if failed
	Metadata map[string]interface{} `json:"metadata,omitempty"` // Additional provider-specific info
}

ToolResult is returned from tool execution

Directories

Path Synopsis
Package gmail implements the Gmail productivity provider for Jeff
Package gmail implements the Gmail productivity provider for Jeff
Package oauth provides OAuth2 authentication utilities for productivity providers
Package oauth provides OAuth2 authentication utilities for productivity providers

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL