tools

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package tools provides a unified adapter framework for external ecosystem tools. It standardizes tool detection, version checking, capability discovery, and health monitoring across all tools in the NTM ecosystem (bv, bd, am, cm, cass, s2p).

Index

Constants

View Source
const DefaultCacheTTL = 5 * time.Minute

DefaultCacheTTL is the default cache entry time-to-live.

View Source
const MinCacheTTL = 2 * time.Millisecond

MinCacheTTL is the minimum allowed TTL to ensure the cleanup ticker is valid. time.NewTicker requires a positive duration, and ttl/2 must be > 0.

Variables

View Source
var (
	ErrToolNotInstalled    = errors.New("tool not installed")
	ErrToolNotHealthy      = errors.New("tool not healthy")
	ErrTimeout             = errors.New("operation timed out")
	ErrSchemaValidation    = errors.New("schema validation failed")
	ErrCapabilityMissing   = errors.New("capability not available")
	ErrOutputLimitExceeded = errors.New("output limit exceeded")
)

Common errors returned by tool adapters

View Source
var ProviderEnvVars = map[string]string{
	"claude": "ANTHROPIC_API_KEY",
	"openai": "OPENAI_API_KEY",
	"gemini": "GOOGLE_API_KEY",
}

ProviderEnvVars maps provider names to their API key environment variables

View Source
var VersionRegex = regexp.MustCompile(`(\d+)\.(\d+)\.(\d+)`)

VersionRegex matches semantic version strings like "0.31.0"

Functions

func DetectProvider

func DetectProvider(output string) string

DetectProvider attempts to determine the AI provider from pane output

func GetCredentialEnvVar

func GetCredentialEnvVar(provider string) string

GetCredentialEnvVar returns the environment variable name for a provider's API key

func GetCredentialPath

func GetCredentialPath(provider string) string

GetCredentialPath returns the expected path where caam stores credentials for a provider. Returns the path in ~/.config/caam/current/<provider>.json format.

func Register

func Register(adapter Adapter)

Register adds an adapter to the global registry

Types

type ACFSAdapter

type ACFSAdapter struct {
	*BaseAdapter
}

ACFSAdapter provides integration with the Agentic Coding Flywheel Setup (acfs) tool

func NewACFSAdapter

func NewACFSAdapter() *ACFSAdapter

NewACFSAdapter creates a new ACFS adapter

func (*ACFSAdapter) Capabilities

func (a *ACFSAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns the list of acfs capabilities

func (*ACFSAdapter) Detect

func (a *ACFSAdapter) Detect() (string, bool)

Detect checks if acfs is installed

func (*ACFSAdapter) Doctor

func (a *ACFSAdapter) Doctor(ctx context.Context) (json.RawMessage, error)

Doctor runs system health check

func (*ACFSAdapter) GetInfo

func (a *ACFSAdapter) GetInfo(ctx context.Context) (json.RawMessage, error)

GetInfo returns system overview information

func (*ACFSAdapter) GetStatus

func (a *ACFSAdapter) GetStatus(ctx context.Context) (json.RawMessage, error)

GetStatus returns installation progress status

func (*ACFSAdapter) HasCapability

func (a *ACFSAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if acfs has a specific capability

func (*ACFSAdapter) Health

func (a *ACFSAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if acfs is functioning correctly

func (*ACFSAdapter) Info

func (a *ACFSAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete acfs tool information

func (*ACFSAdapter) Version

func (a *ACFSAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed acfs version

type AMAdapter

type AMAdapter struct {
	*BaseAdapter
	// contains filtered or unexported fields
}

AMAdapter provides integration with Agent Mail MCP server

func NewAMAdapter

func NewAMAdapter() *AMAdapter

NewAMAdapter creates a new Agent Mail adapter

func (*AMAdapter) Capabilities

func (a *AMAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns Agent Mail capabilities

func (*AMAdapter) Detect

func (a *AMAdapter) Detect() (string, bool)

Detect checks if Agent Mail CLI is installed

func (*AMAdapter) HasCapability

func (a *AMAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if Agent Mail has a specific capability

func (*AMAdapter) Health

func (a *AMAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if Agent Mail is functioning

func (*AMAdapter) HealthCheck

func (a *AMAdapter) HealthCheck(ctx context.Context) (json.RawMessage, error)

HealthCheck calls the server health endpoint

func (*AMAdapter) Info

func (a *AMAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete Agent Mail tool information

func (*AMAdapter) ServerURL

func (a *AMAdapter) ServerURL() string

ServerURL returns the configured server URL

func (*AMAdapter) SetServerURL

func (a *AMAdapter) SetServerURL(url string)

SetServerURL updates the Agent Mail server URL

func (*AMAdapter) Version

func (a *AMAdapter) Version(ctx context.Context) (Version, error)

Version returns the Agent Mail version

type Adapter

type Adapter interface {
	// Name returns the tool identifier
	Name() ToolName

	// Detect checks if the tool is installed and returns its path
	Detect() (path string, installed bool)

	// Version returns the installed version
	Version(ctx context.Context) (Version, error)

	// Capabilities returns the list of supported features
	Capabilities(ctx context.Context) ([]Capability, error)

	// Health checks if the tool is functioning correctly
	Health(ctx context.Context) (*HealthStatus, error)

	// HasCapability checks if a specific capability is available
	HasCapability(ctx context.Context, cap Capability) bool

	// Info returns complete tool information
	Info(ctx context.Context) (*ToolInfo, error)
}

Adapter defines the interface that all tool adapters must implement

func Get

func Get(name ToolName) (Adapter, bool)

Get returns an adapter from the global registry

func GetAll

func GetAll() []Adapter

GetAll returns all adapters from the global registry

func GetDetected

func GetDetected() []Adapter

GetDetected returns all detected tools from the global registry

type BDAdapter

type BDAdapter struct {
	*BaseAdapter
}

BDAdapter provides integration with the beads (bd) tool

func NewBDAdapter

func NewBDAdapter() *BDAdapter

NewBDAdapter creates a new BD adapter

func (*BDAdapter) Capabilities

func (a *BDAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns the list of bd capabilities

func (*BDAdapter) Detect

func (a *BDAdapter) Detect() (string, bool)

Detect checks if bd is installed

func (*BDAdapter) GetBlocked

func (a *BDAdapter) GetBlocked(ctx context.Context, dir string) (json.RawMessage, error)

GetBlocked returns blocked issues

func (*BDAdapter) GetList

func (a *BDAdapter) GetList(ctx context.Context, dir string, status string) (json.RawMessage, error)

GetList returns issues matching filter

func (*BDAdapter) GetReady

func (a *BDAdapter) GetReady(ctx context.Context, dir string) (json.RawMessage, error)

GetReady returns ready issues

func (*BDAdapter) GetStats

func (a *BDAdapter) GetStats(ctx context.Context, dir string) (json.RawMessage, error)

GetStats returns bd stats output

func (*BDAdapter) HasCapability

func (a *BDAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if bd has a specific capability

func (*BDAdapter) Health

func (a *BDAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if bd is functioning correctly

func (*BDAdapter) Info

func (a *BDAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete bd tool information

func (*BDAdapter) Show

func (a *BDAdapter) Show(ctx context.Context, dir, issueID string) (json.RawMessage, error)

Show returns details for a specific issue

func (*BDAdapter) Version

func (a *BDAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed bd version

type BVAdapter

type BVAdapter struct {
	*BaseAdapter
}

BVAdapter provides integration with the beads_viewer (bv) tool

func NewBVAdapter

func NewBVAdapter() *BVAdapter

NewBVAdapter creates a new BV adapter

func (*BVAdapter) Capabilities

func (a *BVAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns the list of bv capabilities

func (*BVAdapter) Detect

func (a *BVAdapter) Detect() (string, bool)

Detect checks if bv is installed

func (*BVAdapter) GetAlerts

func (a *BVAdapter) GetAlerts(ctx context.Context, dir string, opts BVAlertOptions) (json.RawMessage, error)

Analysis mode methods for advanced BV analysis

func (*BVAdapter) GetBurndown

func (a *BVAdapter) GetBurndown(ctx context.Context, dir string, sprint string) (json.RawMessage, error)

func (*BVAdapter) GetFileBeads

func (a *BVAdapter) GetFileBeads(ctx context.Context, dir string, filePath string, limit int) (json.RawMessage, error)

File mode methods for file-based analysis

func (*BVAdapter) GetFileHotspots

func (a *BVAdapter) GetFileHotspots(ctx context.Context, dir string, limit int) (json.RawMessage, error)

func (*BVAdapter) GetFileRelations

func (a *BVAdapter) GetFileRelations(ctx context.Context, dir string, filePath string, limit int, threshold float64) (json.RawMessage, error)

func (*BVAdapter) GetForecast

func (a *BVAdapter) GetForecast(ctx context.Context, dir string, target string) (json.RawMessage, error)

func (*BVAdapter) GetGraph

func (a *BVAdapter) GetGraph(ctx context.Context, dir string, opts BVGraphOptions) (json.RawMessage, error)

func (*BVAdapter) GetGroupedTriage

func (a *BVAdapter) GetGroupedTriage(ctx context.Context, dir string, opts BVGroupedTriageOptions) (json.RawMessage, error)

func (*BVAdapter) GetHistory

func (a *BVAdapter) GetHistory(ctx context.Context, dir string) (json.RawMessage, error)

func (*BVAdapter) GetImpact

func (a *BVAdapter) GetImpact(ctx context.Context, dir string, filePath string) (json.RawMessage, error)

func (*BVAdapter) GetInsights

func (a *BVAdapter) GetInsights(ctx context.Context, dir string) (json.RawMessage, error)

GetInsights returns the robot-insights output

func (*BVAdapter) GetLabelAttention

func (a *BVAdapter) GetLabelAttention(ctx context.Context, dir string, limit int) (json.RawMessage, error)

Label mode methods for label-based analysis

func (*BVAdapter) GetLabelFlow

func (a *BVAdapter) GetLabelFlow(ctx context.Context, dir string) (json.RawMessage, error)

func (*BVAdapter) GetLabelHealth

func (a *BVAdapter) GetLabelHealth(ctx context.Context, dir string) (json.RawMessage, error)

func (*BVAdapter) GetNext

func (a *BVAdapter) GetNext(ctx context.Context, dir string) (json.RawMessage, error)

GetNext returns the robot-next output (single top pick)

func (*BVAdapter) GetPlan

func (a *BVAdapter) GetPlan(ctx context.Context, dir string) (json.RawMessage, error)

GetPlan returns the robot-plan output

func (*BVAdapter) GetSearch

func (a *BVAdapter) GetSearch(ctx context.Context, dir string, query string) (json.RawMessage, error)

func (*BVAdapter) GetSearchWithOptions

func (a *BVAdapter) GetSearchWithOptions(ctx context.Context, dir string, opts BVSearchOptions) (json.RawMessage, error)

func (*BVAdapter) GetSuggestions

func (a *BVAdapter) GetSuggestions(ctx context.Context, dir string) (json.RawMessage, error)

func (*BVAdapter) GetTriage

func (a *BVAdapter) GetTriage(ctx context.Context, dir string) (json.RawMessage, error)

GetTriage returns the robot-triage output

func (*BVAdapter) HasCapability

func (a *BVAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if bv has a specific capability

func (*BVAdapter) Health

func (a *BVAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if bv is functioning correctly

func (*BVAdapter) Info

func (a *BVAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete bv tool information

func (*BVAdapter) Version

func (a *BVAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed bv version

type BVAlertOptions

type BVAlertOptions struct {
	AlertType string
	Severity  string
	Label     string
}

BVAlertOptions configures BV alert filtering.

type BVGraphOptions

type BVGraphOptions struct {
	Format string
}

BVGraphOptions configures BV graph output.

type BVGroupedTriageOptions

type BVGroupedTriageOptions struct {
	ByLabel bool
	ByTrack bool
}

BVGroupedTriageOptions configures grouped triage output.

type BVSearchOptions

type BVSearchOptions struct {
	Query string
	Limit int
	Mode  string
}

BVSearchOptions configures BV search behavior.

type BaseAdapter

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

BaseAdapter provides common functionality for adapters

func NewBaseAdapter

func NewBaseAdapter(name ToolName, binaryName string) *BaseAdapter

NewBaseAdapter creates a new base adapter

func (*BaseAdapter) BinaryName

func (a *BaseAdapter) BinaryName() string

BinaryName returns the executable name

func (*BaseAdapter) Info

func (a *BaseAdapter) Info(ctx context.Context, adapter Adapter) (*ToolInfo, error)

Info returns complete tool information using the adapter methods

func (*BaseAdapter) Name

func (a *BaseAdapter) Name() ToolName

Name returns the tool identifier

func (*BaseAdapter) SetTimeout

func (a *BaseAdapter) SetTimeout(t time.Duration)

SetTimeout sets the default operation timeout

func (*BaseAdapter) Timeout

func (a *BaseAdapter) Timeout() time.Duration

Timeout returns the default operation timeout

type BlockedCommand

type BlockedCommand struct {
	Command   string `json:"command"`
	Reason    string `json:"reason"`
	Timestamp string `json:"timestamp,omitempty"`
}

BlockedCommand represents a command that was blocked by DCG

type CAAMAccount

type CAAMAccount struct {
	ID            string    `json:"id"`
	Provider      string    `json:"provider"`
	Email         string    `json:"email,omitempty"`
	Name          string    `json:"name,omitempty"`
	Active        bool      `json:"active"`
	RateLimited   bool      `json:"rate_limited,omitempty"`
	CooldownUntil time.Time `json:"cooldown_until,omitempty"`
}

CAAMAccount represents an account managed by CAAM

type CAAMAdapter

type CAAMAdapter struct {
	*BaseAdapter
}

CAAMAdapter provides integration with the CAAM (Coding Agent Account Manager) tool. CAAM manages multiple accounts for AI coding agents and handles automatic account rotation when rate limits are hit.

func NewCAAMAdapter

func NewCAAMAdapter() *CAAMAdapter

NewCAAMAdapter creates a new CAAM adapter

func (*CAAMAdapter) Capabilities

func (a *CAAMAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns the list of caam capabilities

func (*CAAMAdapter) Detect

func (a *CAAMAdapter) Detect() (string, bool)

Detect checks if caam is installed

func (*CAAMAdapter) GetAccounts

func (a *CAAMAdapter) GetAccounts(ctx context.Context) ([]CAAMAccount, error)

GetAccounts returns the list of configured accounts

func (*CAAMAdapter) GetActiveAccount

func (a *CAAMAdapter) GetActiveAccount(ctx context.Context) (*CAAMAccount, error)

GetActiveAccount returns the currently active account

func (*CAAMAdapter) GetCurrentCredentials

func (a *CAAMAdapter) GetCurrentCredentials(ctx context.Context, provider string) (*CAAMCredentials, error)

GetCurrentCredentials returns credential information for the active account of a provider. This calls `caam creds <provider> --json` to get the current active credentials. The returned credentials include the environment variable name and optionally the token path.

func (*CAAMAdapter) GetStatus

func (a *CAAMAdapter) GetStatus(ctx context.Context) (*CAAMStatus, error)

GetStatus returns the current CAAM status with caching

func (*CAAMAdapter) HasCapability

func (a *CAAMAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if caam has a specific capability

func (*CAAMAdapter) HasMultipleAccounts

func (a *CAAMAdapter) HasMultipleAccounts(ctx context.Context) bool

HasMultipleAccounts returns true if caam has more than one account configured

func (*CAAMAdapter) Health

func (a *CAAMAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if caam is functioning correctly

func (*CAAMAdapter) Info

func (a *CAAMAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete caam tool information

func (*CAAMAdapter) InvalidateCache

func (a *CAAMAdapter) InvalidateCache()

InvalidateCache forces the next GetStatus call to fetch fresh data

func (*CAAMAdapter) IsAvailable

func (a *CAAMAdapter) IsAvailable(ctx context.Context) bool

IsAvailable is a convenience method that returns true if caam is installed and has at least one account configured

func (*CAAMAdapter) SwitchAccount

func (a *CAAMAdapter) SwitchAccount(ctx context.Context, accountID string) error

SwitchAccount switches to a different account

func (*CAAMAdapter) SwitchToNextAccount

func (a *CAAMAdapter) SwitchToNextAccount(ctx context.Context, provider string) (*SwitchResult, error)

SwitchToNextAccount switches to the next available account for a provider. It calls `caam switch <provider> --next --json` and returns the structured result. This is the preferred method for automatic account switching on rate limit.

func (*CAAMAdapter) Version

func (a *CAAMAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed caam version

type CAAMCredentials

type CAAMCredentials struct {
	Provider    string `json:"provider"`
	AccountID   string `json:"account_id"`
	APIKey      string `json:"api_key,omitempty"`
	TokenPath   string `json:"token_path,omitempty"`
	EnvVarName  string `json:"env_var_name"`
	ValidUntil  string `json:"valid_until,omitempty"`
	RateLimited bool   `json:"rate_limited"`
}

CAAMCredentials represents credential information for an active account

type CAAMStatus

type CAAMStatus struct {
	Available     bool          `json:"available"`
	Version       string        `json:"version,omitempty"`
	AccountsCount int           `json:"accounts_count"`
	Providers     []string      `json:"providers,omitempty"`
	ActiveAccount *CAAMAccount  `json:"active_account,omitempty"`
	Accounts      []CAAMAccount `json:"accounts,omitempty"`
}

CAAMStatus represents the current CAAM status

type CASSAdapter

type CASSAdapter struct {
	*BaseAdapter
}

CASSAdapter provides integration with Cross-Agent Semantic Search

func NewCASSAdapter

func NewCASSAdapter() *CASSAdapter

NewCASSAdapter creates a new CASS adapter

func (*CASSAdapter) Capabilities

func (a *CASSAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns cass capabilities

func (*CASSAdapter) Detect

func (a *CASSAdapter) Detect() (string, bool)

Detect checks if cass is installed

func (*CASSAdapter) GetCapabilities

func (a *CASSAdapter) GetCapabilities(ctx context.Context) (json.RawMessage, error)

GetCapabilities returns cass capabilities info

func (*CASSAdapter) HasCapability

func (a *CASSAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if cass has a specific capability

func (*CASSAdapter) Health

func (a *CASSAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if cass is functioning

func (*CASSAdapter) Info

func (a *CASSAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete cass tool information

func (*CASSAdapter) Search

func (a *CASSAdapter) Search(ctx context.Context, query string, limit int) (json.RawMessage, error)

Search performs a semantic search across agent conversations

func (*CASSAdapter) Version

func (a *CASSAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed cass version

type CMAdapter

type CMAdapter struct {
	*BaseAdapter
	// contains filtered or unexported fields
}

CMAdapter provides integration with the CASS Memory (cm) tool

func NewCMAdapter

func NewCMAdapter() *CMAdapter

NewCMAdapter creates a new CM adapter

func (*CMAdapter) Capabilities

func (a *CMAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns cm capabilities

func (*CMAdapter) Connect

func (a *CMAdapter) Connect(projectDir, sessionID string) error

Connect initializes the HTTP client by discovering the daemon port

func (*CMAdapter) Detect

func (a *CMAdapter) Detect() (string, bool)

Detect checks if cm is installed

func (*CMAdapter) GetContext

func (a *CMAdapter) GetContext(ctx context.Context, taskDescription string) (json.RawMessage, error)

GetContext retrieves contextual information for a task

func (*CMAdapter) HasCapability

func (a *CMAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if cm has a specific capability

func (*CMAdapter) Health

func (a *CMAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if cm is functioning

func (*CMAdapter) Info

func (a *CMAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete cm tool information

func (*CMAdapter) OnboardStatus

func (a *CMAdapter) OnboardStatus(ctx context.Context) (json.RawMessage, error)

OnboardStatus returns onboarding status

func (*CMAdapter) SetServerPort

func (a *CMAdapter) SetServerPort(port int)

SetServerPort updates the CM server port

func (*CMAdapter) Version

func (a *CMAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed cm version

type Cache

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

Cache provides thread-safe caching with TTL

func NewCache

func NewCache(ttl time.Duration) *Cache

NewCache creates a new cache with the specified TTL. If ttl is 0, DefaultCacheTTL is used. If ttl is less than MinCacheTTL, MinCacheTTL is used to ensure the cleanup goroutine's ticker has a valid positive duration.

func (*Cache) Clear

func (c *Cache) Clear()

Clear removes all entries from the cache

func (*Cache) Close

func (c *Cache) Close()

Close stops the cleanup goroutine and releases resources. The cache should not be used after Close is called.

func (*Cache) Delete

func (c *Cache) Delete(key string)

Delete removes a key from the cache

func (*Cache) Get

func (c *Cache) Get(key string) (interface{}, bool)

Get retrieves a value from the cache

func (*Cache) Set

func (c *Cache) Set(key string, value interface{})

Set stores a value in the cache with the default TTL

func (*Cache) SetWithTTL

func (c *Cache) SetWithTTL(key string, value interface{}, ttl time.Duration)

SetWithTTL stores a value with a custom TTL

func (*Cache) Size

func (c *Cache) Size() int

Size returns the number of entries in the cache

type Capability

type Capability string

Capability represents a feature provided by a tool

const (
	CapRobotMode   Capability = "robot_mode"   // JSON output for automation
	CapDaemonMode  Capability = "daemon_mode"  // Can run as daemon
	CapMacros      Capability = "macros"       // Supports macro commands
	CapSearch      Capability = "search"       // Can search content
	CapContextPack Capability = "context_pack" // Context preparation
)

Common capabilities across tools

type CautAdapter

type CautAdapter struct {
	*BaseAdapter
}

CautAdapter provides integration with the caut (Cloud API Usage Tracker) tool. caut tracks API usage, quotas, and spending across cloud providers like Anthropic, OpenAI, etc.

func NewCautAdapter

func NewCautAdapter() *CautAdapter

NewCautAdapter creates a new caut adapter

func (*CautAdapter) Capabilities

func (a *CautAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns the list of caut capabilities

func (*CautAdapter) Detect

func (a *CautAdapter) Detect() (string, bool)

Detect checks if caut is installed

func (*CautAdapter) GetAllUsage

func (a *CautAdapter) GetAllUsage(ctx context.Context, period string) ([]CautUsage, error)

GetAllUsage returns usage data for all configured providers

func (*CautAdapter) GetAvailability

func (a *CautAdapter) GetAvailability(ctx context.Context) (*CautAvailability, error)

GetAvailability returns whether caut is available and compatible, with caching.

func (*CautAdapter) GetQuotaStatus

func (a *CautAdapter) GetQuotaStatus(ctx context.Context) ([]CautProvider, error)

GetQuotaStatus returns the current quota status for all providers

func (*CautAdapter) GetStatus

func (a *CautAdapter) GetStatus(ctx context.Context) (*CautStatus, error)

GetStatus returns the current caut status

func (*CautAdapter) GetUsage

func (a *CautAdapter) GetUsage(ctx context.Context, provider, period string) (*CautUsage, error)

GetUsage returns usage data for a specific provider and time period

func (*CautAdapter) HasCapability

func (a *CautAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if caut has a specific capability

func (*CautAdapter) HasUsageData

func (a *CautAdapter) HasUsageData(ctx context.Context) bool

HasUsageData returns true if caut has been configured with usage data.

func (*CautAdapter) Health

func (a *CautAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if caut is functioning correctly

func (*CautAdapter) Info

func (a *CautAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete caut tool information

func (*CautAdapter) InvalidateAvailabilityCache

func (a *CautAdapter) InvalidateAvailabilityCache()

InvalidateAvailabilityCache forces the next GetAvailability call to re-check.

func (*CautAdapter) IsAvailable

func (a *CautAdapter) IsAvailable(ctx context.Context) bool

IsAvailable returns true if caut is installed and compatible.

func (*CautAdapter) Version

func (a *CautAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed caut version

type CautAvailability

type CautAvailability struct {
	Available   bool      `json:"available"`
	Compatible  bool      `json:"compatible"`
	HasData     bool      `json:"has_data"` // Has been initialized with usage data
	Version     Version   `json:"version,omitempty"`
	Path        string    `json:"path,omitempty"`
	Providers   []string  `json:"providers,omitempty"` // Configured providers
	LastChecked time.Time `json:"last_checked"`
	Error       string    `json:"error,omitempty"`
}

CautAvailability represents the availability and compatibility of caut on PATH.

type CautProvider

type CautProvider struct {
	Name      string  `json:"name"`
	Enabled   bool    `json:"enabled"`
	HasQuota  bool    `json:"has_quota"`
	QuotaUsed float64 `json:"quota_used,omitempty"` // 0-100 percentage
}

CautProvider represents a cloud API provider configuration

type CautStatus

type CautStatus struct {
	Running       bool           `json:"running"`
	Tracking      bool           `json:"tracking"`
	ProviderCount int            `json:"provider_count"`
	Providers     []CautProvider `json:"providers,omitempty"`
	TotalSpend    float64        `json:"total_spend,omitempty"`   // Total spend in USD
	QuotaPercent  float64        `json:"quota_percent,omitempty"` // Overall quota usage 0-100
	LastUpdated   string         `json:"last_updated,omitempty"`  // ISO timestamp
	Error         string         `json:"error,omitempty"`
}

CautStatus represents the current caut status

type CautUsage

type CautUsage struct {
	Provider     string  `json:"provider"`
	RequestCount int     `json:"request_count"`
	TokensIn     int64   `json:"tokens_in"`
	TokensOut    int64   `json:"tokens_out"`
	Cost         float64 `json:"cost"`
	Period       string  `json:"period"` // "day", "week", "month"
	StartDate    string  `json:"start_date,omitempty"`
	EndDate      string  `json:"end_date,omitempty"`
}

CautUsage represents usage data for a specific time period

type DCGAdapter

type DCGAdapter struct {
	*BaseAdapter
}

DCGAdapter provides integration with the Destructive Command Guard (dcg) tool. DCG blocks dangerous commands like rm -rf, git reset --hard, DROP DATABASE, etc. and provides safety guardrails for agent operations.

func NewDCGAdapter

func NewDCGAdapter() *DCGAdapter

NewDCGAdapter creates a new DCG adapter

func (*DCGAdapter) Capabilities

func (a *DCGAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns the list of dcg capabilities

func (*DCGAdapter) CheckCommand

func (a *DCGAdapter) CheckCommand(ctx context.Context, command string) (*BlockedCommand, error)

CheckCommand checks if a command would be blocked by DCG

func (*DCGAdapter) Detect

func (a *DCGAdapter) Detect() (string, bool)

Detect checks if dcg is installed

func (*DCGAdapter) GetAvailability

func (a *DCGAdapter) GetAvailability(ctx context.Context) (*DCGAvailability, error)

GetAvailability returns whether dcg is available and compatible, with caching. It logs a warning if dcg is missing or incompatible, but does not return an error.

func (*DCGAdapter) GetStatus

func (a *DCGAdapter) GetStatus(ctx context.Context) (*DCGStatus, error)

GetStatus returns the current DCG status

func (*DCGAdapter) HasCapability

func (a *DCGAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if dcg has a specific capability

func (*DCGAdapter) Health

func (a *DCGAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if dcg is functioning correctly

func (*DCGAdapter) Info

func (a *DCGAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete dcg tool information

func (*DCGAdapter) InvalidateAvailabilityCache

func (a *DCGAdapter) InvalidateAvailabilityCache()

InvalidateAvailabilityCache forces the next GetAvailability call to re-check.

func (*DCGAdapter) IsAvailable

func (a *DCGAdapter) IsAvailable(ctx context.Context) bool

IsAvailable returns true if dcg is installed and compatible.

func (*DCGAdapter) Version

func (a *DCGAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed dcg version

type DCGAvailability

type DCGAvailability struct {
	Available   bool      `json:"available"`
	Compatible  bool      `json:"compatible"`
	Version     Version   `json:"version,omitempty"`
	Path        string    `json:"path,omitempty"`
	LastChecked time.Time `json:"last_checked"`
	Error       string    `json:"error,omitempty"`
}

DCGAvailability represents the availability and compatibility of dcg on PATH. Available indicates the binary is found; Compatible indicates version meets minimum requirements.

type DCGStatus

type DCGStatus struct {
	Enabled          bool     `json:"enabled"`
	BlockedPatterns  []string `json:"blocked_patterns,omitempty"`
	AllowedOverrides []string `json:"allowed_overrides,omitempty"`
}

DCGStatus represents the current DCG configuration status

type GIILAdapter

type GIILAdapter struct {
	*BaseAdapter
}

GIILAdapter provides integration with the GIIL (Get Image from Internet Link) tool. GIIL downloads images from cloud photo sharing services (iCloud, Dropbox, Google Photos, Google Drive) with maximum reliability using Playwright.

func NewGIILAdapter

func NewGIILAdapter() *GIILAdapter

NewGIILAdapter creates a new GIIL adapter

func (*GIILAdapter) Capabilities

func (a *GIILAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns the list of giil capabilities

func (*GIILAdapter) Detect

func (a *GIILAdapter) Detect() (string, bool)

Detect checks if giil is installed

func (*GIILAdapter) Download

func (a *GIILAdapter) Download(ctx context.Context, shareURL, outputDir string) (*GIILMetadata, error)

Download downloads an image from a share URL

func (*GIILAdapter) GetDirectURL

func (a *GIILAdapter) GetDirectURL(ctx context.Context, shareURL string) (*GIILMetadata, error)

GetDirectURL extracts the direct download URL without actually downloading

func (*GIILAdapter) HasCapability

func (a *GIILAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if giil has a specific capability

func (*GIILAdapter) Health

func (a *GIILAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if giil is functioning correctly

func (*GIILAdapter) Info

func (a *GIILAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete giil tool information

func (*GIILAdapter) Version

func (a *GIILAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed giil version

type GIILMetadata

type GIILMetadata struct {
	URL          string `json:"url,omitempty"`
	DirectURL    string `json:"direct_url,omitempty"`
	Filename     string `json:"filename,omitempty"`
	OutputPath   string `json:"output_path,omitempty"`
	ContentType  string `json:"content_type,omitempty"`
	Size         int64  `json:"size,omitempty"`
	Width        int    `json:"width,omitempty"`
	Height       int    `json:"height,omitempty"`
	Platform     string `json:"platform,omitempty"` // icloud, dropbox, google_photos, google_drive
	DownloadedAt string `json:"downloaded_at,omitempty"`
}

GIILMetadata represents metadata about a downloaded image

type HealthReport

type HealthReport struct {
	Total     int               `json:"total"`
	Healthy   int               `json:"healthy"`
	Unhealthy int               `json:"unhealthy"`
	Missing   int               `json:"missing"`
	Tools     map[ToolName]bool `json:"tools"`
}

HealthReport summarizes tool health across the registry.

func GetHealthReport

func GetHealthReport(ctx context.Context) *HealthReport

GetHealthReport returns health report from the global registry

type HealthStatus

type HealthStatus struct {
	Healthy     bool          `json:"healthy"`
	Message     string        `json:"message,omitempty"`
	LastChecked time.Time     `json:"last_checked"`
	Latency     time.Duration `json:"latency_ms,omitempty"`
	Error       string        `json:"error,omitempty"`
}

HealthStatus represents the health state of a tool

type JFPAdapter

type JFPAdapter struct {
	*BaseAdapter
}

JFPAdapter provides integration with the JeffreysPrompts CLI (jfp)

func NewJFPAdapter

func NewJFPAdapter() *JFPAdapter

NewJFPAdapter creates a new JFP adapter

func (*JFPAdapter) Bundle

func (a *JFPAdapter) Bundle(ctx context.Context, id string) (json.RawMessage, error)

Bundle returns details for a specific bundle

func (*JFPAdapter) Bundles

func (a *JFPAdapter) Bundles(ctx context.Context) (json.RawMessage, error)

Bundles returns all prompt bundles

func (*JFPAdapter) Capabilities

func (a *JFPAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns the list of jfp capabilities

func (*JFPAdapter) Categories

func (a *JFPAdapter) Categories(ctx context.Context) (json.RawMessage, error)

Categories returns all categories with counts

func (*JFPAdapter) Detect

func (a *JFPAdapter) Detect() (string, bool)

Detect checks if jfp is installed

func (*JFPAdapter) HasCapability

func (a *JFPAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if jfp has a specific capability

func (*JFPAdapter) Health

func (a *JFPAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if jfp is functioning correctly

func (*JFPAdapter) Info

func (a *JFPAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete jfp tool information

func (*JFPAdapter) Installed

func (a *JFPAdapter) Installed(ctx context.Context) (json.RawMessage, error)

Installed returns list of installed Claude Code skills

func (*JFPAdapter) List

func (a *JFPAdapter) List(ctx context.Context) (json.RawMessage, error)

List returns all prompts

func (*JFPAdapter) ListByCategory

func (a *JFPAdapter) ListByCategory(ctx context.Context, category string) (json.RawMessage, error)

ListByCategory returns prompts filtered by category

func (*JFPAdapter) ListByTag

func (a *JFPAdapter) ListByTag(ctx context.Context, tag string) (json.RawMessage, error)

ListByTag returns prompts filtered by tag

func (*JFPAdapter) Search

func (a *JFPAdapter) Search(ctx context.Context, query string) (json.RawMessage, error)

Search performs fuzzy search for prompts

func (*JFPAdapter) Show

func (a *JFPAdapter) Show(ctx context.Context, id string) (json.RawMessage, error)

Show returns details for a specific prompt

func (*JFPAdapter) Status

func (a *JFPAdapter) Status(ctx context.Context) (json.RawMessage, error)

Status returns registry cache status and settings

func (*JFPAdapter) Suggest

func (a *JFPAdapter) Suggest(ctx context.Context, task string) (json.RawMessage, error)

Suggest returns prompt suggestions for a task

func (*JFPAdapter) Tags

func (a *JFPAdapter) Tags(ctx context.Context) (json.RawMessage, error)

Tags returns all tags with counts

func (*JFPAdapter) Version

func (a *JFPAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed jfp version

type LimitedBuffer

type LimitedBuffer struct {
	bytes.Buffer
	Limit int
}

LimitedBuffer is a bytes.Buffer that errors on overflow. It is used to prevent OOM when capturing command output.

func NewLimitedBuffer

func NewLimitedBuffer(limit int) *LimitedBuffer

NewLimitedBuffer creates a new LimitedBuffer with the specified limit.

func (*LimitedBuffer) Write

func (b *LimitedBuffer) Write(p []byte) (n int, err error)

type MSAdapter

type MSAdapter struct {
	*BaseAdapter
}

MSAdapter provides integration with the Meta Skill (ms) tool

func NewMSAdapter

func NewMSAdapter() *MSAdapter

NewMSAdapter creates a new MS adapter

func (*MSAdapter) Capabilities

func (a *MSAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns the list of ms capabilities

func (*MSAdapter) Detect

func (a *MSAdapter) Detect() (string, bool)

Detect checks if ms is installed

func (*MSAdapter) HasCapability

func (a *MSAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if ms has a specific capability

func (*MSAdapter) Health

func (a *MSAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if ms is functioning correctly

func (*MSAdapter) Info

func (a *MSAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete ms tool information

func (*MSAdapter) List

func (a *MSAdapter) List(ctx context.Context) (json.RawMessage, error)

List returns all available skills

func (*MSAdapter) Search

func (a *MSAdapter) Search(ctx context.Context, query string) (json.RawMessage, error)

Search searches for skills matching a query

func (*MSAdapter) Show

func (a *MSAdapter) Show(ctx context.Context, id string) (json.RawMessage, error)

Show returns details for a specific skill

func (*MSAdapter) Suggest

func (a *MSAdapter) Suggest(ctx context.Context, task string) (json.RawMessage, error)

Suggest returns skill suggestions for a task

func (*MSAdapter) Version

func (a *MSAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed ms version

type PTAdapter

type PTAdapter struct {
	*BaseAdapter
}

PTAdapter provides integration with the process_triage tool. process_triage uses Bayesian classification to identify useful, abandoned, and zombie processes.

func NewPTAdapter

func NewPTAdapter() *PTAdapter

NewPTAdapter creates a new process_triage adapter

func (*PTAdapter) Capabilities

func (a *PTAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns the list of pt capabilities

func (*PTAdapter) ClassifyProcess

func (a *PTAdapter) ClassifyProcess(ctx context.Context, pid int) (*PTProcessResult, error)

ClassifyProcess classifies a single process by PID

func (*PTAdapter) ClassifyProcesses

func (a *PTAdapter) ClassifyProcesses(ctx context.Context, pids []int) ([]PTProcessResult, error)

ClassifyProcesses classifies multiple processes

func (*PTAdapter) Detect

func (a *PTAdapter) Detect() (string, bool)

Detect checks if pt is installed

func (*PTAdapter) GetStatus

func (a *PTAdapter) GetStatus(ctx context.Context) (*PTStatus, error)

GetStatus returns the current pt status with caching

func (*PTAdapter) HasCapability

func (a *PTAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if pt has a specific capability

func (*PTAdapter) Health

func (a *PTAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if pt is functioning correctly

func (*PTAdapter) Info

func (a *PTAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete pt tool information

func (*PTAdapter) InvalidateStatusCache

func (a *PTAdapter) InvalidateStatusCache()

InvalidateStatusCache forces the next GetStatus call to re-check

func (*PTAdapter) IsAvailable

func (a *PTAdapter) IsAvailable(ctx context.Context) bool

IsAvailable returns true if pt is installed and compatible

func (*PTAdapter) Version

func (a *PTAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed pt version

func (*PTAdapter) WatchSession

func (a *PTAdapter) WatchSession(ctx context.Context, sessionName string) ([]PTProcessResult, error)

WatchSession monitors agent processes in a session

type PTClassification

type PTClassification string

PTClassification represents a process classification result

const (
	PTClassUseful    PTClassification = "useful"
	PTClassAbandoned PTClassification = "abandoned"
	PTClassZombie    PTClassification = "zombie"
	PTClassUnknown   PTClassification = "unknown"
)

type PTProcessResult

type PTProcessResult struct {
	PID            int              `json:"pid"`
	Name           string           `json:"name,omitempty"`
	Classification PTClassification `json:"classification"`
	Confidence     float64          `json:"confidence"` // 0.0 to 1.0
	Reason         string           `json:"reason,omitempty"`
}

PTProcessResult represents classification result for a single process

type PTStatus

type PTStatus struct {
	Available   bool      `json:"available"`
	Compatible  bool      `json:"compatible"`
	Version     Version   `json:"version,omitempty"`
	Path        string    `json:"path,omitempty"`
	LastChecked time.Time `json:"last_checked"`
	Error       string    `json:"error,omitempty"`
}

PTStatus represents the availability and compatibility of pt on PATH.

type RCHAdapter

type RCHAdapter struct {
	*BaseAdapter
}

RCHAdapter provides integration with the Remote Compilation Helper (rch) tool. RCH offloads build commands to remote workers for faster compilation.

func NewRCHAdapter

func NewRCHAdapter() *RCHAdapter

NewRCHAdapter creates a new RCH adapter

func (*RCHAdapter) Capabilities

func (a *RCHAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns the list of rch capabilities

func (*RCHAdapter) Detect

func (a *RCHAdapter) Detect() (string, bool)

Detect checks if rch is installed

func (*RCHAdapter) GetAvailability

func (a *RCHAdapter) GetAvailability(ctx context.Context) (*RCHAvailability, error)

GetAvailability returns whether rch is available and compatible, with caching. It also checks worker availability since workers may come and go.

func (*RCHAdapter) GetStatus

func (a *RCHAdapter) GetStatus(ctx context.Context) (*RCHStatus, error)

GetStatus returns the current RCH status including worker information

func (*RCHAdapter) GetWorkers

func (a *RCHAdapter) GetWorkers(ctx context.Context) ([]RCHWorker, error)

GetWorkers returns the list of configured workers

func (*RCHAdapter) HasCapability

func (a *RCHAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if rch has a specific capability

func (*RCHAdapter) HasHealthyWorkers

func (a *RCHAdapter) HasHealthyWorkers(ctx context.Context) bool

HasHealthyWorkers returns true if there are any healthy workers available.

func (*RCHAdapter) Health

func (a *RCHAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if rch is functioning correctly

func (*RCHAdapter) Info

func (a *RCHAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete rch tool information

func (*RCHAdapter) InvalidateAvailabilityCache

func (a *RCHAdapter) InvalidateAvailabilityCache()

InvalidateAvailabilityCache forces the next GetAvailability call to re-check.

func (*RCHAdapter) IsAvailable

func (a *RCHAdapter) IsAvailable(ctx context.Context) bool

IsAvailable returns true if rch is installed and compatible.

func (*RCHAdapter) SelectWorker

func (a *RCHAdapter) SelectWorker(ctx context.Context, preferred string) (*RCHWorker, error)

SelectWorker returns the best available worker for a build

func (*RCHAdapter) Version

func (a *RCHAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed rch version

type RCHAvailability

type RCHAvailability struct {
	Available    bool      `json:"available"`
	Compatible   bool      `json:"compatible"`
	Version      Version   `json:"version,omitempty"`
	Path         string    `json:"path,omitempty"`
	WorkerCount  int       `json:"worker_count"`
	HealthyCount int       `json:"healthy_count"`
	LastChecked  time.Time `json:"last_checked"`
	Error        string    `json:"error,omitempty"`
}

RCHAvailability represents the availability and compatibility of rch on PATH.

type RCHStatus

type RCHStatus struct {
	Enabled      bool        `json:"enabled"`
	WorkerCount  int         `json:"worker_count"`
	HealthyCount int         `json:"healthy_count"`
	Workers      []RCHWorker `json:"workers,omitempty"`
}

RCHStatus represents the current RCH status including workers

type RCHWorker

type RCHWorker struct {
	Name            string `json:"name"`
	Host            string `json:"host,omitempty"`
	Available       bool   `json:"available"`
	Healthy         bool   `json:"healthy"`
	Load            int    `json:"load,omitempty"`             // 0-100 load percentage
	Queue           int    `json:"queue,omitempty"`            // Jobs in queue
	LastSeen        string `json:"last_seen,omitempty"`        // ISO timestamp
	CurrentBuild    string `json:"current_build,omitempty"`    // Current build command (if provided)
	BuildsCompleted int    `json:"builds_completed,omitempty"` // Total builds completed (if provided)
	CPUPercent      int    `json:"cpu_percent,omitempty"`      // Current CPU percent (if provided)
}

RCHWorker represents a remote compilation worker

type RUAdapter

type RUAdapter struct {
	*BaseAdapter
}

RUAdapter provides integration with the Repo Updater (ru) tool. RU is a CLI for synchronizing GitHub repositories across multiple projects, supporting smart commits, issue/PR review, and automation workflows.

func NewRUAdapter

func NewRUAdapter() *RUAdapter

NewRUAdapter creates a new RU adapter

func (*RUAdapter) Capabilities

func (a *RUAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns the list of ru capabilities

func (*RUAdapter) Detect

func (a *RUAdapter) Detect() (string, bool)

Detect checks if ru is installed

func (*RUAdapter) Doctor

func (a *RUAdapter) Doctor(ctx context.Context) (string, error)

Doctor runs ru doctor diagnostics

func (*RUAdapter) GetStatus

func (a *RUAdapter) GetStatus(ctx context.Context) (*RUStatus, error)

GetStatus returns the current ru status for all tracked repos

func (*RUAdapter) HasCapability

func (a *RUAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if ru has a specific capability

func (*RUAdapter) Health

func (a *RUAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if ru is functioning correctly

func (*RUAdapter) Info

func (a *RUAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete ru tool information

func (*RUAdapter) Sync

func (a *RUAdapter) Sync(ctx context.Context, dryRun bool) error

Sync runs ru sync with optional flags

func (*RUAdapter) Version

func (a *RUAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed ru version

type RURepoStatus

type RURepoStatus struct {
	Name       string `json:"name"`
	Path       string `json:"path"`
	Status     string `json:"status"`
	Branch     string `json:"branch,omitempty"`
	Ahead      int    `json:"ahead,omitempty"`
	Behind     int    `json:"behind,omitempty"`
	HasChanges bool   `json:"has_changes,omitempty"`
}

RURepoStatus represents the status of a single repo

type RUStatus

type RUStatus struct {
	Repos      []RURepoStatus `json:"repos,omitempty"`
	TotalRepos int            `json:"total_repos"`
	NeedsSync  int            `json:"needs_sync"`
	UpToDate   int            `json:"up_to_date"`
	HasChanges int            `json:"has_changes"`
}

RUStatus represents the current ru status output

type RanoAdapter

type RanoAdapter struct {
	*BaseAdapter
}

RanoAdapter provides integration with the rano network observer tool. rano monitors network traffic per-process, enabling per-agent API tracking.

func NewRanoAdapter

func NewRanoAdapter() *RanoAdapter

NewRanoAdapter creates a new rano adapter

func (*RanoAdapter) Capabilities

func (a *RanoAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns the list of rano capabilities

func (*RanoAdapter) Detect

func (a *RanoAdapter) Detect() (string, bool)

Detect checks if rano is installed

func (*RanoAdapter) GetAllProcessStats

func (a *RanoAdapter) GetAllProcessStats(ctx context.Context) ([]RanoProcessStats, error)

GetAllProcessStats returns network stats for all tracked processes. Window is optional; empty means default window.

func (*RanoAdapter) GetAllProcessStatsWithWindow

func (a *RanoAdapter) GetAllProcessStatsWithWindow(ctx context.Context, window string) ([]RanoProcessStats, error)

GetAllProcessStatsWithWindow returns network stats for all tracked processes with a time window override. Window should be a string like "5m", "1h". Empty means default window.

func (*RanoAdapter) GetAvailability

func (a *RanoAdapter) GetAvailability(ctx context.Context) (*RanoAvailability, error)

GetAvailability returns whether rano is available and compatible, with caching.

func (*RanoAdapter) GetProcessStats

func (a *RanoAdapter) GetProcessStats(ctx context.Context, pid int) (*RanoProcessStats, error)

GetProcessStats returns network stats for a specific PID. Window is optional; empty means default window.

func (*RanoAdapter) GetProcessStatsWithWindow

func (a *RanoAdapter) GetProcessStatsWithWindow(ctx context.Context, pid int, window string) (*RanoProcessStats, error)

GetProcessStatsWithWindow returns network stats for a specific PID with a time window override. Window should be a string like "5m", "1h". Empty means default window.

func (*RanoAdapter) GetStatus

func (a *RanoAdapter) GetStatus(ctx context.Context) (*RanoStatus, error)

GetStatus returns the current rano status

func (*RanoAdapter) HasCapability

func (a *RanoAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if rano has a specific capability

func (*RanoAdapter) HasRequiredPermissions

func (a *RanoAdapter) HasRequiredPermissions(ctx context.Context) bool

HasRequiredPermissions returns true if rano has the required capabilities.

func (*RanoAdapter) Health

func (a *RanoAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if rano is functioning correctly

func (*RanoAdapter) Info

func (a *RanoAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete rano tool information

func (*RanoAdapter) InvalidateAvailabilityCache

func (a *RanoAdapter) InvalidateAvailabilityCache()

InvalidateAvailabilityCache forces the next GetAvailability call to re-check.

func (*RanoAdapter) IsAvailable

func (a *RanoAdapter) IsAvailable(ctx context.Context) bool

IsAvailable returns true if rano is installed, compatible, and has required permissions.

func (*RanoAdapter) Version

func (a *RanoAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed rano version

type RanoAvailability

type RanoAvailability struct {
	Available     bool      `json:"available"`
	Compatible    bool      `json:"compatible"`
	HasCapability bool      `json:"has_capability"` // Has CAP_NET_ADMIN
	CanReadProc   bool      `json:"can_read_proc"`  // Can read /proc for PID mapping
	Version       Version   `json:"version,omitempty"`
	Path          string    `json:"path,omitempty"`
	LastChecked   time.Time `json:"last_checked"`
	Error         string    `json:"error,omitempty"`
}

RanoAvailability represents the availability and compatibility of rano on PATH.

type RanoProcessStats

type RanoProcessStats struct {
	PID          int    `json:"pid"`
	ProcessName  string `json:"process_name,omitempty"`
	RequestCount int    `json:"request_count"`
	BytesIn      int64  `json:"bytes_in"`
	BytesOut     int64  `json:"bytes_out"`
	LastRequest  string `json:"last_request,omitempty"` // ISO timestamp
}

RanoProcessStats represents network stats for a single process/agent

type RanoStatus

type RanoStatus struct {
	Running      bool   `json:"running"`
	Monitoring   bool   `json:"monitoring"`
	ProcessCount int    `json:"process_count"` // Number of processes being tracked
	RequestCount int    `json:"request_count"` // Total API requests observed
	BytesIn      int64  `json:"bytes_in"`      // Total bytes received
	BytesOut     int64  `json:"bytes_out"`     // Total bytes sent
	Error        string `json:"error,omitempty"`
}

RanoStatus represents the current rano status

type RateLimitCallback

type RateLimitCallback func(provider string, paneID string, patterns []string)

RateLimitCallback is called when a rate limit is detected

type RateLimitDetector

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

RateLimitDetector monitors agent output for rate limit signals and triggers CAAM account switching. It uses pattern matching to detect rate limit messages from different AI providers.

func NewRateLimitDetector

func NewRateLimitDetector(adapter *CAAMAdapter) *RateLimitDetector

NewRateLimitDetector creates a new rate limit detector with default patterns

func (*RateLimitDetector) Check

func (d *RateLimitDetector) Check(output string, paneID string) *RateLimitEvent

Check analyzes output for rate limit signals and triggers callback if found. It returns the detected event if a rate limit was found, nil otherwise. Providers are checked in order: claude, openai, gemini (deterministic).

func (*RateLimitDetector) SetCallback

func (d *RateLimitDetector) SetCallback(cb RateLimitCallback)

SetCallback sets the callback function for rate limit detection

func (*RateLimitDetector) SetCooldownPeriod

func (d *RateLimitDetector) SetCooldownPeriod(period time.Duration)

SetCooldownPeriod sets the minimum time between detections per provider

func (*RateLimitDetector) TriggerAccountSwitch

func (d *RateLimitDetector) TriggerAccountSwitch(ctx context.Context, event *RateLimitEvent) *RateLimitEvent

TriggerAccountSwitch attempts to switch CAAM accounts when rate limit is detected. Uses the new SwitchToNextAccount method which calls `caam switch <provider> --next --json`. Returns the event with switch results populated.

type RateLimitEvent

type RateLimitEvent struct {
	Provider      string    `json:"provider"`       // claude, openai, gemini
	PaneID        string    `json:"pane_id"`        // Pane where limit was detected
	DetectedAt    time.Time `json:"detected_at"`    // When limit was detected
	Patterns      []string  `json:"patterns"`       // Which patterns matched
	WaitSeconds   int       `json:"wait_seconds"`   // Suggested wait time (if detected)
	AccountBefore string    `json:"account_before"` // Account before switch (if any)
	AccountAfter  string    `json:"account_after"`  // Account after switch (if any)
	SwitchSuccess bool      `json:"switch_success"` // Whether account switch succeeded
}

RateLimitEvent contains information about a detected rate limit

type Registry

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

Registry maintains a collection of tool adapters

func GlobalRegistry

func GlobalRegistry() *Registry

GlobalRegistry returns the global registry instance

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new adapter registry

func (*Registry) All

func (r *Registry) All() []Adapter

All returns all registered adapters

func (*Registry) Detected

func (r *Registry) Detected() []Adapter

Detected returns all adapters for installed tools

func (*Registry) Get

func (r *Registry) Get(name ToolName) (Adapter, bool)

Get returns an adapter by name

func (*Registry) GetAllInfo

func (r *Registry) GetAllInfo(ctx context.Context) []*ToolInfo

GetAllInfo returns ToolInfo for all registered tools

func (*Registry) GetHealthReport

func (r *Registry) GetHealthReport(ctx context.Context) *HealthReport

GetHealthReport returns a health summary for all registered tools

func (*Registry) Names

func (r *Registry) Names() []ToolName

Names returns the names of all registered adapters

func (*Registry) Register

func (r *Registry) Register(adapter Adapter)

Register adds an adapter to the registry

type S2PAdapter

type S2PAdapter struct {
	*BaseAdapter
}

S2PAdapter provides integration with Source-to-Prompt tool

func NewS2PAdapter

func NewS2PAdapter() *S2PAdapter

NewS2PAdapter creates a new S2P adapter

func (*S2PAdapter) Capabilities

func (a *S2PAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns s2p capabilities

func (*S2PAdapter) Detect

func (a *S2PAdapter) Detect() (string, bool)

Detect checks if s2p is installed

func (*S2PAdapter) GenerateContext

func (a *S2PAdapter) GenerateContext(ctx context.Context, dir string, patterns []string, format string) ([]byte, error)

GenerateContext generates context for given files/patterns

func (*S2PAdapter) HasCapability

func (a *S2PAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if s2p has a specific capability

func (*S2PAdapter) Health

func (a *S2PAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if s2p is functioning

func (*S2PAdapter) Info

func (a *S2PAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete s2p tool information

func (*S2PAdapter) Version

func (a *S2PAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed s2p version

type SLBAdapter

type SLBAdapter struct {
	*BaseAdapter
}

SLBAdapter provides integration with the Simultaneous Launch Button (slb) tool

func NewSLBAdapter

func NewSLBAdapter() *SLBAdapter

NewSLBAdapter creates a new SLB adapter

func (*SLBAdapter) Approve

func (a *SLBAdapter) Approve(ctx context.Context, requestID string) (json.RawMessage, error)

Approve approves a pending request

func (*SLBAdapter) Capabilities

func (a *SLBAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns the list of slb capabilities

func (*SLBAdapter) Deny

func (a *SLBAdapter) Deny(ctx context.Context, requestID string, reason string) (json.RawMessage, error)

Deny denies a pending request

func (*SLBAdapter) Detect

func (a *SLBAdapter) Detect() (string, bool)

Detect checks if slb is installed

func (*SLBAdapter) HasCapability

func (a *SLBAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if slb has a specific capability

func (*SLBAdapter) Health

func (a *SLBAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if slb is functioning correctly

func (*SLBAdapter) Info

func (a *SLBAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete slb tool information

func (*SLBAdapter) Pending

func (a *SLBAdapter) Pending(ctx context.Context) (json.RawMessage, error)

Pending returns list of pending approval requests

func (*SLBAdapter) Request

func (a *SLBAdapter) Request(ctx context.Context, command string, reason string) (json.RawMessage, error)

Request creates a new approval request for a command

func (*SLBAdapter) Status

func (a *SLBAdapter) Status(ctx context.Context) (json.RawMessage, error)

Status returns the current SLB daemon status

func (*SLBAdapter) Version

func (a *SLBAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed slb version

type SwitchResult

type SwitchResult struct {
	Success           bool      `json:"success"`
	Provider          string    `json:"provider"`
	PreviousAccount   string    `json:"previous_account"`
	NewAccount        string    `json:"new_account"`
	CooldownUntil     time.Time `json:"cooldown_until,omitempty"`
	AccountsRemaining int       `json:"accounts_remaining"`
	Error             string    `json:"error,omitempty"`
}

SwitchResult represents the response from caam switch --next --json

type ToolInfo

type ToolInfo struct {
	Name         ToolName     `json:"name"`
	Installed    bool         `json:"installed"`
	Version      Version      `json:"version,omitempty"`
	Capabilities []Capability `json:"capabilities,omitempty"`
	Path         string       `json:"path,omitempty"`
	Health       HealthStatus `json:"health"`
}

ToolInfo contains metadata about a detected tool

func GetAllInfo

func GetAllInfo(ctx context.Context) []*ToolInfo

GetAllInfo returns all tool info from the global registry

func GetInfo

func GetInfo(ctx context.Context, name ToolName) (*ToolInfo, error)

GetInfo returns tool info from the global registry

type ToolName

type ToolName string

ToolName identifies a specific tool in the ecosystem

const (
	ToolBV   ToolName = "bv"   // Beads Viewer - graph-aware triage
	ToolBD   ToolName = "bd"   // Beads - issue tracking
	ToolAM   ToolName = "am"   // Agent Mail MCP server
	ToolCM   ToolName = "cm"   // Cass Memory system
	ToolCASS ToolName = "cass" // Cross-Agent Semantic Search
	ToolS2P  ToolName = "s2p"  // Source to Prompt
	ToolJFP  ToolName = "jfp"  // JeffreysPrompts CLI - prompt library
	ToolDCG  ToolName = "dcg"  // Destructive Command Guard - blocks dangerous commands
	ToolSLB  ToolName = "slb"  // Simultaneous Launch Button - two-person authorization
	ToolACFS ToolName = "acfs" // Agentic Coding Flywheel Setup - system configuration
	ToolRU   ToolName = "ru"   // Repo Updater - multi-repo sync and management
	ToolMS   ToolName = "ms"   // Meta Skill - skill search and suggestion
	ToolXF   ToolName = "xf"   // X Find - X/Twitter archive search
	ToolGIIL ToolName = "giil" // Get Image from Internet Link - cloud photo downloader
	ToolUBS  ToolName = "ubs"  // Ultimate Bug Scanner - code review and bug detection
	ToolCAAM ToolName = "caam" // CAAM - Coding Agent Account Manager for rate limit recovery
	ToolRCH  ToolName = "rch"  // RCH - Remote Compilation Helper for build offloading
	ToolRano ToolName = "rano" // rano - Network observer for per-agent API tracking
	ToolCaut ToolName = "caut" // caut - Cloud API Usage Tracker for quota monitoring
	ToolPT   ToolName = "pt"   // pt - process_triage - Bayesian agent health classification
)

func AllTools

func AllTools() []ToolName

AllTools returns a list of all supported tools

type UBSAdapter

type UBSAdapter struct {
	*BaseAdapter
}

UBSAdapter provides integration with the Ultimate Bug Scanner (ubs) tool. UBS performs code review and bug detection, identifying potential issues before they reach production.

func NewUBSAdapter

func NewUBSAdapter() *UBSAdapter

NewUBSAdapter creates a new UBS adapter

func (*UBSAdapter) Capabilities

func (a *UBSAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns the list of ubs capabilities

func (*UBSAdapter) Detect

func (a *UBSAdapter) Detect() (string, bool)

Detect checks if ubs is installed

func (*UBSAdapter) Doctor

func (a *UBSAdapter) Doctor(ctx context.Context) (string, error)

Doctor runs UBS diagnostics

func (*UBSAdapter) HasCapability

func (a *UBSAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if ubs has a specific capability

func (*UBSAdapter) Health

func (a *UBSAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if ubs is functioning correctly

func (*UBSAdapter) Info

func (a *UBSAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete ubs tool information

func (*UBSAdapter) Scan

func (a *UBSAdapter) Scan(ctx context.Context, path string) (*UBSScanResult, error)

Scan runs UBS on a path and returns findings

func (*UBSAdapter) Version

func (a *UBSAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed ubs version

type UBSFinding

type UBSFinding struct {
	ID         string `json:"id,omitempty"`
	Severity   string `json:"severity,omitempty"` // critical, high, medium, low, info
	Category   string `json:"category,omitempty"` // security, performance, maintainability, etc.
	File       string `json:"file,omitempty"`
	Line       int    `json:"line,omitempty"`
	Message    string `json:"message,omitempty"`
	Suggestion string `json:"suggestion,omitempty"`
	RuleID     string `json:"rule_id,omitempty"`
}

UBSFinding represents a bug or issue found by UBS

type UBSScanResult

type UBSScanResult struct {
	Findings   []UBSFinding `json:"findings,omitempty"`
	TotalCount int          `json:"total_count"`
	Critical   int          `json:"critical"`
	High       int          `json:"high"`
	Medium     int          `json:"medium"`
	Low        int          `json:"low"`
	Info       int          `json:"info"`
	ScanTime   string       `json:"scan_time,omitempty"`
}

UBSScanResult represents the result of a UBS scan

type Version

type Version struct {
	Major int    `json:"major"`
	Minor int    `json:"minor"`
	Patch int    `json:"patch"`
	Raw   string `json:"raw"`
}

Version represents a parsed semantic version

func ParseStandardVersion

func ParseStandardVersion(output string) (Version, error)

ParseStandardVersion extracts version from command output using VersionRegex. It handles standard semantic version formats (X.Y.Z).

func (Version) AtLeast

func (v Version) AtLeast(other Version) bool

AtLeast returns true if v >= other

func (Version) Compare

func (v Version) Compare(other Version) int

Compare compares two versions. Returns -1 if v < other, 0 if equal, 1 if v > other

func (Version) String

func (v Version) String() string

String returns the version string

type XFAdapter

type XFAdapter struct {
	*BaseAdapter
}

XFAdapter provides integration with the XF (X Find) tool. XF is a CLI for indexing and searching X/Twitter data archives, supporting full-text search with BM25 ranking via Tantivy.

func NewXFAdapter

func NewXFAdapter() *XFAdapter

NewXFAdapter creates a new XF adapter

func (*XFAdapter) Capabilities

func (a *XFAdapter) Capabilities(ctx context.Context) ([]Capability, error)

Capabilities returns the list of xf capabilities

func (*XFAdapter) Detect

func (a *XFAdapter) Detect() (string, bool)

Detect checks if xf is installed

func (*XFAdapter) Doctor

func (a *XFAdapter) Doctor(ctx context.Context) (string, error)

Doctor runs xf doctor diagnostics

func (*XFAdapter) GetStats

func (a *XFAdapter) GetStats(ctx context.Context) (*XFStats, error)

GetStats returns archive statistics

func (*XFAdapter) HasCapability

func (a *XFAdapter) HasCapability(ctx context.Context, cap Capability) bool

HasCapability checks if xf has a specific capability

func (*XFAdapter) Health

func (a *XFAdapter) Health(ctx context.Context) (*HealthStatus, error)

Health checks if xf is functioning correctly

func (*XFAdapter) Info

func (a *XFAdapter) Info(ctx context.Context) (*ToolInfo, error)

Info returns complete xf tool information

func (*XFAdapter) Search

func (a *XFAdapter) Search(ctx context.Context, query string, limit int) ([]XFSearchResult, error)

Search performs a full-text search on the indexed archive

func (*XFAdapter) Version

func (a *XFAdapter) Version(ctx context.Context) (Version, error)

Version returns the installed xf version

type XFSearchResult

type XFSearchResult struct {
	ID        string  `json:"id"`
	Content   string  `json:"content"`
	CreatedAt string  `json:"created_at,omitempty"`
	Type      string  `json:"type,omitempty"` // tweet, like, dm, grok
	Score     float64 `json:"score,omitempty"`
}

XFSearchResult represents a search result

type XFStats

type XFStats struct {
	TweetCount   int    `json:"tweet_count,omitempty"`
	LikeCount    int    `json:"like_count,omitempty"`
	DMCount      int    `json:"dm_count,omitempty"`
	GrokCount    int    `json:"grok_count,omitempty"`
	IndexStatus  string `json:"index_status,omitempty"`
	LastIndexed  string `json:"last_indexed,omitempty"`
	DatabasePath string `json:"database_path,omitempty"`
}

XFStats represents archive statistics

Jump to

Keyboard shortcuts

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