Documentation
¶
Overview ¶
Package builtin provides Alchemy blockchain API handler implementation
Package builtin provides blockchain monitoring handler implementation ¶
Package builtin provides IPFS skill implementation using Kubo RPC client.
Package builtin provides crypto utility functions using modern Go crypto libraries ¶
Package builtin provides wallet security monitoring handler implementation
Index ¶
- Variables
- func BuildAlchemyURL(network, apiKey string) string
- func EtherToWei(etherStr string) (*big.Int, error)
- func GetChainID(network string) (int64, error)
- func GweiToWei(gwei int64) *big.Int
- func IsValidEthereumAddress(addr string) bool
- func NormalizeAddress(addr string) (string, error)
- func ParseAddress(addr string) (common.Address, error)
- func RegisterAll(registry *tools.Registry, workspace string, configLoader ConfigLoader)
- func RegisterCryptoTools(registry *tools.Registry, configLoader ConfigLoader)
- func RegisterReadOnlyDevTools(registry *tools.Registry, workspace string)
- func ValidateAlchemyNetwork(network string) error
- func WalletSecurityHandlerFunc(args map[string]any, configLoader ConfigLoader) (any, error)
- func WeiToEther(wei *big.Int) string
- func WeiToGwei(wei *big.Int) int64
- type AlchemyConfig
- type AlchemyTool
- type AlertsLog
- type ApprovalEvent
- type AssetTransfer
- type Base64DecodeTool
- type Base64EncodeTool
- type BaseTool
- func (b *BaseTool) Description() string
- func (b *BaseTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
- func (b *BaseTool) InterruptBehavior() tools.InterruptBehavior
- func (b *BaseTool) IsConcurrencySafe(input map[string]any) bool
- func (b *BaseTool) IsReadOnly() bool
- func (b *BaseTool) Name() string
- func (b *BaseTool) Parameters() json.RawMessage
- func (b *BaseTool) ValidateInput(input map[string]any) error
- type BashTool
- type BlockmonConfig
- type BlockmonTool
- type ConfigLoader
- type CurrencyTool
- type HashTool
- type IPFSConfig
- type IPFSTool
- type ListFilesTool
- type MonitoredWallet
- type Note
- type NoteGetTool
- type NoteListTool
- type NoteSaveTool
- type PasswordTool
- type PatchFileTool
- type QRCodeTool
- type RateLimiter
- type ReadFileTool
- type Reminder
- type ReminderListTool
- type ReminderSetTool
- type SearchTool
- type SecurityAlert
- type TarotConfig
- type TarotTool
- type TimezoneConverterTool
- type TwitchConfig
- type TwitchTool
- type UUIDTool
- type UnitConverterTool
- type UpscaleImageTool
- type VeniceConfig
- type WalletSecurityConfig
- type WalletSecuritySettingsConfig
- type WalletSecurityTool
- type WeatherConfig
- type WeatherTool
- type WriteFileTool
- type YouTubeConfig
- type YouTubeTool
Constants ¶
This section is empty.
Variables ¶
var AlchemyNetworks = map[string]struct { Name string ChainID int64 }{ "eth-mainnet": {"Ethereum Mainnet", 1}, "eth-sepolia": {"Ethereum Sepolia Testnet", 11155111}, "polygon-mainnet": {"Polygon Mainnet", 137}, "polygon-amoy": {"Polygon Amoy Testnet", 80002}, "arbitrum-mainnet": {"Arbitrum One", 42161}, "arbitrum-sepolia": {"Arbitrum Sepolia", 421614}, "optimism-mainnet": {"Optimism Mainnet", 10}, "optimism-sepolia": {"Optimism Sepolia", 11155420}, "base-mainnet": {"Base Mainnet", 8453}, "base-sepolia": {"Base Sepolia", 84532}, }
Supported Alchemy networks with chain IDs
Functions ¶
func BuildAlchemyURL ¶
BuildAlchemyURL constructs the Alchemy API URL
func EtherToWei ¶
EtherToWei converts Ether string to Wei (*big.Int) Uses params.Ether from go-ethereum for accurate conversion
func GetChainID ¶
GetChainID returns the chain ID for a given network
func IsValidEthereumAddress ¶
IsValidEthereumAddress validates an Ethereum address using go-ethereum This uses the official implementation with proper checksum validation
func NormalizeAddress ¶
NormalizeAddress returns a checksummed Ethereum address using EIP-55 This is the proper way to handle Ethereum addresses
func ParseAddress ¶
ParseAddress parses a string into a common.Address (go-ethereum type)
func RegisterAll ¶
func RegisterAll(registry *tools.Registry, workspace string, configLoader ConfigLoader)
RegisterAll registers all built-in tools with the registry.
func RegisterCryptoTools ¶
func RegisterCryptoTools(registry *tools.Registry, configLoader ConfigLoader)
RegisterCryptoTools registers all crypto/blockchain tools.
func RegisterReadOnlyDevTools ¶
RegisterReadOnlyDevTools registers only read-only dev tools (for restricted agent mode).
func ValidateAlchemyNetwork ¶
ValidateAlchemyNetwork checks if a network identifier is valid
func WalletSecurityHandlerFunc ¶
func WalletSecurityHandlerFunc(args map[string]any, configLoader ConfigLoader) (any, error)
WalletSecurityHandlerFunc is the exported entry point for wallet security operations. It is used by the monitor daemon to perform periodic wallet checks.
func WeiToEther ¶
WeiToEther converts Wei (*big.Int) to Ether as a formatted string Uses params.Ether from go-ethereum for accurate conversion
Types ¶
type AlchemyConfig ¶
AlchemyConfig holds Alchemy API configuration.
type AlchemyTool ¶
type AlchemyTool struct {
BaseTool
// contains filtered or unexported fields
}
AlchemyTool provides blockchain data and analytics via Alchemy API.
func NewAlchemyTool ¶
func NewAlchemyTool(configLoader ConfigLoader) *AlchemyTool
NewAlchemyTool creates an AlchemyTool.
func (*AlchemyTool) Execute ¶
func (t *AlchemyTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type AlertsLog ¶
type AlertsLog struct {
Alerts []SecurityAlert `json:"alerts"`
}
AlertsLog stores all security alerts
type ApprovalEvent ¶
type ApprovalEvent struct {
Owner string // Wallet that granted approval
Spender string // Contract/address that can spend
Value *big.Int // Approved amount
TokenContract string // ERC20 contract address
TxHash string
BlockNumber string
IsUnlimited bool // True if value == max uint256
}
ApprovalEvent represents an ERC20 token approval
type AssetTransfer ¶
type AssetTransfer struct {
Category string
BlockNum string
From string
To string
Value float64
Asset string
Hash string
RawContract struct{ Address string }
TokenId string
ERC721TokenId string
ERC1155Metadata []struct {
TokenId string
Value string
}
}
AssetTransfer represents a blockchain asset transfer
type Base64DecodeTool ¶
type Base64DecodeTool struct {
BaseTool
}
Base64DecodeTool decodes a base64 string.
func NewBase64DecodeTool ¶
func NewBase64DecodeTool() *Base64DecodeTool
NewBase64DecodeTool creates a Base64DecodeTool.
func (*Base64DecodeTool) Execute ¶
func (t *Base64DecodeTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type Base64EncodeTool ¶
type Base64EncodeTool struct {
BaseTool
}
Base64EncodeTool encodes text to base64.
func NewBase64EncodeTool ¶
func NewBase64EncodeTool() *Base64EncodeTool
NewBase64EncodeTool creates a Base64EncodeTool.
func (*Base64EncodeTool) Execute ¶
func (t *Base64EncodeTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type BaseTool ¶
type BaseTool struct {
ToolName string
ToolDescription string
ToolParameters json.RawMessage
ReadOnly bool
ConcurrencySafe bool
Interrupt tools.InterruptBehavior
RequiredFields []string
}
BaseTool provides a reusable base implementation of the tools.Tool interface. Concrete tools can embed BaseTool and override Execute.
func (*BaseTool) Description ¶
func (*BaseTool) Execute ¶
func (b *BaseTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
Execute is a default implementation that returns an error. Concrete tools should override this method.
func (*BaseTool) InterruptBehavior ¶
func (b *BaseTool) InterruptBehavior() tools.InterruptBehavior
func (*BaseTool) IsConcurrencySafe ¶
func (*BaseTool) IsReadOnly ¶
func (*BaseTool) Parameters ¶
func (b *BaseTool) Parameters() json.RawMessage
type BashTool ¶
type BashTool struct {
BaseTool
// contains filtered or unexported fields
}
BashTool executes shell commands in the workspace directory.
func NewBashTool ¶
NewBashTool creates a BashTool bound to the given workspace directory.
type BlockmonConfig ¶
type BlockmonConfig struct {
AlchemyAPIKey string
WebhookURL string
DefaultNetwork string
PollIntervalSeconds int
}
BlockmonConfig holds blockchain monitoring configuration.
type BlockmonTool ¶
type BlockmonTool struct {
BaseTool
// contains filtered or unexported fields
}
BlockmonTool provides real-time blockchain monitoring.
func NewBlockmonTool ¶
func NewBlockmonTool(configLoader ConfigLoader) *BlockmonTool
NewBlockmonTool creates a BlockmonTool.
func (*BlockmonTool) Execute ¶
func (t *BlockmonTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type ConfigLoader ¶
type ConfigLoader interface {
GetTarotConfig() (TarotConfig, error)
GetVeniceConfig() (VeniceConfig, error)
GetWeatherConfig() (WeatherConfig, error)
GetTwitchConfig() (TwitchConfig, error)
GetYouTubeConfig() (YouTubeConfig, error)
GetIPFSConfig() (IPFSConfig, error)
GetAlchemyConfig() (AlchemyConfig, error)
GetBlockmonConfig() (BlockmonConfig, error)
GetWalletSecurityConfig() (WalletSecuritySettingsConfig, error)
}
ConfigLoader provides access to configuration values. This interface mirrors skills.ConfigLoader exactly so that config.NewConfigLoader(cfg) satisfies both.
type CurrencyTool ¶
type CurrencyTool struct {
BaseTool
}
CurrencyTool converts between currencies.
func (*CurrencyTool) Execute ¶
func (t *CurrencyTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type IPFSConfig ¶
type IPFSConfig struct {
Provider string
APIKey string
APISecret string
ProjectID string
GatewayURL string
TimeoutSeconds int
}
IPFSConfig holds IPFS configuration.
type IPFSTool ¶
type IPFSTool struct {
BaseTool
// contains filtered or unexported fields
}
IPFSTool provides IPFS decentralized storage operations.
func NewIPFSTool ¶
func NewIPFSTool(configLoader ConfigLoader) *IPFSTool
NewIPFSTool creates an IPFSTool.
type ListFilesTool ¶
type ListFilesTool struct {
BaseTool
// contains filtered or unexported fields
}
ListFilesTool lists files and directories inside the workspace.
func NewListFilesTool ¶
func NewListFilesTool(workspace string) *ListFilesTool
NewListFilesTool creates a ListFilesTool bound to the given workspace directory.
func (*ListFilesTool) Execute ¶
func (t *ListFilesTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type MonitoredWallet ¶
type MonitoredWallet struct {
Address string `json:"address"` // EIP-55 checksummed
Label string `json:"label"`
Network string `json:"network"`
AddedAt time.Time `json:"added_at"`
}
MonitoredWallet represents a wallet being monitored
type Note ¶
type Note struct {
Title string `json:"title"`
Content string `json:"content"`
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
}
Note represents a note entry.
type NoteGetTool ¶
type NoteGetTool struct {
BaseTool
}
NoteGetTool retrieves a note by title.
func (*NoteGetTool) Execute ¶
func (t *NoteGetTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type NoteListTool ¶
type NoteListTool struct {
BaseTool
}
NoteListTool lists all saved notes.
func (*NoteListTool) Execute ¶
func (t *NoteListTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type NoteSaveTool ¶
type NoteSaveTool struct {
BaseTool
}
NoteSaveTool saves a note.
func (*NoteSaveTool) Execute ¶
func (t *NoteSaveTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type PasswordTool ¶
type PasswordTool struct {
BaseTool
}
PasswordTool generates secure random passwords.
func (*PasswordTool) Execute ¶
func (t *PasswordTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type PatchFileTool ¶
type PatchFileTool struct {
BaseTool
// contains filtered or unexported fields
}
PatchFileTool performs surgical string replacements in workspace files.
func NewPatchFileTool ¶
func NewPatchFileTool(workspace string) *PatchFileTool
NewPatchFileTool creates a PatchFileTool bound to the given workspace directory.
func (*PatchFileTool) Execute ¶
func (t *PatchFileTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type QRCodeTool ¶
type QRCodeTool struct {
BaseTool
}
QRCodeTool generates QR codes from text.
func (*QRCodeTool) Execute ¶
func (t *QRCodeTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter wraps golang.org/x/time/rate.Limiter Provides production-ready token bucket rate limiting
func NewRateLimiter ¶
func NewRateLimiter(requestsPerSecond int) *RateLimiter
NewRateLimiter creates a rate limiter with specified requests per second Uses the official golang.org/x/time/rate package
func (*RateLimiter) Allow ¶
func (rl *RateLimiter) Allow() bool
Allow checks if a request is allowed without blocking
func (*RateLimiter) SetRate ¶
func (rl *RateLimiter) SetRate(requestsPerSecond int)
SetRate updates the rate limit dynamically
type ReadFileTool ¶
type ReadFileTool struct {
BaseTool
// contains filtered or unexported fields
}
ReadFileTool reads text files from the workspace.
func NewReadFileTool ¶
func NewReadFileTool(workspace string) *ReadFileTool
NewReadFileTool creates a ReadFileTool bound to the given workspace directory.
func (*ReadFileTool) Execute ¶
func (t *ReadFileTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type Reminder ¶
type Reminder struct {
ID string `json:"id"`
Message string `json:"message"`
Time time.Time `json:"time"`
Created time.Time `json:"created"`
}
Reminder represents a reminder entry.
type ReminderListTool ¶
type ReminderListTool struct {
BaseTool
}
ReminderListTool lists all active reminders.
func NewReminderListTool ¶
func NewReminderListTool() *ReminderListTool
NewReminderListTool creates a ReminderListTool.
func (*ReminderListTool) Execute ¶
func (t *ReminderListTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type ReminderSetTool ¶
type ReminderSetTool struct {
BaseTool
}
ReminderSetTool sets a reminder.
func NewReminderSetTool ¶
func NewReminderSetTool() *ReminderSetTool
NewReminderSetTool creates a ReminderSetTool.
func (*ReminderSetTool) Execute ¶
func (t *ReminderSetTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type SearchTool ¶
type SearchTool struct {
BaseTool
// contains filtered or unexported fields
}
SearchTool searches for text patterns in workspace files.
func NewSearchTool ¶
func NewSearchTool(workspace string) *SearchTool
NewSearchTool creates a SearchTool bound to the given workspace directory.
func (*SearchTool) Execute ¶
func (t *SearchTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type SecurityAlert ¶
type SecurityAlert struct {
ID string `json:"id"` // alert_<timestamp>_<random>
WalletAddress string `json:"wallet_address"` // Affected wallet
AlertType string `json:"alert_type"` // dust_attack, nft_scam, dangerous_approval, large_transfer
Severity string `json:"severity"` // low, medium, high, critical
TxHash string `json:"tx_hash"` // Transaction hash
BlockNumber string `json:"block_number"`
Description string `json:"description"` // Human-readable description
Details map[string]any `json:"details"` // Type-specific details
DetectedAt time.Time `json:"detected_at"`
Acknowledged bool `json:"acknowledged"`
AcknowledgedAt *time.Time `json:"acknowledged_at,omitempty"`
}
SecurityAlert represents a detected security threat
type TarotConfig ¶
TarotConfig holds tarot function configuration.
type TarotTool ¶
type TarotTool struct {
BaseTool
// contains filtered or unexported fields
}
TarotTool generates tarot card readings.
func NewTarotTool ¶
func NewTarotTool(configLoader ConfigLoader) *TarotTool
NewTarotTool creates a TarotTool.
type TimezoneConverterTool ¶
type TimezoneConverterTool struct {
BaseTool
}
TimezoneConverterTool converts time between timezones.
func NewTimezoneConverterTool ¶
func NewTimezoneConverterTool() *TimezoneConverterTool
NewTimezoneConverterTool creates a TimezoneConverterTool.
func (*TimezoneConverterTool) Execute ¶
func (tool *TimezoneConverterTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type TwitchConfig ¶
TwitchConfig holds Twitch API configuration.
type TwitchTool ¶
type TwitchTool struct {
BaseTool
// contains filtered or unexported fields
}
TwitchTool checks if a Twitch streamer is live.
func NewTwitchTool ¶
func NewTwitchTool(configLoader ConfigLoader) *TwitchTool
NewTwitchTool creates a TwitchTool.
func (*TwitchTool) Execute ¶
func (t *TwitchTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type UnitConverterTool ¶
type UnitConverterTool struct {
BaseTool
}
UnitConverterTool converts between units of measurement.
func NewUnitConverterTool ¶
func NewUnitConverterTool() *UnitConverterTool
NewUnitConverterTool creates a UnitConverterTool.
func (*UnitConverterTool) Execute ¶
func (t *UnitConverterTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type UpscaleImageTool ¶
type UpscaleImageTool struct {
BaseTool
// contains filtered or unexported fields
}
UpscaleImageTool upscales images using Venice.ai.
func NewUpscaleImageTool ¶
func NewUpscaleImageTool(configLoader ConfigLoader) *UpscaleImageTool
NewUpscaleImageTool creates an UpscaleImageTool.
func (*UpscaleImageTool) Execute ¶
func (t *UpscaleImageTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type VeniceConfig ¶
type VeniceConfig struct {
APIKey string
BaseURL string
Model string // Chat model (venice-uncensored)
ImageModel string // Image generation model (lustify-sdxl, animewan, hidream, wai-Illustrious)
Upscaler string
}
VeniceConfig holds Venice.ai configuration.
type WalletSecurityConfig ¶
type WalletSecurityConfig struct {
MonitoredWallets []MonitoredWallet `json:"monitored_wallets"`
LastCheckedBlock string `json:"last_checked_block"`
PollIntervalSeconds int `json:"poll_interval_seconds"`
}
WalletSecurityConfig holds wallet security configuration
type WalletSecuritySettingsConfig ¶
type WalletSecuritySettingsConfig struct {
Enabled bool
PollInterval int // seconds
AlertLevel string // minimum severity to alert on
}
WalletSecuritySettingsConfig holds wallet security settings.
type WalletSecurityTool ¶
type WalletSecurityTool struct {
BaseTool
// contains filtered or unexported fields
}
WalletSecurityTool monitors wallet addresses for security threats.
func NewWalletSecurityTool ¶
func NewWalletSecurityTool(configLoader ConfigLoader) *WalletSecurityTool
NewWalletSecurityTool creates a WalletSecurityTool.
func (*WalletSecurityTool) Execute ¶
func (t *WalletSecurityTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type WeatherConfig ¶
type WeatherConfig struct {
DefaultZipCode string
}
WeatherConfig holds weather skill configuration.
type WeatherTool ¶
type WeatherTool struct {
BaseTool
// contains filtered or unexported fields
}
WeatherTool gets weather forecast for a location.
func NewWeatherTool ¶
func NewWeatherTool(configLoader ConfigLoader) *WeatherTool
NewWeatherTool creates a WeatherTool.
func (*WeatherTool) Execute ¶
func (t *WeatherTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type WriteFileTool ¶
type WriteFileTool struct {
BaseTool
// contains filtered or unexported fields
}
WriteFileTool writes text files to the workspace.
func NewWriteFileTool ¶
func NewWriteFileTool(workspace string) *WriteFileTool
NewWriteFileTool creates a WriteFileTool bound to the given workspace directory.
func (*WriteFileTool) Execute ¶
func (t *WriteFileTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
type YouTubeConfig ¶
YouTubeConfig holds YouTube API configuration.
type YouTubeTool ¶
type YouTubeTool struct {
BaseTool
// contains filtered or unexported fields
}
YouTubeTool gets recent videos from a YouTube channel.
func NewYouTubeTool ¶
func NewYouTubeTool(configLoader ConfigLoader) *YouTubeTool
NewYouTubeTool creates a YouTubeTool.
func (*YouTubeTool) Execute ¶
func (t *YouTubeTool) Execute(ctx context.Context, input map[string]any, progress chan<- tools.ProgressEvent) (tools.ToolResult, error)
Source Files
¶
- base.go
- bash.go
- config.go
- crypto.go
- crypto_alchemy.go
- crypto_blockmon.go
- crypto_ipfs.go
- crypto_utils.go
- crypto_wallet_security.go
- currency.go
- encoding.go
- hash.go
- helpers.go
- list_files.go
- media.go
- notes.go
- password.go
- patch_file.go
- qrcode.go
- read_file.go
- register.go
- reminder.go
- search.go
- skill_helpers.go
- tarot.go
- timezone.go
- twitch.go
- units.go
- uuid.go
- weather.go
- write_file.go
- youtube.go