Documentation
¶
Index ¶
- Constants
- Variables
- func BuildDiscordComponents(result *ClarifyResult) string
- func BuildTelegramKeyboard(result *ClarifyResult) string
- func CloseKanbanManager() error
- func ContainsString(slice []string, item string) bool
- func EnsureString(v interface{}) string
- func ExportBrowserToolsJSON() string
- func ExportTerminalBackendsJSON() string
- func FormatReport(report *FileChangeReport) string
- func GetAllToolsets() map[string]*ToolsetDefinition
- func GetTemplate(name string) (string, bool)
- func GetToolsetNames() []string
- func InitKanbanManager(homeDir string) error
- func InitializeDefaultToolsets()
- func IntPtr(i int) *int
- func LintFile(filePath string) ([]string, error)
- func ListTemplates() []string
- func ParseTaskStatus(s string) kanban.TaskStatus
- func RegisterKanbanTools(registry *Registry)
- func RegisterMCPServerToolset(serverName string, toolNames []string)
- func RegisterSubAgentTools(registry *Registry, manager *subagent.Manager)
- func RegisterToolset(ts *ToolsetDefinition)
- func ResolveToolset(name string, visited map[string]bool) []string
- func SerializeForGateway(result *ClarifyResult) ([]byte, error)
- func StringPtr(s string) *string
- func UnregisterMCPServerToolset(serverName string)
- func ValidateCode(code string) (bool, string)
- func ValidateCodeForLanguage(code, language string) (bool, string)
- func ValidateEmail(email string) bool
- func ValidateParams(schema map[string]interface{}, params map[string]interface{}) error
- type ASRAvailableProvidersTool
- type ASRTool
- type AliyunProvider
- type AliyunSMSConfig
- type AnalyzeErrorTool
- type AsyncJob
- type AsyncTool
- type AsyncToolExecutor
- type AudioDownloadTool
- type AudioPlayTool
- type BackendManager
- func (m *BackendManager) Execute(ctx context.Context, backendName string, cmd string, workDir string, ...) (*ExecutionResult, error)
- func (m *BackendManager) Get(name string) TerminalBackend
- func (m *BackendManager) GetDefault() TerminalBackend
- func (m *BackendManager) List() []string
- func (m *BackendManager) Register(backend TerminalBackend)
- func (m *BackendManager) SetDefault(name string)
- type BaseTool
- type BatchFileOpsTool
- type BrowserBackTool
- type BrowserClickTool
- type BrowserConsoleTool
- type BrowserGetImagesTool
- type BrowserNavigateTool
- type BrowserScrollTool
- type BrowserSnapshotTool
- type BrowserTools
- type BrowserTypeTool
- type CSVTool
- type CacheKeyBuilder
- type CacheStats
- type CachedToolExecutor
- type CancelTaskTool
- type ClarifyResult
- type ClarifyTool
- type CodeExecutionRequest
- type CodeExecutionResponse
- type CodeExecutorConfig
- type CodeToolCall
- type ComplexityResult
- type ComputerUseAction
- type ComputerUseResult
- type ComputerUseTool
- type CronJobTool
- type DaytonaBackend
- func (b *DaytonaBackend) Configure(workspace, image, language, serverURL, apiKey string)
- func (b *DaytonaBackend) Description() string
- func (b *DaytonaBackend) Execute(ctx context.Context, cmd string, workDir string, timeout time.Duration) (*ExecutionResult, error)
- func (b *DaytonaBackend) Health() error
- func (b *DaytonaBackend) IsAvailable() bool
- func (b *DaytonaBackend) Name() string
- func (b *DaytonaBackend) SetAutoWake(autoWake bool)
- func (b *DaytonaBackend) SetPersist(persist bool)
- type DefaultMetricsRecorder
- type DefaultToolExecutor
- type DelegateTaskTool
- type Dependency
- type DependencyResult
- type DiffPatchTool
- type DirectoryTreeTool
- type DockerBackend
- func (b *DockerBackend) Description() string
- func (b *DockerBackend) Execute(ctx context.Context, cmd string, workDir string, timeout time.Duration) (*ExecutionResult, error)
- func (b *DockerBackend) Health() error
- func (b *DockerBackend) IsAvailable() bool
- func (b *DockerBackend) Name() string
- func (b *DockerBackend) SetCpuLimit(limit string)
- func (b *DockerBackend) SetImage(image string)
- func (b *DockerBackend) SetMemoryLimit(limit string)
- type DocumentationGenerator
- func (dg *DocumentationGenerator) GenerateIndex(tools []Tool) map[string]interface{}
- func (dg *DocumentationGenerator) GenerateMarkdown(tools []Tool) string
- func (dg *DocumentationGenerator) GenerateOpenAPISpec(tools []Tool) []byte
- func (dg *DocumentationGenerator) GenerateToolHelp(toolName string, tools []Tool) string
- type DynamicTool
- type EmailAttachment
- type EmailConfig
- type EmailMessage
- type EmailTool
- type EntryPoint
- type EntryPointResult
- type EnvTool
- type ErrorAnalysis
- type ErrorLocation
- type ExecuteCodeTool
- func (t *ExecuteCodeTool) Description() string
- func (t *ExecuteCodeTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (t *ExecuteCodeTool) ExecuteWithTools(ctx context.Context, req *CodeExecutionRequest, toolRegistry map[string]Tool) (*CodeExecutionResponse, error)
- func (t *ExecuteCodeTool) Name() string
- func (t *ExecuteCodeTool) RegisterTool(name string, tool Tool)
- func (t *ExecuteCodeTool) Schema() map[string]interface{}
- func (t *ExecuteCodeTool) SetCodingMode(enabled bool)
- type ExecuteCommandTool
- func (t *ExecuteCommandTool) AddToWhitelist(cmd string)
- func (t *ExecuteCommandTool) Description() string
- func (t *ExecuteCommandTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (t *ExecuteCommandTool) Name() string
- func (t *ExecuteCommandTool) Parameters() map[string]interface{}
- func (t *ExecuteCommandTool) Schema() map[string]interface{}
- func (t *ExecuteCommandTool) SetAllowAny(allow bool)
- func (t *ExecuteCommandTool) SetCodingMode(enabled bool)
- func (t *ExecuteCommandTool) SetCodingModeAdvanced(enabled bool)
- type ExecutionResult
- type ExecutionStep
- type ExecutionTrace
- type FileChange
- type FileChangeReport
- type FileChangeVerifier
- type FileEditTool
- type FileInfo
- type FileSearchTool
- type FixSuggestion
- type FormatTool
- type GatewaySender
- type GitignoreTool
- func (t *GitignoreTool) CombineTemplates(templates []string, outputPath string, customRules []string) error
- func (t *GitignoreTool) Description() string
- func (t *GitignoreTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (t *GitignoreTool) GenerateGitignoreForProject(projectType, outputPath string) error
- func (t *GitignoreTool) Name() string
- func (t *GitignoreTool) Schema() map[string]interface{}
- type GroupManager
- func (gm *GroupManager) AddToolToGroup(tool Tool, groupName string) error
- func (gm *GroupManager) CreateGroup(name, description string) *ToolGroup
- func (gm *GroupManager) DeleteGroup(name string)
- func (gm *GroupManager) DisableGroup(name string)
- func (gm *GroupManager) EnableGroup(name string)
- func (gm *GroupManager) GetEnabledTools() []Tool
- func (gm *GroupManager) GetGroup(name string) *ToolGroup
- func (gm *GroupManager) GetToolGroup(toolName string) string
- func (gm *GroupManager) ListGroups() []*ToolGroup
- func (gm *GroupManager) RegisterGroup(group *ToolGroup)
- func (gm *GroupManager) RemoveToolFromGroup(toolName, groupName string) error
- type HACallServiceTool
- type HAConfig
- type HAConfigTool
- type HAEventsTool
- type HAGetStateTool
- type HAListServicesTool
- type HATool
- type HashTool
- type HelpGenerator
- type ImageEditTool
- type ImageGenConfig
- type ImageGenerationResult
- type ImageGenerationTool
- func (t *ImageGenerationTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
- func (t *ImageGenerationTool) GetConfig() *ImageGenConfig
- func (t *ImageGenerationTool) SetConfig(config *ImageGenConfig)
- func (t *ImageGenerationTool) ValidateParams(params map[string]interface{}) error
- type ImageInfo
- type ImageProvider
- type InMemoryToolCache
- type InterruptRequest
- type InterruptResult
- type InterruptStatus
- type InterruptTool
- func (t *InterruptTool) CheckAndClear() bool
- func (t *InterruptTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
- func (t *InterruptTool) GetInterruptChannel() <-chan struct{}
- func (t *InterruptTool) GetStatus() *InterruptStatus
- func (t *InterruptTool) IsInterrupted() bool
- func (t *InterruptTool) OnInterrupt(callback func(reason string))
- func (t *InterruptTool) Reset()
- func (t *InterruptTool) WaitForInterrupt(timeout time.Duration) bool
- type JSONTool
- type Job
- type JobStatus
- type KanbanBlockTool
- type KanbanCommentTool
- type KanbanCompleteTool
- type KanbanCreateTool
- type KanbanHeartbeatTool
- type KanbanLinkTool
- type KanbanShowTool
- type LSPDiagnostic
- type LSPDiagnosticResult
- type LSPDiagnosticTool
- type Language
- type LanguageStats
- type LintIssue
- type LintLevel
- type LintOptions
- type LintResult
- type LintTool
- type ListFilesTool
- type ListTasksTool
- type LocalBackend
- func (b *LocalBackend) Description() string
- func (b *LocalBackend) Execute(ctx context.Context, cmd string, workDir string, timeout time.Duration) (*ExecutionResult, error)
- func (b *LocalBackend) Health() error
- func (b *LocalBackend) IsAvailable() bool
- func (b *LocalBackend) Name() string
- func (b *LocalBackend) SetAllowAny(allow bool)
- type Logger
- type LongRunningTool
- type Match
- type MathTool
- type MemoryRecallTool
- type MemoryStoreTool
- type MetricsRecorder
- type Middleware
- func CacheMiddleware(cache ToolCache, ttl time.Duration) Middleware
- func ChainMiddlewares(middlewares ...Middleware) Middleware
- func LoggingMiddleware(logger Logger) Middleware
- func MetricsMiddleware(recorder MetricsRecorder) Middleware
- func PanicRecoveryMiddleware() Middleware
- func RateLimitMiddleware(rate float64, burst int) Middleware
- func RetryMiddleware(opts ...RetryOptions) Middleware
- func TimeoutMiddleware(defaultTimeout time.Duration) Middleware
- func ValidationMiddleware() Middleware
- type ModalBackend
- func (b *ModalBackend) Configure(appName, volumePath, gpu string, memory int, cpu float64)
- func (b *ModalBackend) Description() string
- func (b *ModalBackend) Execute(ctx context.Context, cmd string, workDir string, timeout time.Duration) (*ExecutionResult, error)
- func (b *ModalBackend) Health() error
- func (b *ModalBackend) IsAvailable() bool
- func (b *ModalBackend) Name() string
- func (b *ModalBackend) SetGPU(gpu string)
- func (b *ModalBackend) SetMemory(memory int)
- type MultipartWriter
- type ParamValidator
- type PluginTool
- type PluginToolLoader
- type PollTaskTool
- type ProcessInfo
- type ProcessTool
- type ProjectAnalyzeTool
- type ProjectSummary
- type ProjectType
- type RandomTool
- type RateLimiter
- type ReadFileTool
- type Registry
- func (r *Registry) CleanupDynamic()
- func (r *Registry) Count() int
- func (r *Registry) Execute(ctx context.Context, name string, args map[string]interface{}) (interface{}, error)
- func (r *Registry) ExecuteSafe(ctx context.Context, name string, args map[string]interface{}) ToolExecutionResult
- func (r *Registry) ExecuteWithTimeout(ctx context.Context, name string, args map[string]interface{}, ...) (interface{}, error)
- func (r *Registry) FilterToolsByKeyword(keyword string) []Tool
- func (r *Registry) FilterToolsByPrefix(prefix string) []Tool
- func (r *Registry) Get(name string) (Tool, error)
- func (r *Registry) GetTimeout(name string) time.Duration
- func (r *Registry) GetToolInfo(name string) (*ToolInfo, error)
- func (r *Registry) HasTool(name string) bool
- func (r *Registry) List() []string
- func (r *Registry) ListWithSchemas() []map[string]interface{}
- func (r *Registry) Register(t Tool)
- func (r *Registry) RegisterAll(workDir string)
- func (r *Registry) RegisterDynamic(tool Tool, ttl time.Duration)
- func (r *Registry) RegisterEmailTool(config *EmailConfig)
- func (r *Registry) RegisterImageGenTool(config *ImageGenConfig)
- func (r *Registry) RegisterOptionalTools()
- func (r *Registry) RegisterOptionalToolsWithConfig(imageGenConfig *ImageGenConfig)
- func (r *Registry) RegisterSMSTool(config *SMSConfig)
- func (r *Registry) RegisterSkillTool(provider SkillInfoProvider)
- func (r *Registry) RegisterWithNotificationConfig(workDir string, emailConfig *EmailConfig, smsConfig *SMSConfig)
- func (r *Registry) RegisterWithSkillManager(skillManager SkillInfoProvider, workDir string)
- func (r *Registry) SetLogger(logger Logger)
- func (r *Registry) SetTimeout(name string, timeout time.Duration)
- func (r *Registry) Unregister(name string)
- type RegistryWithConfig
- type RetryOptions
- type SMSConfig
- type SMSMessage
- type SMSProvider
- type SMSTool
- type SSHBackend
- func (b *SSHBackend) Configure(host, user, keyPath, password string, port int)
- func (b *SSHBackend) Description() string
- func (b *SSHBackend) Execute(ctx context.Context, cmd string, workDir string, timeout time.Duration) (*ExecutionResult, error)
- func (b *SSHBackend) Health() error
- func (b *SSHBackend) IsAvailable() bool
- func (b *SSHBackend) Name() string
- type SearchInFilesTool
- type SearchResult
- type SendMessageRequest
- type SendMessageResult
- type SendMessageTool
- type SessionSearchTool
- func (t *SessionSearchTool) Description() string
- func (t *SessionSearchTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (t *SessionSearchTool) Name() string
- func (t *SessionSearchTool) Parameters() map[string]interface{}
- func (t *SessionSearchTool) Schema() map[string]interface{}
- type SingularityBackend
- func (b *SingularityBackend) Configure(imagePath string, bindPaths []string, overlayPath string)
- func (b *SingularityBackend) Description() string
- func (b *SingularityBackend) Execute(ctx context.Context, cmd string, workDir string, timeout time.Duration) (*ExecutionResult, error)
- func (b *SingularityBackend) Health() error
- func (b *SingularityBackend) IsAvailable() bool
- func (b *SingularityBackend) Name() string
- func (b *SingularityBackend) SetContain(contain bool)
- type SkillData
- type SkillInfoProvider
- type SkillInvokeTool
- type SkillListTool
- type SkillManageTool
- type SkillViewTool
- type SkillsManager
- type StackFrame
- type StringTool
- type StructureResult
- type SuggestFixTool
- type SystemInfoTool
- type TTLCache
- type TTSAvailableVoicesTool
- type TTSTool
- type TencentProvider
- type TencentSMSConfig
- type TerminalBackend
- type TerminalTool
- type TimeTool
- type TodoItem
- type TodoTool
- type Tool
- type ToolCache
- type ToolContext
- func (tc *ToolContext) Elapsed() time.Duration
- func (tc *ToolContext) GetMetadata(key string) (any, bool)
- func (tc *ToolContext) SetMetadata(key string, value any)
- func (tc *ToolContext) ToContext() context.Context
- func (tc *ToolContext) WithLogger(logger Logger) *ToolContext
- func (tc *ToolContext) WithMetrics(metrics MetricsRecorder) *ToolContext
- func (tc *ToolContext) WithRequest(requestID string) *ToolContext
- func (tc *ToolContext) WithSession(sessionID string) *ToolContext
- func (tc *ToolContext) WithTool(toolName string) *ToolContext
- func (tc *ToolContext) WithUser(userID string) *ToolContext
- type ToolExecutionResult
- type ToolExecutor
- type ToolFunc
- type ToolGroup
- type ToolInfo
- type ToolResult
- type ToolSchema
- type ToolsetDefinition
- type TraceExecutionTool
- type TreeNode
- type TwilioConfig
- type TwilioProvider
- type UUIDTool
- type VideoAnalyzeTool
- type VideoGenConfig
- type VideoGenRequest
- type VideoGenResult
- type VideoGenerateTool
- type WebExtractTool
- type WebFetchTool
- type WebSearchResult
- type WebSearchTool
- func (t *WebSearchTool) Description() string
- func (t *WebSearchTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
- func (t *WebSearchTool) Name() string
- func (t *WebSearchTool) Parameters() map[string]interface{}
- func (t *WebSearchTool) Schema() map[string]interface{}
- type WebSelectTool
- type WriteFileTool
- type XSearchRequest
- type XSearchResponse
- type XSearchResult
- type XSearchTool
- type YAMLTool
Constants ¶
const ( // GitHubGitignoreRepo is the URL to the github/gitignore repository GitHubGitignoreRepo = "https://raw.githubusercontent.com/github/gitignore/main" // GitignoreCacheDir is the directory for caching gitignore templates GitignoreCacheDir = ".magic/cache/gitignore" )
const DefaultTimeout = 60 * time.Second
DefaultTimeout 默认工具执行超时时间
const MaxTimeout = 300 * time.Second
MaxTimeout 最大超时时间
Variables ¶
var ( ErrToolNotFound = errors.New("tool not found") ErrInvalidParameters = errors.New("invalid parameters") ErrToolExecutionFailed = errors.New("tool execution failed") ErrToolTimeout = errors.New("tool execution timeout") )
Common tool errors
var CodeTemplates = map[string]string{
"file_processor": `
import os
import json
def process_files(directory, pattern="*.txt"):
"""Process all files matching pattern in directory."""
import glob
results = []
for filepath in glob.glob(os.path.join(directory, pattern)):
with open(filepath, 'r') as f:
results.append({
'path': filepath,
'content': f.read(),
'size': os.path.getsize(filepath)
})
return results
# Example usage
results = process_files('/tmp', '*.txt')
print(f"Processed {len(results)} files")
json_dump(results)
`,
"web_scraper": `
import json
import re
def scrape_links(html, base_url=''):
"""Extract links from HTML."""
pattern = r'href=["\']([^"\']+)["\']'
links = re.findall(pattern, html)
return [{'url': link, 'absolute': link if link.startswith('http') else base_url + link} for link in links]
# Example usage
html = tool('web_fetch', url='https://example.com')
if isinstance(html, dict):
html = html.get('content', '')
links = scrape_links(str(html), 'https://example.com')
print(f"Found {len(links)} links")
json_dump(links[:10])
`,
"data_analysis": `
import json
from collections import Counter
def analyze_data(items, key):
"""Analyze items by key."""
counter = Counter()
for item in items:
if isinstance(item, dict) and key in item:
counter[item[key]] += 1
return {
'total': len(items),
'distribution': dict(counter),
'most_common': counter.most_common(5)
}
# Example: Analyze a list
data = [{'category': 'A', 'value': 1}, {'category': 'B', 'value': 2}]
results = analyze_data(data, 'category')
json_dump(results)
`,
"file_processor_node": `
const fs = require('fs');
const path = require('path');
async function processFiles(directory, pattern = "*.txt") {
const results = [];
const files = fs.readdirSync(directory);
for (const file of files) {
if (file.endsWith('.txt')) {
const filePath = path.join(directory, file);
const content = fs.readFileSync(filePath, 'utf8');
results.push({
path: filePath,
content: content,
size: fs.statSync(filePath).size
});
}
}
return results;
}
// Example usage
const results = processFiles('/tmp');
console.log("Processed " + results.length + " files");
json_dump(results);
`,
"web_scraper_node": `
const https = require('https');
const http = require('http');
function extractLinks(html, baseUrl) {
baseUrl = baseUrl || '';
const linkRegex = /href=["']([^"']+)["']/g;
const links = [];
let match;
while ((match = linkRegex.exec(html)) !== null) {
links.push({
url: match[1],
absolute: match[1].startsWith('http') ? match[1] : baseUrl + match[1]
});
}
return links;
}
// Example usage
// const html = await web_fetch('https://example.com');
// const links = extractLinks(html, 'https://example.com');
// console.log("Found " + links.length + " links");
// json_dump(links.slice(0, 10));
`,
"data_analysis_node": `
function analyzeData(items, key) {
const distribution = {};
items.forEach(item => {
if (item && typeof item === 'object' && key in item) {
const val = item[key];
distribution[val] = (distribution[val] || 0) + 1;
}
});
const entries = Object.entries(distribution);
entries.sort((a, b) => b[1] - a[1]);
const sorted = entries.slice(0, 5);
return {
total: items.length,
distribution: distribution,
most_common: sorted
};
}
// Example: Analyze a list
const data = [{category: 'A', value: 1}, {category: 'B', value: 2}];
const results = analyzeData(data, 'category');
json_dump(results);
`,
"hello_go": `
package main
import "fmt"
func main() {
fmt.Println("Hello from Go!")
}
`,
"hello_rust": `
fn main() {
println!("Hello from Rust!");
}
`,
"hello_java": `
public class Main {
public static void main(String[] args) {
System.out.println("Hello from Java!");
}
}
`,
"hello_cpp": `
#include <iostream>
int main() {
std::cout << "Hello from C++!" << std::endl;
return 0;
}
`,
}
CodeTemplates provides pre-built code templates
var DefaultRetryOptions = RetryOptions{ MaxAttempts: 3, InitialWait: 100 * time.Millisecond, MaxWait: 5 * time.Second, Multiplier: 2.0, ShouldRetry: func(err error, attempt int) bool { if err == nil { return false } return attempt < 3 }, }
var KanbanManager *kanban.Manager
KanbanManager is the global kanban manager instance
var ToolsetRegistry = make(map[string]*ToolsetDefinition)
Toolset registry for managing tool groups
Functions ¶
func BuildDiscordComponents ¶ added in v0.3.1
func BuildDiscordComponents(result *ClarifyResult) string
BuildDiscordComponents builds ActionRow components for Discord
func BuildTelegramKeyboard ¶ added in v0.3.1
func BuildTelegramKeyboard(result *ClarifyResult) string
BuildTelegramKeyboard builds an InlineKeyboardMarkup for Telegram
func CloseKanbanManager ¶
func CloseKanbanManager() error
CloseKanbanManager closes the global kanban manager
func ContainsString ¶ added in v0.3.0
ContainsString 检查字符串切片是否包含指定字符串
func ExportBrowserToolsJSON ¶
func ExportBrowserToolsJSON() string
ExportBrowserToolsJSON exports browser tools as JSON
func ExportTerminalBackendsJSON ¶
func ExportTerminalBackendsJSON() string
ExportTerminalBackendsJSON exports available backends as JSON
func FormatReport ¶ added in v0.3.1
func FormatReport(report *FileChangeReport) string
FormatReport returns a human-readable report string
func GetAllToolsets ¶
func GetAllToolsets() map[string]*ToolsetDefinition
GetAllToolsets returns all toolsets
func GetTemplate ¶
GetTemplate returns a code template by name
func GetToolsetNames ¶
func GetToolsetNames() []string
GetToolsetNames returns all registered toolset names
func InitKanbanManager ¶
InitKanbanManager initializes the global kanban manager
func InitializeDefaultToolsets ¶
func InitializeDefaultToolsets()
InitializeDefaultToolsets registers all default toolsets
func LintFile ¶
LintFile performs syntax checking on a file after writing. Returns issues (non-blocking) or nil if no issues found.
func ListTemplates ¶
func ListTemplates() []string
ListTemplates returns all available template names
func ParseTaskStatus ¶
func ParseTaskStatus(s string) kanban.TaskStatus
ParseTaskStatus parses a string into TaskStatus
func RegisterKanbanTools ¶
func RegisterKanbanTools(registry *Registry)
RegisterKanbanTools registers kanban tools to the registry Tools are only registered when KANBAN_TASK environment variable is set
func RegisterMCPServerToolset ¶
RegisterMCPServerToolset registers a toolset for an MCP server
func RegisterSubAgentTools ¶ added in v0.3.0
RegisterSubAgentTools registers all subagent tools with the registry
func RegisterToolset ¶
func RegisterToolset(ts *ToolsetDefinition)
RegisterToolset registers a toolset
func ResolveToolset ¶
ResolveToolset resolves a toolset and all its includes to get all tool names
func SerializeForGateway ¶ added in v0.3.1
func SerializeForGateway(result *ClarifyResult) ([]byte, error)
SerializeForGateway serializes the clarify result for gateway platforms This is used by Telegram/Discord handlers to render native buttons
func UnregisterMCPServerToolset ¶
func UnregisterMCPServerToolset(serverName string)
UnregisterMCPServerToolset removes an MCP server toolset
func ValidateCode ¶
ValidateCode performs static analysis on code for security issues Supports both Python and JavaScript/Node.js
func ValidateCodeForLanguage ¶
ValidateCodeForLanguage performs security check for specific language
func ValidateParams ¶
ValidateParams 验证参数是否符合 Schema
Types ¶
type ASRAvailableProvidersTool ¶ added in v0.3.0
type ASRAvailableProvidersTool struct {
BaseTool
}
ASRAvailableProvidersTool 获取可用的 ASR 提供商工具
func NewASRAvailableProvidersTool ¶ added in v0.3.0
func NewASRAvailableProvidersTool() *ASRAvailableProvidersTool
NewASRAvailableProvidersTool 创建 ASR 可用提供商工具
type ASRTool ¶ added in v0.3.0
type ASRTool struct {
BaseTool
// contains filtered or unexported fields
}
ASRTool 语音转文字工具
func (*ASRTool) SetManager ¶ added in v0.3.0
SetManager sets the voice manager for the tool
func (*ASRTool) ValidateParams ¶ added in v0.3.0
ValidateParams 验证参数
type AliyunProvider ¶ added in v0.3.0
type AliyunProvider struct {
// contains filtered or unexported fields
}
AliyunProvider 阿里云短信提供商
func NewAliyunProvider ¶ added in v0.3.0
func NewAliyunProvider(config *AliyunSMSConfig) *AliyunProvider
NewAliyunProvider 创建阿里云短信提供商
func (*AliyunProvider) Send ¶ added in v0.3.0
func (p *AliyunProvider) Send(ctx context.Context, msg *SMSMessage) error
Send 发送短信
type AliyunSMSConfig ¶ added in v0.3.0
type AliyunSMSConfig struct {
AccessKeyID string `json:"access_key_id" yaml:"access_key_id"` // AccessKey ID
AccessKeySecret string `json:"access_key_secret" yaml:"access_key_secret"` // AccessKey Secret
SignName string `json:"sign_name" yaml:"sign_name"` // 短信签名
Endpoint string `json:"endpoint" yaml:"endpoint"` // API 端点
}
AliyunSMSConfig 阿里云短信配置
type AnalyzeErrorTool ¶ added in v0.3.0
type AnalyzeErrorTool struct {
*BaseTool
}
AnalyzeErrorTool analyzes error messages and stack traces
func NewAnalyzeErrorTool ¶ added in v0.3.0
func NewAnalyzeErrorTool() *AnalyzeErrorTool
NewAnalyzeErrorTool creates a new error analysis tool
type AsyncJob ¶
type AsyncJob struct {
ID string
ToolName string
Params map[string]any
Status JobStatus
Result *ToolResult
Error error
CreatedAt time.Time
StartedAt time.Time
EndedAt time.Time
}
AsyncJob 异步任务
type AsyncTool ¶
type AsyncTool interface {
Tool
// Start 启动异步执行,返回 jobID
Start(ctx context.Context, params map[string]any) (string, error)
// Status 获取任务状态
Status(jobID string) (JobStatus, error)
// Result 获取任务结果
Result(jobID string) (*ToolResult, error)
// Cancel 取消任务
Cancel(jobID string) error
}
AsyncTool 异步工具接口
type AsyncToolExecutor ¶
type AsyncToolExecutor struct {
// contains filtered or unexported fields
}
AsyncToolExecutor 异步工具执行器
func NewAsyncToolExecutor ¶
func NewAsyncToolExecutor(registry *Registry, maxWorkers int) *AsyncToolExecutor
NewAsyncToolExecutor 创建异步执行器
func (*AsyncToolExecutor) Cancel ¶
func (e *AsyncToolExecutor) Cancel(jobID string) error
Cancel 取消任务
func (*AsyncToolExecutor) GetJob ¶
func (e *AsyncToolExecutor) GetJob(jobID string) (*AsyncJob, error)
GetJob 获取任务
func (*AsyncToolExecutor) ListJobs ¶
func (e *AsyncToolExecutor) ListJobs() []*AsyncJob
ListJobs 列出所有任务
type AudioDownloadTool ¶ added in v0.3.0
type AudioDownloadTool struct {
BaseTool
}
AudioDownloadTool 下载音频工具
func NewAudioDownloadTool ¶ added in v0.3.0
func NewAudioDownloadTool() *AudioDownloadTool
NewAudioDownloadTool 创建音频下载工具
type AudioPlayTool ¶ added in v0.3.0
type AudioPlayTool struct {
BaseTool
}
AudioPlayTool 播放音频工具
func NewAudioPlayTool ¶ added in v0.3.0
func NewAudioPlayTool() *AudioPlayTool
NewAudioPlayTool 创建音频播放工具
type BackendManager ¶
type BackendManager struct {
// contains filtered or unexported fields
}
BackendManager manages terminal backends
func NewBackendManager ¶
func NewBackendManager() *BackendManager
func (*BackendManager) Execute ¶
func (m *BackendManager) Execute(ctx context.Context, backendName string, cmd string, workDir string, timeout time.Duration) (*ExecutionResult, error)
func (*BackendManager) Get ¶
func (m *BackendManager) Get(name string) TerminalBackend
func (*BackendManager) GetDefault ¶
func (m *BackendManager) GetDefault() TerminalBackend
func (*BackendManager) List ¶
func (m *BackendManager) List() []string
func (*BackendManager) Register ¶
func (m *BackendManager) Register(backend TerminalBackend)
func (*BackendManager) SetDefault ¶
func (m *BackendManager) SetDefault(name string)
type BaseTool ¶
type BaseTool struct {
// contains filtered or unexported fields
}
BaseTool 提供工具的默认实现基础类
func NewBaseTool ¶
NewBaseTool 创建一个基础工具
func (*BaseTool) Description ¶
type BatchFileOpsTool ¶ added in v0.3.0
type BatchFileOpsTool struct{}
BatchFileOpsTool performs batch file operations (read, write, delete, search_replace)
func NewBatchFileOpsTool ¶ added in v0.3.0
func NewBatchFileOpsTool() *BatchFileOpsTool
NewBatchFileOpsTool creates a new BatchFileOpsTool
func (*BatchFileOpsTool) Description ¶ added in v0.3.0
func (t *BatchFileOpsTool) Description() string
func (*BatchFileOpsTool) Execute ¶ added in v0.3.0
func (t *BatchFileOpsTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
func (*BatchFileOpsTool) Name ¶ added in v0.3.0
func (t *BatchFileOpsTool) Name() string
func (*BatchFileOpsTool) Schema ¶ added in v0.3.0
func (t *BatchFileOpsTool) Schema() map[string]interface{}
type BrowserBackTool ¶
type BrowserBackTool struct{}
BrowserBackTool navigates back
func NewBrowserBackTool ¶
func NewBrowserBackTool() *BrowserBackTool
func (*BrowserBackTool) Description ¶
func (t *BrowserBackTool) Description() string
func (*BrowserBackTool) Execute ¶
func (t *BrowserBackTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*BrowserBackTool) Name ¶
func (t *BrowserBackTool) Name() string
func (*BrowserBackTool) Schema ¶
func (t *BrowserBackTool) Schema() map[string]interface{}
type BrowserClickTool ¶
type BrowserClickTool struct {
// contains filtered or unexported fields
}
BrowserClickTool simulates clicking an element
func NewBrowserClickTool ¶
func NewBrowserClickTool(bt *BrowserTools) *BrowserClickTool
func (*BrowserClickTool) Description ¶
func (t *BrowserClickTool) Description() string
func (*BrowserClickTool) Execute ¶
func (t *BrowserClickTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*BrowserClickTool) Name ¶
func (t *BrowserClickTool) Name() string
func (*BrowserClickTool) Schema ¶
func (t *BrowserClickTool) Schema() map[string]interface{}
type BrowserConsoleTool ¶
type BrowserConsoleTool struct{}
BrowserConsoleTool extracts console errors (placeholder)
func NewBrowserConsoleTool ¶
func NewBrowserConsoleTool() *BrowserConsoleTool
func (*BrowserConsoleTool) Description ¶
func (t *BrowserConsoleTool) Description() string
func (*BrowserConsoleTool) Execute ¶
func (t *BrowserConsoleTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*BrowserConsoleTool) Name ¶
func (t *BrowserConsoleTool) Name() string
func (*BrowserConsoleTool) Schema ¶
func (t *BrowserConsoleTool) Schema() map[string]interface{}
type BrowserGetImagesTool ¶
type BrowserGetImagesTool struct {
// contains filtered or unexported fields
}
BrowserGetImagesTool extracts image URLs
func NewBrowserGetImagesTool ¶
func NewBrowserGetImagesTool(bt *BrowserTools) *BrowserGetImagesTool
func (*BrowserGetImagesTool) Description ¶
func (t *BrowserGetImagesTool) Description() string
func (*BrowserGetImagesTool) Execute ¶
func (t *BrowserGetImagesTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*BrowserGetImagesTool) Name ¶
func (t *BrowserGetImagesTool) Name() string
func (*BrowserGetImagesTool) Schema ¶
func (t *BrowserGetImagesTool) Schema() map[string]interface{}
type BrowserNavigateTool ¶
type BrowserNavigateTool struct {
// contains filtered or unexported fields
}
BrowserNavigateTool navigates to a URL
func NewBrowserNavigateTool ¶
func NewBrowserNavigateTool(bt *BrowserTools) *BrowserNavigateTool
func (*BrowserNavigateTool) Description ¶
func (t *BrowserNavigateTool) Description() string
func (*BrowserNavigateTool) Execute ¶
func (t *BrowserNavigateTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*BrowserNavigateTool) Name ¶
func (t *BrowserNavigateTool) Name() string
func (*BrowserNavigateTool) Schema ¶
func (t *BrowserNavigateTool) Schema() map[string]interface{}
type BrowserScrollTool ¶
type BrowserScrollTool struct {
// contains filtered or unexported fields
}
BrowserScrollTool scrolls the page
func NewBrowserScrollTool ¶
func NewBrowserScrollTool(bt *BrowserTools) *BrowserScrollTool
func (*BrowserScrollTool) Description ¶
func (t *BrowserScrollTool) Description() string
func (*BrowserScrollTool) Execute ¶
func (t *BrowserScrollTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*BrowserScrollTool) Name ¶
func (t *BrowserScrollTool) Name() string
func (*BrowserScrollTool) Schema ¶
func (t *BrowserScrollTool) Schema() map[string]interface{}
type BrowserSnapshotTool ¶
type BrowserSnapshotTool struct {
// contains filtered or unexported fields
}
BrowserSnapshotTool takes a snapshot of the current page
func NewBrowserSnapshotTool ¶
func NewBrowserSnapshotTool(bt *BrowserTools) *BrowserSnapshotTool
func (*BrowserSnapshotTool) Description ¶
func (t *BrowserSnapshotTool) Description() string
func (*BrowserSnapshotTool) Execute ¶
func (t *BrowserSnapshotTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*BrowserSnapshotTool) Name ¶
func (t *BrowserSnapshotTool) Name() string
func (*BrowserSnapshotTool) Schema ¶
func (t *BrowserSnapshotTool) Schema() map[string]interface{}
type BrowserTools ¶
type BrowserTools struct {
// contains filtered or unexported fields
}
BrowserTools provides enhanced browser automation tools
func NewBrowserTools ¶
func NewBrowserTools() *BrowserTools
NewBrowserTools creates a new browser tools instance
type BrowserTypeTool ¶
type BrowserTypeTool struct {
// contains filtered or unexported fields
}
BrowserTypeTool simulates typing text
func NewBrowserTypeTool ¶
func NewBrowserTypeTool(bt *BrowserTools) *BrowserTypeTool
func (*BrowserTypeTool) Description ¶
func (t *BrowserTypeTool) Description() string
func (*BrowserTypeTool) Execute ¶
func (t *BrowserTypeTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*BrowserTypeTool) Name ¶
func (t *BrowserTypeTool) Name() string
func (*BrowserTypeTool) Schema ¶
func (t *BrowserTypeTool) Schema() map[string]interface{}
type CacheKeyBuilder ¶
type CacheKeyBuilder struct {
// contains filtered or unexported fields
}
CacheKeyBuilder 缓存 key 构建器
func NewCacheKeyBuilder ¶
func NewCacheKeyBuilder(prefix string) *CacheKeyBuilder
type CacheStats ¶
CacheStats 缓存统计
type CachedToolExecutor ¶
type CachedToolExecutor struct {
// contains filtered or unexported fields
}
CachedToolExecutor 带有缓存的执行器包装
func NewCachedToolExecutor ¶
func NewCachedToolExecutor(registry *Registry, cache ToolCache) *CachedToolExecutor
NewCachedToolExecutor 创建缓存执行器
func (*CachedToolExecutor) ExecuteCached ¶
func (e *CachedToolExecutor) ExecuteCached(ctx context.Context, toolName string, params map[string]any, ttl time.Duration) (*ToolResult, error)
ExecuteCached 带缓存执行
func (*CachedToolExecutor) InvalidateCache ¶
func (e *CachedToolExecutor) InvalidateCache(toolName string)
InvalidateCache 使缓存失效
type CancelTaskTool ¶
type CancelTaskTool struct {
// contains filtered or unexported fields
}
CancelTaskTool cancels a running sub-agent task
func NewCancelTaskTool ¶
func NewCancelTaskTool(manager *subagent.Manager) *CancelTaskTool
NewCancelTaskTool creates a new cancel task tool
func (*CancelTaskTool) Description ¶
func (t *CancelTaskTool) Description() string
func (*CancelTaskTool) Execute ¶
func (t *CancelTaskTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
Execute cancels a task
func (*CancelTaskTool) Name ¶
func (t *CancelTaskTool) Name() string
func (*CancelTaskTool) Schema ¶
func (t *CancelTaskTool) Schema() map[string]interface{}
type ClarifyResult ¶ added in v0.3.1
type ClarifyResult struct {
Status string `json:"status"` // "clarification_needed"
Question string `json:"question"`
Options []string `json:"options,omitempty"`
Context string `json:"context,omitempty"`
MultiSelect bool `json:"multi_select,omitempty"`
Header string `json:"header,omitempty"`
// Platform-specific rendering hints
RenderAsButtons bool `json:"render_as_buttons"` // always true when options are provided
}
ClarifyResult is the structured result returned by the clarify tool
type ClarifyTool ¶
type ClarifyTool struct{}
ClarifyTool asks the user for clarification with native button support on messaging platforms
func (*ClarifyTool) Description ¶
func (t *ClarifyTool) Description() string
Description returns the tool description
func (*ClarifyTool) Execute ¶
func (t *ClarifyTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
Execute asks the user for clarification
func (*ClarifyTool) Parameters ¶
func (t *ClarifyTool) Parameters() map[string]interface{}
func (*ClarifyTool) Schema ¶
func (t *ClarifyTool) Schema() map[string]interface{}
Parameters returns the tool parameters schema
type CodeExecutionRequest ¶
type CodeExecutionRequest struct {
Code string `json:"code"`
Language string `json:"language,omitempty"`
Timeout int `json:"timeout,omitempty"`
WorkDir string `json:"workdir,omitempty"`
Packages []string `json:"packages,omitempty"`
Args []string `json:"args,omitempty"`
Tools []string `json:"tools,omitempty"`
Context map[string]interface{} `json:"context,omitempty"`
}
CodeExecutionRequest represents a code execution request with tool context
type CodeExecutionResponse ¶
type CodeExecutionResponse struct {
Success bool `json:"success"`
Output string `json:"output,omitempty"`
Error string `json:"error,omitempty"`
ExitCode int `json:"exit_code"`
ToolCalls []CodeToolCall `json:"tool_calls,omitempty"`
Duration time.Duration `json:"duration"`
}
CodeExecutionResponse represents the response from code execution
type CodeExecutorConfig ¶
type CodeExecutorConfig struct {
Timeout time.Duration // Max execution time
MemoryLimit int // Memory limit in MB
AllowedDirs []string // Allowed working directories
EnableTools bool // Enable tool calling from code
EnableNetwork bool // Enable network access
}
CodeExecutorConfig holds configuration for code execution
func DefaultCodeExecutorConfig ¶
func DefaultCodeExecutorConfig() *CodeExecutorConfig
DefaultCodeExecutorConfig returns the default configuration
type CodeToolCall ¶
type CodeToolCall struct {
Tool string `json:"tool"`
Args interface{} `json:"args"`
Result interface{} `json:"result"`
Duration time.Duration `json:"duration"`
}
CodeToolCall represents a tool call made during code execution
type ComplexityResult ¶ added in v0.3.0
type ComplexityResult struct {
TotalFiles int `json:"total_files"`
TotalDirs int `json:"total_dirs"`
TotalLines int `json:"total_lines"`
LanguageBreakdown map[string]LanguageStats `json:"language_breakdown"`
LargestFiles []FileInfo `json:"largest_files"`
}
ComplexityResult holds the output of code complexity analysis.
type ComputerUseAction ¶ added in v0.3.1
type ComputerUseAction struct {
Type string `json:"type"` // "click", "type", "scroll", "key", "screenshot", "drag"
X int `json:"x,omitempty"`
Y int `json:"y,omitempty"`
Text string `json:"text,omitempty"`
Key string `json:"key,omitempty"`
Button string `json:"button,omitempty"` // "left", "right", "middle"
ScrollY int `json:"scroll_y,omitempty"`
Duration float64 `json:"duration,omitempty"`
}
ComputerUseAction represents a single computer use action
type ComputerUseResult ¶ added in v0.3.1
type ComputerUseResult struct {
Success bool `json:"success"`
Action string `json:"action"`
Screenshot string `json:"screenshot_path,omitempty"`
ScreenshotB64 string `json:"screenshot_base64,omitempty"`
Error string `json:"error,omitempty"`
}
ComputerUseResult represents the result of a computer use action
type ComputerUseTool ¶ added in v0.3.1
type ComputerUseTool struct {
BaseTool
// contains filtered or unexported fields
}
ComputerUseTool enables the agent to control GUI applications via mouse and keyboard
func NewComputerUseTool ¶ added in v0.3.1
func NewComputerUseTool(screenshotDir string) *ComputerUseTool
NewComputerUseTool creates a new computer use tool
type CronJobTool ¶
type CronJobTool struct {
// contains filtered or unexported fields
}
CronJobTool manages scheduled tasks (cron jobs)
func (*CronJobTool) Description ¶
func (t *CronJobTool) Description() string
Description returns the tool description
func (*CronJobTool) Execute ¶
func (t *CronJobTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
Execute manages cron jobs
func (*CronJobTool) Parameters ¶
func (t *CronJobTool) Parameters() map[string]interface{}
func (*CronJobTool) Schema ¶
func (t *CronJobTool) Schema() map[string]interface{}
Parameters returns the tool parameters schema
type DaytonaBackend ¶
type DaytonaBackend struct {
// contains filtered or unexported fields
}
DaytonaBackend executes commands via Daytona (serverless dev environments)
func NewDaytonaBackend ¶
func NewDaytonaBackend() *DaytonaBackend
func (*DaytonaBackend) Configure ¶
func (b *DaytonaBackend) Configure(workspace, image, language, serverURL, apiKey string)
func (*DaytonaBackend) Description ¶
func (b *DaytonaBackend) Description() string
func (*DaytonaBackend) Execute ¶
func (b *DaytonaBackend) Execute(ctx context.Context, cmd string, workDir string, timeout time.Duration) (*ExecutionResult, error)
func (*DaytonaBackend) Health ¶
func (b *DaytonaBackend) Health() error
func (*DaytonaBackend) IsAvailable ¶
func (b *DaytonaBackend) IsAvailable() bool
func (*DaytonaBackend) Name ¶
func (b *DaytonaBackend) Name() string
func (*DaytonaBackend) SetAutoWake ¶
func (b *DaytonaBackend) SetAutoWake(autoWake bool)
func (*DaytonaBackend) SetPersist ¶
func (b *DaytonaBackend) SetPersist(persist bool)
type DefaultMetricsRecorder ¶
type DefaultMetricsRecorder struct{}
DefaultMetricsRecorder 默认指标记录器(空实现)
func (*DefaultMetricsRecorder) RecordToolExecution ¶
func (*DefaultMetricsRecorder) RecordToolMetric ¶
func (r *DefaultMetricsRecorder) RecordToolMetric(toolName string, metricName string, value float64)
type DefaultToolExecutor ¶
type DefaultToolExecutor struct{}
DefaultToolExecutor 默认工具执行器
func NewDefaultToolExecutor ¶
func NewDefaultToolExecutor() *DefaultToolExecutor
NewDefaultToolExecutor 创建默认执行器
func (*DefaultToolExecutor) ExecuteWithProtection ¶
func (e *DefaultToolExecutor) ExecuteWithProtection(ctx context.Context, tool Tool, params map[string]interface{}, timeout time.Duration) ToolExecutionResult
ExecuteWithProtection 执行工具,带有 panic 保护和超时控制
type DelegateTaskTool ¶
type DelegateTaskTool struct {
// contains filtered or unexported fields
}
DelegateTaskTool allows spawning isolated sub-agents for complex subtasks
func NewDelegateTaskTool ¶
func NewDelegateTaskTool(manager *subagent.Manager) *DelegateTaskTool
NewDelegateTaskTool creates a new delegate task tool
func (*DelegateTaskTool) Description ¶
func (t *DelegateTaskTool) Description() string
func (*DelegateTaskTool) Execute ¶
func (t *DelegateTaskTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
Execute spawns a sub-agent task
func (*DelegateTaskTool) Name ¶
func (t *DelegateTaskTool) Name() string
func (*DelegateTaskTool) Schema ¶
func (t *DelegateTaskTool) Schema() map[string]interface{}
type Dependency ¶ added in v0.3.0
type Dependency struct {
Name string `json:"name"`
Version string `json:"version"`
Type string `json:"type"` // "direct", "dev", "indirect"
}
Dependency represents a single dependency entry.
type DependencyResult ¶ added in v0.3.0
type DependencyResult struct {
ProjectType ProjectType `json:"project_type"`
Dependencies []Dependency `json:"dependencies"`
SourceFile string `json:"source_file"`
}
DependencyResult holds the output of dependency analysis.
type DiffPatchTool ¶ added in v0.3.0
type DiffPatchTool struct{}
DiffPatchTool provides diff/patch capabilities for coding mode. It supports showing diffs, applying patches, comparing files, and creating backups.
func NewDiffPatchTool ¶ added in v0.3.0
func NewDiffPatchTool() *DiffPatchTool
NewDiffPatchTool creates a new DiffPatchTool instance.
func (*DiffPatchTool) Description ¶ added in v0.3.0
func (t *DiffPatchTool) Description() string
Description returns the tool description.
func (*DiffPatchTool) Execute ¶ added in v0.3.0
func (t *DiffPatchTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
Execute dispatches the action to the appropriate handler.
func (*DiffPatchTool) Name ¶ added in v0.3.0
func (t *DiffPatchTool) Name() string
Name returns the tool name.
func (*DiffPatchTool) Schema ¶ added in v0.3.0
func (t *DiffPatchTool) Schema() map[string]interface{}
Schema returns the OpenAI function calling JSON Schema.
type DirectoryTreeTool ¶
type DirectoryTreeTool struct {
BaseTool
}
DirectoryTreeTool 目录树展示工具
func NewDirectoryTreeTool ¶
func NewDirectoryTreeTool() *DirectoryTreeTool
NewDirectoryTreeTool 创建目录树工具
func (*DirectoryTreeTool) Execute ¶
func (t *DirectoryTreeTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
Execute 执行目录树展示
func (*DirectoryTreeTool) ValidateParams ¶
func (t *DirectoryTreeTool) ValidateParams(params map[string]interface{}) error
ValidateParams 实现 ParamValidator 接口
type DockerBackend ¶
type DockerBackend struct {
// contains filtered or unexported fields
}
DockerBackend executes commands in Docker containers
func NewDockerBackend ¶
func NewDockerBackend() *DockerBackend
func (*DockerBackend) Description ¶
func (b *DockerBackend) Description() string
func (*DockerBackend) Execute ¶
func (b *DockerBackend) Execute(ctx context.Context, cmd string, workDir string, timeout time.Duration) (*ExecutionResult, error)
func (*DockerBackend) Health ¶
func (b *DockerBackend) Health() error
func (*DockerBackend) IsAvailable ¶
func (b *DockerBackend) IsAvailable() bool
func (*DockerBackend) Name ¶
func (b *DockerBackend) Name() string
func (*DockerBackend) SetCpuLimit ¶
func (b *DockerBackend) SetCpuLimit(limit string)
func (*DockerBackend) SetImage ¶
func (b *DockerBackend) SetImage(image string)
func (*DockerBackend) SetMemoryLimit ¶
func (b *DockerBackend) SetMemoryLimit(limit string)
type DocumentationGenerator ¶
type DocumentationGenerator struct {
// contains filtered or unexported fields
}
DocumentationGenerator 文档生成器
func NewDocumentationGenerator ¶
func NewDocumentationGenerator() *DocumentationGenerator
NewDocumentationGenerator 创建文档生成器
func (*DocumentationGenerator) GenerateIndex ¶
func (dg *DocumentationGenerator) GenerateIndex(tools []Tool) map[string]interface{}
GenerateIndex 生成工具索引
func (*DocumentationGenerator) GenerateMarkdown ¶
func (dg *DocumentationGenerator) GenerateMarkdown(tools []Tool) string
GenerateMarkdown 生成 Markdown 格式文档
func (*DocumentationGenerator) GenerateOpenAPISpec ¶
func (dg *DocumentationGenerator) GenerateOpenAPISpec(tools []Tool) []byte
GenerateOpenAPISpec 生成 OpenAPI 格式的工具规范
func (*DocumentationGenerator) GenerateToolHelp ¶
func (dg *DocumentationGenerator) GenerateToolHelp(toolName string, tools []Tool) string
GenerateToolHelp 生成单个工具的帮助信息
type DynamicTool ¶
DynamicTool 动态工具,支持 TTL 过期
func NewDynamicTool ¶
func NewDynamicTool(tool Tool, ttl time.Duration) *DynamicTool
NewDynamicTool 创建一个动态工具
type EmailAttachment ¶ added in v0.3.0
type EmailAttachment struct {
Filename string `json:"filename"` // 文件名
ContentType string `json:"content_type"` // 内容类型
Data []byte `json:"data"` // 文件数据
Path string `json:"path"` // 文件路径(与 Data 二选一)
}
EmailAttachment 邮件附件
type EmailConfig ¶ added in v0.3.0
type EmailConfig struct {
SMTPHost string `json:"smtp_host" yaml:"smtp_host"` // SMTP 服务器地址
SMTPPort int `json:"smtp_port" yaml:"smtp_port"` // SMTP 端口
Username string `json:"username" yaml:"username"` // 用户名
Password string `json:"password" yaml:"password"` // 密码或授权码
From string `json:"from" yaml:"from"` // 发件人地址
FromName string `json:"from_name" yaml:"from_name"` // 发件人名称
UseTLS bool `json:"use_tls" yaml:"use_tls"` // 是否使用 TLS
UseStartTLS bool `json:"use_starttls" yaml:"use_starttls"` // 是否使用 STARTTLS
InsecureSkip bool `json:"insecure_skip" yaml:"insecure_skip"` // 跳过 TLS 证书验证
}
EmailConfig 邮件配置
type EmailMessage ¶ added in v0.3.0
type EmailMessage struct {
To []string `json:"to"` // 收件人
Cc []string `json:"cc"` // 抄送
Bcc []string `json:"bcc"` // 密送
Subject string `json:"subject"` // 主题
Body string `json:"body"` // 正文
IsHTML bool `json:"is_html"` // 是否为 HTML
Attachments []EmailAttachment `json:"attachments"` // 附件
Headers map[string]string `json:"headers"` // 自定义头
}
EmailMessage 邮件消息
type EmailTool ¶ added in v0.3.0
type EmailTool struct {
// contains filtered or unexported fields
}
EmailTool 邮件发送工具
func NewEmailTool ¶ added in v0.3.0
func NewEmailTool(config *EmailConfig) *EmailTool
NewEmailTool 创建邮件发送工具
func (*EmailTool) Description ¶ added in v0.3.0
Description 返回工具描述
type EntryPoint ¶ added in v0.3.0
type EntryPoint struct {
Path string `json:"path"`
Type string `json:"type"` // "main", "cli", "library", "test", "config"
Description string `json:"description"`
}
EntryPoint represents a detected entry point.
type EntryPointResult ¶ added in v0.3.0
type EntryPointResult struct {
EntryPoints []EntryPoint `json:"entry_points"`
ConfigFiles []string `json:"config_files"`
}
EntryPointResult holds the output of entry point detection.
type ErrorAnalysis ¶ added in v0.3.0
type ErrorAnalysis struct {
ErrorType string `json:"error_type"`
Location *ErrorLocation `json:"location,omitempty"`
Message string `json:"message"`
StackTrace []StackFrame `json:"stack_trace,omitempty"`
Causes []string `json:"possible_causes"`
Suggestions []FixSuggestion `json:"suggestions"`
Severity string `json:"severity"`
Language string `json:"language,omitempty"`
}
ErrorAnalysis represents the analysis of an error
type ErrorLocation ¶ added in v0.3.0
type ErrorLocation struct {
File string `json:"file"`
Line int `json:"line"`
Column int `json:"column,omitempty"`
Function string `json:"function,omitempty"`
}
ErrorLocation represents where an error occurred
type ExecuteCodeTool ¶
type ExecuteCodeTool struct {
// contains filtered or unexported fields
}
ExecuteCodeTool provides in-process multi-language code execution with tool access and package management support
func NewExecuteCodeTool ¶
func NewExecuteCodeTool() *ExecuteCodeTool
NewExecuteCodeTool creates a new execute_code tool
func (*ExecuteCodeTool) Description ¶
func (t *ExecuteCodeTool) Description() string
func (*ExecuteCodeTool) Execute ¶
func (t *ExecuteCodeTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
Execute runs code with optional tool access and package management
func (*ExecuteCodeTool) ExecuteWithTools ¶
func (t *ExecuteCodeTool) ExecuteWithTools(ctx context.Context, req *CodeExecutionRequest, toolRegistry map[string]Tool) (*CodeExecutionResponse, error)
ExecuteWithTools executes code with tool integration
func (*ExecuteCodeTool) Name ¶
func (t *ExecuteCodeTool) Name() string
func (*ExecuteCodeTool) RegisterTool ¶
func (t *ExecuteCodeTool) RegisterTool(name string, tool Tool)
RegisterTool registers a tool that can be called from executed code
func (*ExecuteCodeTool) Schema ¶
func (t *ExecuteCodeTool) Schema() map[string]interface{}
func (*ExecuteCodeTool) SetCodingMode ¶ added in v0.3.0
func (t *ExecuteCodeTool) SetCodingMode(enabled bool)
SetCodingMode enables coding mode with relaxed restrictions
type ExecuteCommandTool ¶
type ExecuteCommandTool struct {
// contains filtered or unexported fields
}
func NewSecureExecuteCommandTool ¶
func NewSecureExecuteCommandTool(workDir string) *ExecuteCommandTool
func (*ExecuteCommandTool) AddToWhitelist ¶
func (t *ExecuteCommandTool) AddToWhitelist(cmd string)
AddToWhitelist adds a command to the allowed list
func (*ExecuteCommandTool) Description ¶
func (t *ExecuteCommandTool) Description() string
func (*ExecuteCommandTool) Execute ¶
func (t *ExecuteCommandTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*ExecuteCommandTool) Name ¶
func (t *ExecuteCommandTool) Name() string
func (*ExecuteCommandTool) Parameters ¶
func (t *ExecuteCommandTool) Parameters() map[string]interface{}
func (*ExecuteCommandTool) Schema ¶
func (t *ExecuteCommandTool) Schema() map[string]interface{}
func (*ExecuteCommandTool) SetAllowAny ¶
func (t *ExecuteCommandTool) SetAllowAny(allow bool)
SetAllowAny allows executing arbitrary commands (use with caution)
func (*ExecuteCommandTool) SetCodingMode ¶ added in v0.3.0
func (t *ExecuteCommandTool) SetCodingMode(enabled bool)
SetCodingMode enables coding mode with relaxed restrictions
func (*ExecuteCommandTool) SetCodingModeAdvanced ¶ added in v0.3.0
func (t *ExecuteCommandTool) SetCodingModeAdvanced(enabled bool)
SetCodingModeAdvanced enables advanced coding mode with even more relaxed restrictions
type ExecutionResult ¶
type ExecutionResult struct {
Command string `json:"command"`
ExitCode int `json:"exit_code"`
Output string `json:"output"`
Duration time.Duration `json:"duration"`
Backend string `json:"backend"`
Timestamp time.Time `json:"timestamp"`
}
ExecutionResult represents the result of a command execution
type ExecutionStep ¶ added in v0.3.0
type ExecutionStep struct {
Step int `json:"step"`
Function string `json:"function"`
File string `json:"file"`
Line int `json:"line"`
Variables map[string]string `json:"variables,omitempty"`
CallType string `json:"call_type"` // call, return, error
}
ExecutionStep represents a single step in execution
type ExecutionTrace ¶ added in v0.3.0
type ExecutionTrace struct {
Steps []ExecutionStep `json:"steps"`
Variables map[string]interface{} `json:"variables,omitempty"`
Duration int64 `json:"duration_ms,omitempty"`
EntryPoint string `json:"entry_point"`
}
ExecutionTrace represents a trace of code execution
type FileChange ¶ added in v0.3.1
type FileChange struct {
Path string `json:"path"`
Action string `json:"action"` // created, modified, deleted
OldLines int `json:"old_lines,omitempty"`
NewLines int `json:"new_lines,omitempty"`
OldSize int64 `json:"old_size,omitempty"`
NewSize int64 `json:"new_size,omitempty"`
}
FileChange represents a single file change detected
type FileChangeReport ¶ added in v0.3.1
type FileChangeReport struct {
Changes []FileChange `json:"changes"`
TotalFiles int `json:"total_files"`
Summary string `json:"summary"`
}
FileChangeReport is the verification footer sent to the agent
type FileChangeVerifier ¶ added in v0.3.1
type FileChangeVerifier struct {
// contains filtered or unexported fields
}
FileChangeVerifier tracks file changes and produces a verification footer
func NewFileChangeVerifier ¶ added in v0.3.1
func NewFileChangeVerifier() *FileChangeVerifier
NewFileChangeVerifier creates a new verifier
func (*FileChangeVerifier) Clear ¶ added in v0.3.1
func (v *FileChangeVerifier) Clear()
Clear removes all snapshots
func (*FileChangeVerifier) Snapshot ¶ added in v0.3.1
func (v *FileChangeVerifier) Snapshot(paths []string)
Snapshot captures the current state of files before a tool execution
func (*FileChangeVerifier) SnapshotDir ¶ added in v0.3.1
func (v *FileChangeVerifier) SnapshotDir(dir string)
SnapshotDir captures all files in a directory
func (*FileChangeVerifier) Verify ¶ added in v0.3.1
func (v *FileChangeVerifier) Verify(paths []string) *FileChangeReport
Verify checks what changed since the last snapshot and returns a report
type FileEditTool ¶
type FileEditTool struct{}
FileEditTool handles file edit operations
func NewFileEditTool ¶
func NewFileEditTool() *FileEditTool
func (*FileEditTool) Description ¶
func (t *FileEditTool) Description() string
func (*FileEditTool) Execute ¶
func (t *FileEditTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
func (*FileEditTool) Name ¶
func (t *FileEditTool) Name() string
func (*FileEditTool) Parameters ¶
func (t *FileEditTool) Parameters() map[string]interface{}
func (*FileEditTool) Schema ¶
func (t *FileEditTool) Schema() map[string]interface{}
type FileInfo ¶ added in v0.3.0
type FileInfo struct {
Path string `json:"path"`
Lines int `json:"lines"`
Size int64 `json:"size"`
}
FileInfo holds information about a single file.
type FileSearchTool ¶
type FileSearchTool struct {
BaseTool
}
FileSearchTool 文件内容搜索工具
func (*FileSearchTool) Execute ¶
func (t *FileSearchTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
Execute 执行文件搜索
func (*FileSearchTool) ValidateParams ¶
func (t *FileSearchTool) ValidateParams(params map[string]interface{}) error
ValidateParams 实现 ParamValidator 接口
type FixSuggestion ¶ added in v0.3.0
type FixSuggestion struct {
Description string `json:"description"`
Code string `json:"code,omitempty"`
Line int `json:"line,omitempty"`
Confidence string `json:"confidence"` // high, medium, low
}
FixSuggestion represents a suggested fix
type FormatTool ¶ added in v0.3.0
type FormatTool struct {
*BaseTool
}
FormatTool is a tool for formatting code
func NewFormatTool ¶ added in v0.3.0
func NewFormatTool() *FormatTool
NewFormatTool creates a new format tool
type GatewaySender ¶ added in v0.3.1
type GatewaySender interface {
SendToPlatform(platform, channelID, content string) error
Broadcast(content string)
GetConnectedPlatforms() []string
}
GatewaySender defines the interface for sending messages through the gateway
type GitignoreTool ¶ added in v0.3.0
type GitignoreTool struct {
// contains filtered or unexported fields
}
GitignoreTool provides functionality to generate .gitignore files
func NewGitignoreTool ¶ added in v0.3.0
func NewGitignoreTool() *GitignoreTool
NewGitignoreTool creates a new gitignore tool
func (*GitignoreTool) CombineTemplates ¶ added in v0.3.0
func (t *GitignoreTool) CombineTemplates(templates []string, outputPath string, customRules []string) error
CombineTemplates combines multiple gitignore templates
func (*GitignoreTool) Description ¶ added in v0.3.0
func (t *GitignoreTool) Description() string
func (*GitignoreTool) Execute ¶ added in v0.3.0
func (t *GitignoreTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
Execute runs the gitignore tool
func (*GitignoreTool) GenerateGitignoreForProject ¶ added in v0.3.0
func (t *GitignoreTool) GenerateGitignoreForProject(projectType, outputPath string) error
GenerateGitignoreForProject generates a .gitignore for a specific project type
func (*GitignoreTool) Name ¶ added in v0.3.0
func (t *GitignoreTool) Name() string
func (*GitignoreTool) Schema ¶ added in v0.3.0
func (t *GitignoreTool) Schema() map[string]interface{}
type GroupManager ¶
type GroupManager struct {
// contains filtered or unexported fields
}
func DefaultToolGroups ¶
func DefaultToolGroups(registry *Registry) *GroupManager
DefaultGroups 返回默认的工具分组
func (*GroupManager) AddToolToGroup ¶
func (gm *GroupManager) AddToolToGroup(tool Tool, groupName string) error
AddToolToGroup 将工具添加到分组
func (*GroupManager) CreateGroup ¶
func (gm *GroupManager) CreateGroup(name, description string) *ToolGroup
CreateGroup 创建新的分组
func (*GroupManager) DeleteGroup ¶
func (gm *GroupManager) DeleteGroup(name string)
DeleteGroup 删除分组(不删除工具)
func (*GroupManager) DisableGroup ¶
func (gm *GroupManager) DisableGroup(name string)
DisableGroup 禁用分组
func (*GroupManager) EnableGroup ¶
func (gm *GroupManager) EnableGroup(name string)
EnableGroup 启用分组
func (*GroupManager) GetEnabledTools ¶
func (gm *GroupManager) GetEnabledTools() []Tool
GetEnabledTools 获取所有启用的工具
func (*GroupManager) GetGroup ¶
func (gm *GroupManager) GetGroup(name string) *ToolGroup
GetGroup 获取分组
func (*GroupManager) GetToolGroup ¶
func (gm *GroupManager) GetToolGroup(toolName string) string
GetToolGroup 获取工具所属的分组
func (*GroupManager) ListGroups ¶
func (gm *GroupManager) ListGroups() []*ToolGroup
ListGroups 列出所有分组
func (*GroupManager) RegisterGroup ¶
func (gm *GroupManager) RegisterGroup(group *ToolGroup)
RegisterGroup 注册分组
func (*GroupManager) RemoveToolFromGroup ¶
func (gm *GroupManager) RemoveToolFromGroup(toolName, groupName string) error
RemoveToolFromGroup 将工具从分组移除
type HACallServiceTool ¶
type HACallServiceTool struct {
// contains filtered or unexported fields
}
HACallServiceTool calls a Home Assistant service
func NewHACallServiceTool ¶
func NewHACallServiceTool() *HACallServiceTool
func (*HACallServiceTool) Description ¶
func (t *HACallServiceTool) Description() string
func (*HACallServiceTool) Execute ¶
func (t *HACallServiceTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*HACallServiceTool) Name ¶
func (t *HACallServiceTool) Name() string
func (*HACallServiceTool) Schema ¶
func (t *HACallServiceTool) Schema() map[string]interface{}
type HAConfig ¶
type HAConfig struct {
URL string // e.g., "http://homeassistant.local:8123"
Token string // Long-lived access token
Client *http.Client
}
HAConfig holds Home Assistant connection configuration
func NewHAConfig ¶
func NewHAConfig() *HAConfig
NewHAConfig creates a new Home Assistant config from environment
func (*HAConfig) IsConfigured ¶
IsConfigured checks if Home Assistant is properly configured
type HAConfigTool ¶
type HAConfigTool struct {
// contains filtered or unexported fields
}
HAConfigTool provides Home Assistant system information
func NewHAConfigTool ¶
func NewHAConfigTool() *HAConfigTool
func (*HAConfigTool) Description ¶
func (t *HAConfigTool) Description() string
func (*HAConfigTool) Execute ¶
func (t *HAConfigTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*HAConfigTool) Name ¶
func (t *HAConfigTool) Name() string
func (*HAConfigTool) Schema ¶
func (t *HAConfigTool) Schema() map[string]interface{}
type HAEventsTool ¶
type HAEventsTool struct {
// contains filtered or unexported fields
}
HAEventsTool provides Home Assistant event monitoring
func NewHAEventsTool ¶
func NewHAEventsTool() *HAEventsTool
func (*HAEventsTool) Description ¶
func (t *HAEventsTool) Description() string
func (*HAEventsTool) Execute ¶
func (t *HAEventsTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*HAEventsTool) Name ¶
func (t *HAEventsTool) Name() string
func (*HAEventsTool) Schema ¶
func (t *HAEventsTool) Schema() map[string]interface{}
type HAGetStateTool ¶
type HAGetStateTool struct {
// contains filtered or unexported fields
}
HAGetStateTool gets the state of a specific entity
func NewHAGetStateTool ¶
func NewHAGetStateTool() *HAGetStateTool
func (*HAGetStateTool) Description ¶
func (t *HAGetStateTool) Description() string
func (*HAGetStateTool) Execute ¶
func (t *HAGetStateTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*HAGetStateTool) Name ¶
func (t *HAGetStateTool) Name() string
func (*HAGetStateTool) Schema ¶
func (t *HAGetStateTool) Schema() map[string]interface{}
type HAListServicesTool ¶
type HAListServicesTool struct {
// contains filtered or unexported fields
}
HAListServicesTool lists available Home Assistant services
func NewHAListServicesTool ¶
func NewHAListServicesTool() *HAListServicesTool
func (*HAListServicesTool) Description ¶
func (t *HAListServicesTool) Description() string
func (*HAListServicesTool) Execute ¶
func (t *HAListServicesTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*HAListServicesTool) Name ¶
func (t *HAListServicesTool) Name() string
func (*HAListServicesTool) Schema ¶
func (t *HAListServicesTool) Schema() map[string]interface{}
type HATool ¶
type HATool struct {
// contains filtered or unexported fields
}
HATool provides Home Assistant smart home control
func (*HATool) Description ¶
type HelpGenerator ¶
type HelpGenerator struct{}
HelpGenerator 帮助信息生成器
func (*HelpGenerator) GenerateAllHelp ¶
func (hg *HelpGenerator) GenerateAllHelp(registry *Registry) string
GenerateAllHelp 生成所有工具的帮助
func (*HelpGenerator) GenerateHelp ¶
func (hg *HelpGenerator) GenerateHelp(tool Tool) string
GenerateHelp 生成帮助文本
type ImageEditTool ¶ added in v0.3.0
type ImageEditTool struct {
BaseTool
// contains filtered or unexported fields
}
ImageEditTool 图片编辑工具
func NewImageEditTool ¶ added in v0.3.0
func NewImageEditTool(config *ImageGenConfig) *ImageEditTool
NewImageEditTool 创建图片编辑工具
func (*ImageEditTool) Execute ¶ added in v0.3.0
func (t *ImageEditTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
Execute 执行图片编辑
func (*ImageEditTool) ValidateParams ¶ added in v0.3.0
func (t *ImageEditTool) ValidateParams(params map[string]interface{}) error
ValidateParams 验证参数
type ImageGenConfig ¶ added in v0.3.0
type ImageGenConfig struct {
Provider ImageProvider `json:"provider"`
APIKey string `json:"api_key"`
BaseURL string `json:"base_url"`
DefaultSize string `json:"default_size"`
DefaultStyle string `json:"default_style"`
OutputDirectory string `json:"output_directory"`
Timeout time.Duration `json:"timeout"`
}
ImageGenConfig 图片生成配置
func DefaultImageGenConfig ¶ added in v0.3.0
func DefaultImageGenConfig() *ImageGenConfig
DefaultImageGenConfig 返回默认图片生成配置
func LoadImageGenConfigFromEnv ¶ added in v0.3.0
func LoadImageGenConfigFromEnv() *ImageGenConfig
LoadImageGenConfigFromEnv 从环境变量加载图片生成配置
func LoadImageGenConfigFromMap ¶ added in v0.3.0
func LoadImageGenConfigFromMap(cfg map[string]interface{}) *ImageGenConfig
LoadImageGenConfigFromMap 从配置映射加载图片生成配置
type ImageGenerationResult ¶ added in v0.3.0
ImageGenerationResult 图片生成结果
type ImageGenerationTool ¶
type ImageGenerationTool struct {
BaseTool
// contains filtered or unexported fields
}
ImageGenerationTool 图片生成工具
func NewImageGenerationTool ¶
func NewImageGenerationTool(config *ImageGenConfig) *ImageGenerationTool
NewImageGenerationTool 创建图片生成工具
func (*ImageGenerationTool) Execute ¶
func (t *ImageGenerationTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
Execute 执行图片生成
func (*ImageGenerationTool) GetConfig ¶ added in v0.3.0
func (t *ImageGenerationTool) GetConfig() *ImageGenConfig
GetConfig 获取当前配置
func (*ImageGenerationTool) SetConfig ¶ added in v0.3.0
func (t *ImageGenerationTool) SetConfig(config *ImageGenConfig)
SetConfig 设置图片生成配置
func (*ImageGenerationTool) ValidateParams ¶
func (t *ImageGenerationTool) ValidateParams(params map[string]interface{}) error
ValidateParams 验证参数
type ImageProvider ¶ added in v0.3.0
type ImageProvider string
ImageProvider 图片生成提供商类型
const ( // ProviderDALLE DALL-E 提供商 ProviderDALLE ImageProvider = "dall-e" // ProviderStableDiffusion Stable Diffusion 提供商 ProviderStableDiffusion ImageProvider = "stable-diffusion" // ProviderMidjourney Midjourney 提供商 ProviderMidjourney ImageProvider = "midjourney" // ProviderTogether Together AI 提供商 ProviderTogether ImageProvider = "together" )
type InMemoryToolCache ¶
type InMemoryToolCache struct {
// contains filtered or unexported fields
}
InMemoryToolCache 内存缓存实现
func NewInMemoryCache ¶
func NewInMemoryCache(maxSize int) *InMemoryToolCache
NewInMemoryCache 创建内存缓存
func (*InMemoryToolCache) Clear ¶
func (c *InMemoryToolCache) Clear()
func (*InMemoryToolCache) Delete ¶
func (c *InMemoryToolCache) Delete(key string)
func (*InMemoryToolCache) Get ¶
func (c *InMemoryToolCache) Get(key string) (*ToolResult, bool)
func (*InMemoryToolCache) Set ¶
func (c *InMemoryToolCache) Set(key string, result *ToolResult, ttl time.Duration)
func (*InMemoryToolCache) Size ¶
func (c *InMemoryToolCache) Size() int
type InterruptRequest ¶ added in v0.3.1
type InterruptRequest struct {
Reason string `json:"reason"` // Why the interruption is happening
Force bool `json:"force"` // If true, force immediate interruption
}
InterruptRequest represents a request to interrupt execution
type InterruptResult ¶ added in v0.3.1
type InterruptResult struct {
Success bool `json:"success"`
WasInterrupted bool `json:"was_interrupted"`
Reason string `json:"reason,omitempty"`
Timestamp time.Time `json:"timestamp"`
Message string `json:"message"`
}
InterruptResult represents the result of an interrupt operation
type InterruptStatus ¶ added in v0.3.1
type InterruptStatus struct {
IsInterrupted bool `json:"is_interrupted"`
Reason string `json:"reason,omitempty"`
Timestamp time.Time `json:"timestamp,omitempty"`
}
InterruptStatus represents the current interrupt status
type InterruptTool ¶ added in v0.3.1
type InterruptTool struct {
BaseTool
// contains filtered or unexported fields
}
InterruptTool allows the agent to interrupt its own execution This is useful for stopping long-running operations, canceling pending tasks, or allowing the user to interrupt the agent mid-thought
func NewInterruptTool ¶ added in v0.3.1
func NewInterruptTool() *InterruptTool
NewInterruptTool creates a new interrupt tool
func (*InterruptTool) CheckAndClear ¶ added in v0.3.1
func (t *InterruptTool) CheckAndClear() bool
CheckAndClear checks if interrupted and clears the state atomically Returns true if was interrupted
func (*InterruptTool) Execute ¶ added in v0.3.1
func (t *InterruptTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
Execute triggers an interrupt
func (*InterruptTool) GetInterruptChannel ¶ added in v0.3.1
func (t *InterruptTool) GetInterruptChannel() <-chan struct{}
GetInterruptChannel returns a channel that receives a signal when interrupted
func (*InterruptTool) GetStatus ¶ added in v0.3.1
func (t *InterruptTool) GetStatus() *InterruptStatus
GetStatus returns the current interrupt status
func (*InterruptTool) IsInterrupted ¶ added in v0.3.1
func (t *InterruptTool) IsInterrupted() bool
IsInterrupted returns true if an interrupt has been triggered
func (*InterruptTool) OnInterrupt ¶ added in v0.3.1
func (t *InterruptTool) OnInterrupt(callback func(reason string))
OnInterrupt registers a callback to be called when interrupted
func (*InterruptTool) Reset ¶ added in v0.3.1
func (t *InterruptTool) Reset()
Reset clears the interrupt state
func (*InterruptTool) WaitForInterrupt ¶ added in v0.3.1
func (t *InterruptTool) WaitForInterrupt(timeout time.Duration) bool
WaitForInterrupt blocks until an interrupt is received or timeout
type Job ¶
type Job struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Schedule string `json:"schedule"`
Prompt string `json:"prompt"`
Platform string `json:"platform,omitempty"`
Enabled bool `json:"enabled"`
CreatedAt time.Time `json:"created_at"`
LastRun *time.Time `json:"last_run,omitempty"`
}
Job represents a cron job
type KanbanBlockTool ¶
type KanbanBlockTool struct {
*BaseTool
}
KanbanBlockTool blocks the current task
func NewKanbanBlockTool ¶
func NewKanbanBlockTool() *KanbanBlockTool
NewKanbanBlockTool creates a new kanban block tool
type KanbanCommentTool ¶
type KanbanCommentTool struct {
*BaseTool
}
KanbanCommentTool adds a comment to a task
func NewKanbanCommentTool ¶
func NewKanbanCommentTool() *KanbanCommentTool
NewKanbanCommentTool creates a new kanban comment tool
type KanbanCompleteTool ¶
type KanbanCompleteTool struct {
*BaseTool
}
KanbanCompleteTool completes the current task
func NewKanbanCompleteTool ¶
func NewKanbanCompleteTool() *KanbanCompleteTool
NewKanbanCompleteTool creates a new kanban complete tool
type KanbanCreateTool ¶
type KanbanCreateTool struct {
*BaseTool
}
KanbanCreateTool creates a new task
func NewKanbanCreateTool ¶
func NewKanbanCreateTool() *KanbanCreateTool
NewKanbanCreateTool creates a new kanban create tool
type KanbanHeartbeatTool ¶
type KanbanHeartbeatTool struct {
*BaseTool
}
KanbanHeartbeatTool reports task heartbeat
func NewKanbanHeartbeatTool ¶
func NewKanbanHeartbeatTool() *KanbanHeartbeatTool
NewKanbanHeartbeatTool creates a new kanban heartbeat tool
type KanbanLinkTool ¶
type KanbanLinkTool struct {
*BaseTool
}
KanbanLinkTool links two tasks as parent-child
func NewKanbanLinkTool ¶
func NewKanbanLinkTool() *KanbanLinkTool
NewKanbanLinkTool creates a new kanban link tool
type KanbanShowTool ¶
type KanbanShowTool struct {
*BaseTool
}
KanbanShowTool shows the current task details
func NewKanbanShowTool ¶
func NewKanbanShowTool() *KanbanShowTool
NewKanbanShowTool creates a new kanban show tool
type LSPDiagnostic ¶ added in v0.3.1
type LSPDiagnostic struct {
File string `json:"file"`
Line int `json:"line"`
Column int `json:"column"`
Severity string `json:"severity"` // error, warning, hint
Message string `json:"message"`
}
LSPDiagnostic represents a single diagnostic finding
type LSPDiagnosticResult ¶ added in v0.3.1
type LSPDiagnosticResult struct {
File string `json:"file"`
Language string `json:"language"`
Diagnostics []LSPDiagnostic `json:"diagnostics"`
ErrorCount int `json:"error_count"`
WarningCount int `json:"warning_count"`
Summary string `json:"summary"`
}
LSPDiagnosticResult is the result of running diagnostics
type LSPDiagnosticTool ¶ added in v0.3.1
type LSPDiagnosticTool struct {
BaseTool
// contains filtered or unexported fields
}
LSPDiagnosticTool runs LSP semantic diagnostics on files after writes
func NewLSPDiagnosticTool ¶ added in v0.3.1
func NewLSPDiagnosticTool(workDir string) *LSPDiagnosticTool
NewLSPDiagnosticTool creates a new LSP diagnostic tool
type Language ¶ added in v0.3.0
type Language string
Language represents a supported programming language
type LanguageStats ¶ added in v0.3.0
LanguageStats holds statistics for a single language.
type LintIssue ¶ added in v0.3.0
type LintIssue struct {
FilePath string `json:"file_path"`
Line int `json:"line,omitempty"`
Column int `json:"column,omitempty"`
Message string `json:"message"`
Level LintLevel `json:"level"`
Code string `json:"code,omitempty"`
Fixable bool `json:"fixable"`
}
LintIssue represents a single lint issue
type LintLevel ¶ added in v0.3.0
type LintLevel string
LintLevel represents the severity level of a lint issue
type LintOptions ¶ added in v0.3.0
LintOptions contains options for linting
func DefaultLintOptions ¶ added in v0.3.0
func DefaultLintOptions() LintOptions
DefaultLintOptions returns default lint options
type LintResult ¶
type LintResult struct {
FilePath string `json:"file_path"`
Issues []LintIssue `json:"issues,omitempty"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
}
LintResult represents the result of a lint check
func LintFiles ¶
func LintFiles(paths []string) []LintResult
LintFiles checks multiple files and returns aggregated results
func RunLinter ¶ added in v0.3.0
func RunLinter(ctx context.Context, dir string, opts LintOptions) ([]LintResult, error)
RunLinter runs the appropriate linter for the project type
type LintTool ¶ added in v0.3.0
type LintTool struct {
*BaseTool
}
LintTool is a tool for running linters
type ListFilesTool ¶
type ListFilesTool struct{}
func (*ListFilesTool) Description ¶
func (t *ListFilesTool) Description() string
func (*ListFilesTool) Execute ¶
func (t *ListFilesTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*ListFilesTool) Name ¶
func (t *ListFilesTool) Name() string
func (*ListFilesTool) Schema ¶
func (t *ListFilesTool) Schema() map[string]interface{}
type ListTasksTool ¶
type ListTasksTool struct {
// contains filtered or unexported fields
}
ListTasksTool lists all sub-agent tasks
func NewListTasksTool ¶
func NewListTasksTool(manager *subagent.Manager) *ListTasksTool
NewListTasksTool creates a new list tasks tool
func (*ListTasksTool) Description ¶
func (t *ListTasksTool) Description() string
func (*ListTasksTool) Execute ¶
func (t *ListTasksTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
Execute lists tasks
func (*ListTasksTool) Name ¶
func (t *ListTasksTool) Name() string
func (*ListTasksTool) Schema ¶
func (t *ListTasksTool) Schema() map[string]interface{}
type LocalBackend ¶
type LocalBackend struct {
// contains filtered or unexported fields
}
LocalBackend executes commands locally
func NewLocalBackend ¶
func NewLocalBackend() *LocalBackend
func (*LocalBackend) Description ¶
func (b *LocalBackend) Description() string
func (*LocalBackend) Execute ¶
func (b *LocalBackend) Execute(ctx context.Context, cmd string, workDir string, timeout time.Duration) (*ExecutionResult, error)
func (*LocalBackend) Health ¶
func (b *LocalBackend) Health() error
func (*LocalBackend) IsAvailable ¶
func (b *LocalBackend) IsAvailable() bool
func (*LocalBackend) Name ¶
func (b *LocalBackend) Name() string
func (*LocalBackend) SetAllowAny ¶
func (b *LocalBackend) SetAllowAny(allow bool)
type Logger ¶
type Logger interface {
LogToolExecution(name string, params, result map[string]interface{}, duration time.Duration, err error)
}
Logger 工具日志接口
type LongRunningTool ¶
type LongRunningTool struct {
BaseTool
// contains filtered or unexported fields
}
LongRunningTool 长时运行工具示例
func NewLongRunningTool ¶
func NewLongRunningTool(executor *AsyncToolExecutor) *LongRunningTool
NewLongRunningTool 创建长时运行工具
func (*LongRunningTool) Cancel ¶
func (t *LongRunningTool) Cancel(jobID string) error
func (*LongRunningTool) Result ¶
func (t *LongRunningTool) Result(jobID string) (*ToolResult, error)
type Match ¶
type Match struct {
File string `json:"file"`
Line int `json:"line"`
Column int `json:"column,omitempty"`
Content string `json:"content"`
Context []string `json:"context,omitempty"`
}
Match 结构体表示单个匹配
type MemoryRecallTool ¶
type MemoryRecallTool struct{}
func (*MemoryRecallTool) Description ¶
func (t *MemoryRecallTool) Description() string
func (*MemoryRecallTool) Execute ¶
func (t *MemoryRecallTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*MemoryRecallTool) Name ¶
func (t *MemoryRecallTool) Name() string
func (*MemoryRecallTool) Schema ¶
func (t *MemoryRecallTool) Schema() map[string]interface{}
type MemoryStoreTool ¶
type MemoryStoreTool struct{}
func (*MemoryStoreTool) Description ¶
func (t *MemoryStoreTool) Description() string
func (*MemoryStoreTool) Execute ¶
func (t *MemoryStoreTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*MemoryStoreTool) Name ¶
func (t *MemoryStoreTool) Name() string
func (*MemoryStoreTool) Schema ¶
func (t *MemoryStoreTool) Schema() map[string]interface{}
type MetricsRecorder ¶
type MetricsRecorder interface {
RecordToolExecution(toolName string, duration time.Duration, success bool, errorMsg string)
RecordToolMetric(toolName string, metricName string, value float64)
}
MetricsRecorder 指标记录器接口
type Middleware ¶
Middleware 中间件函数类型
func CacheMiddleware ¶
func CacheMiddleware(cache ToolCache, ttl time.Duration) Middleware
func ChainMiddlewares ¶
func ChainMiddlewares(middlewares ...Middleware) Middleware
ChainMiddlewares 将多个中间件链接成一个
func LoggingMiddleware ¶
func LoggingMiddleware(logger Logger) Middleware
func MetricsMiddleware ¶
func MetricsMiddleware(recorder MetricsRecorder) Middleware
func PanicRecoveryMiddleware ¶
func PanicRecoveryMiddleware() Middleware
func RateLimitMiddleware ¶
func RateLimitMiddleware(rate float64, burst int) Middleware
func RetryMiddleware ¶
func RetryMiddleware(opts ...RetryOptions) Middleware
func TimeoutMiddleware ¶
func TimeoutMiddleware(defaultTimeout time.Duration) Middleware
func ValidationMiddleware ¶
func ValidationMiddleware() Middleware
type ModalBackend ¶
type ModalBackend struct {
// contains filtered or unexported fields
}
ModalBackend executes commands via Modal (serverless GPU/CPUs)
func NewModalBackend ¶
func NewModalBackend() *ModalBackend
func (*ModalBackend) Configure ¶
func (b *ModalBackend) Configure(appName, volumePath, gpu string, memory int, cpu float64)
func (*ModalBackend) Description ¶
func (b *ModalBackend) Description() string
func (*ModalBackend) Execute ¶
func (b *ModalBackend) Execute(ctx context.Context, cmd string, workDir string, timeout time.Duration) (*ExecutionResult, error)
func (*ModalBackend) Health ¶
func (b *ModalBackend) Health() error
func (*ModalBackend) IsAvailable ¶
func (b *ModalBackend) IsAvailable() bool
func (*ModalBackend) Name ¶
func (b *ModalBackend) Name() string
func (*ModalBackend) SetGPU ¶
func (b *ModalBackend) SetGPU(gpu string)
func (*ModalBackend) SetMemory ¶
func (b *ModalBackend) SetMemory(memory int)
type MultipartWriter ¶ added in v0.3.0
type MultipartWriter struct {
// contains filtered or unexported fields
}
MultipartWriter multipart 写入器辅助结构
func NewMultipartWriter ¶ added in v0.3.0
func NewMultipartWriter(buffer *bytes.Buffer) *MultipartWriter
NewMultipartWriter 创建 multipart 写入器
func (*MultipartWriter) Close ¶ added in v0.3.0
func (m *MultipartWriter) Close() error
Close 完成 multipart 写入
func (*MultipartWriter) FormDataContentType ¶ added in v0.3.0
func (m *MultipartWriter) FormDataContentType() string
FormDataContentType 返回 Content-Type
func (*MultipartWriter) WriteField ¶ added in v0.3.0
func (m *MultipartWriter) WriteField(fieldname, value string) error
WriteField 写入表单字段
type ParamValidator ¶
ParamValidator 参数验证器接口
type PluginTool ¶
type PluginTool struct {
// contains filtered or unexported fields
}
PluginTool wraps a plugin command as a Tool that the agent can call. When the agent invokes this tool, it executes the plugin's entrypoint with the command name and arguments.
func NewPluginTool ¶
func NewPluginTool(pluginID, entrypoint string, command string, desc string, argNames []string) *PluginTool
NewPluginTool creates a tool from a plugin command spec
func (*PluginTool) Description ¶
func (t *PluginTool) Description() string
func (*PluginTool) Execute ¶
func (t *PluginTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
func (*PluginTool) Name ¶
func (t *PluginTool) Name() string
func (*PluginTool) Schema ¶
func (t *PluginTool) Schema() map[string]interface{}
type PluginToolLoader ¶
type PluginToolLoader struct {
// contains filtered or unexported fields
}
PluginToolLoader discovers plugins and creates PluginTool instances from their manifest commands.
func (*PluginToolLoader) DiscoverTools ¶
func (l *PluginToolLoader) DiscoverTools() []Tool
DiscoverTools scans the plugin directory and creates PluginTool instances for every command declared in every plugin manifest.
type PollTaskTool ¶
type PollTaskTool struct {
// contains filtered or unexported fields
}
PollTaskTool polls for sub-agent task results
func NewPollTaskTool ¶
func NewPollTaskTool(manager *subagent.Manager) *PollTaskTool
NewPollTaskTool creates a new poll task tool
func (*PollTaskTool) Description ¶
func (t *PollTaskTool) Description() string
func (*PollTaskTool) Execute ¶
func (t *PollTaskTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
Execute polls for task status
func (*PollTaskTool) Name ¶
func (t *PollTaskTool) Name() string
func (*PollTaskTool) Schema ¶
func (t *PollTaskTool) Schema() map[string]interface{}
type ProcessInfo ¶
type ProcessTool ¶
type ProcessTool struct {
// contains filtered or unexported fields
}
ProcessTool manages background processes
func NewProcessTool ¶
func NewProcessTool() *ProcessTool
func (*ProcessTool) Description ¶
func (t *ProcessTool) Description() string
func (*ProcessTool) Execute ¶
func (t *ProcessTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*ProcessTool) Name ¶
func (t *ProcessTool) Name() string
func (*ProcessTool) Schema ¶
func (t *ProcessTool) Schema() map[string]interface{}
type ProjectAnalyzeTool ¶ added in v0.3.0
type ProjectAnalyzeTool struct {
*BaseTool
}
ProjectAnalyzeTool provides project-level analysis capabilities for coding mode. It supports multiple actions: analyze_structure, analyze_dependencies, analyze_complexity, find_entry_points, and generate_summary.
func NewProjectAnalyzeTool ¶ added in v0.3.0
func NewProjectAnalyzeTool() *ProjectAnalyzeTool
NewProjectAnalyzeTool creates a new project analysis tool.
type ProjectSummary ¶ added in v0.3.0
type ProjectSummary struct {
ProjectType string `json:"project_type"`
RootDir string `json:"root_dir"`
VCS string `json:"vcs"`
Structure *StructureResult `json:"structure,omitempty"`
Dependencies *DependencyResult `json:"dependencies,omitempty"`
Complexity *ComplexityResult `json:"complexity,omitempty"`
EntryPoints *EntryPointResult `json:"entry_points,omitempty"`
}
ProjectSummary is a comprehensive project analysis report.
type ProjectType ¶ added in v0.3.0
type ProjectType string
ProjectType represents the detected project type
const ( ProjectTypeGo ProjectType = "go" ProjectTypeNode ProjectType = "node" ProjectTypeRust ProjectType = "rust" ProjectTypePython ProjectType = "python" ProjectTypeUnknown ProjectType = "unknown" )
func DetectProjectType ¶ added in v0.3.0
func DetectProjectType(dir string) ProjectType
DetectProjectType detects the project type based on files in the directory
type RandomTool ¶
type RandomTool struct {
BaseTool
}
func NewRandomTool ¶
func NewRandomTool() *RandomTool
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
func NewRateLimiter ¶
func NewRateLimiter() *RateLimiter
type ReadFileTool ¶
type ReadFileTool struct{}
func (*ReadFileTool) Description ¶
func (t *ReadFileTool) Description() string
func (*ReadFileTool) Execute ¶
func (t *ReadFileTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*ReadFileTool) Name ¶
func (t *ReadFileTool) Name() string
func (*ReadFileTool) Schema ¶
func (t *ReadFileTool) Schema() map[string]interface{}
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry 管理工具注册和执行
func (*Registry) Execute ¶
func (r *Registry) Execute(ctx context.Context, name string, args map[string]interface{}) (interface{}, error)
Execute 执行工具
func (*Registry) ExecuteSafe ¶
func (r *Registry) ExecuteSafe(ctx context.Context, name string, args map[string]interface{}) ToolExecutionResult
ExecuteSafe 安全执行工具,捕获所有错误
func (*Registry) ExecuteWithTimeout ¶
func (r *Registry) ExecuteWithTimeout(ctx context.Context, name string, args map[string]interface{}, timeout time.Duration) (interface{}, error)
ExecuteWithTimeout 执行工具并指定超时时间
func (*Registry) FilterToolsByKeyword ¶
FilterToolsByKeyword 按关键词过滤工具
func (*Registry) FilterToolsByPrefix ¶
FilterToolsByPrefix 按前缀过滤工具
func (*Registry) GetTimeout ¶
GetTimeout 获取工具的默认超时时间
func (*Registry) GetToolInfo ¶
GetToolInfo 获取工具信息
func (*Registry) ListWithSchemas ¶
ListWithSchemas 返回所有工具及其 Schema
func (*Registry) RegisterDynamic ¶
RegisterDynamic 注册一个动态工具(带 TTL)
func (*Registry) RegisterEmailTool ¶ added in v0.3.0
func (r *Registry) RegisterEmailTool(config *EmailConfig)
RegisterEmailTool 注册邮件发送工具(需要配置)
func (*Registry) RegisterImageGenTool ¶ added in v0.3.0
func (r *Registry) RegisterImageGenTool(config *ImageGenConfig)
RegisterImageGenTool 注册图片生成工具(带配置)
func (*Registry) RegisterOptionalTools ¶
func (r *Registry) RegisterOptionalTools()
RegisterOptionalTools registers tools that require external API configuration. These are not registered by default to avoid confusing the LLM with non-functional placeholder tools.
func (*Registry) RegisterOptionalToolsWithConfig ¶ added in v0.3.0
func (r *Registry) RegisterOptionalToolsWithConfig(imageGenConfig *ImageGenConfig)
RegisterOptionalToolsWithConfig 使用配置注册可选工具
func (*Registry) RegisterSMSTool ¶ added in v0.3.0
RegisterSMSTool 注册短信发送工具(需要配置)
func (*Registry) RegisterSkillTool ¶
func (r *Registry) RegisterSkillTool(provider SkillInfoProvider)
RegisterSkillTool 注册技能工具(带 SkillInfoProvider)
func (*Registry) RegisterWithNotificationConfig ¶ added in v0.3.0
func (r *Registry) RegisterWithNotificationConfig(workDir string, emailConfig *EmailConfig, smsConfig *SMSConfig)
RegisterWithNotificationConfig 注册所有工具,包括邮件和短信工具
func (*Registry) RegisterWithSkillManager ¶
func (r *Registry) RegisterWithSkillManager(skillManager SkillInfoProvider, workDir string)
RegisterWithSkillManager 注册所有工具,包括技能工具
func (*Registry) SetTimeout ¶
SetTimeout 设置工具的默认超时时间
type RegistryWithConfig ¶ added in v0.3.0
type RegistryWithConfig struct {
*Registry
// contains filtered or unexported fields
}
RegistryWithConfig 带配置的工具注册表
type RetryOptions ¶
type SMSConfig ¶ added in v0.3.0
type SMSConfig struct {
Provider string `json:"provider" yaml:"provider"` // 提供商: twilio, aliyun, tencent
// Twilio 配置
Twilio TwilioConfig `json:"twilio" yaml:"twilio"`
// 阿里云短信配置
Aliyun AliyunSMSConfig `json:"aliyun" yaml:"aliyun"`
// 腾讯云短信配置
Tencent TencentSMSConfig `json:"tencent" yaml:"tencent"`
}
SMSConfig 短信服务配置
type SMSMessage ¶ added in v0.3.0
type SMSMessage struct {
To string `json:"to"` // 接收号码
TemplateCode string `json:"template_code"` // 模板代码
TemplateData map[string]string `json:"template_data"` // 模板参数
Content string `json:"content"` // 直接发送内容(Twilio 使用)
}
SMSMessage 短信消息
type SMSProvider ¶ added in v0.3.0
type SMSProvider interface {
Send(ctx context.Context, msg *SMSMessage) error
Name() string
}
SMSProvider 短信提供商接口
type SMSTool ¶ added in v0.3.0
type SMSTool struct {
// contains filtered or unexported fields
}
SMSTool 短信发送工具
func (*SMSTool) Description ¶ added in v0.3.0
Description 返回工具描述
type SSHBackend ¶
type SSHBackend struct {
// contains filtered or unexported fields
}
SSHBackend executes commands over SSH
func NewSSHBackend ¶
func NewSSHBackend() *SSHBackend
func (*SSHBackend) Configure ¶
func (b *SSHBackend) Configure(host, user, keyPath, password string, port int)
func (*SSHBackend) Description ¶
func (b *SSHBackend) Description() string
func (*SSHBackend) Execute ¶
func (b *SSHBackend) Execute(ctx context.Context, cmd string, workDir string, timeout time.Duration) (*ExecutionResult, error)
func (*SSHBackend) Health ¶
func (b *SSHBackend) Health() error
func (*SSHBackend) IsAvailable ¶
func (b *SSHBackend) IsAvailable() bool
func (*SSHBackend) Name ¶
func (b *SSHBackend) Name() string
type SearchInFilesTool ¶
type SearchInFilesTool struct{}
func (*SearchInFilesTool) Description ¶
func (t *SearchInFilesTool) Description() string
func (*SearchInFilesTool) Execute ¶
func (t *SearchInFilesTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*SearchInFilesTool) Name ¶
func (t *SearchInFilesTool) Name() string
func (*SearchInFilesTool) Schema ¶
func (t *SearchInFilesTool) Schema() map[string]interface{}
type SearchResult ¶
type SearchResult struct {
Pattern string `json:"pattern"`
Path string `json:"path"`
TotalFiles int `json:"total_files"`
TotalMatches int `json:"total_matches"`
Matches []Match `json:"matches"`
}
SearchResult 搜索结果
type SendMessageRequest ¶ added in v0.3.1
type SendMessageRequest struct {
Platform string `json:"platform"` // "telegram", "discord", "slack", "all"
ChannelID string `json:"channel_id"` // Channel or user ID to send to
Content string `json:"content"` // Message content
Broadcast bool `json:"broadcast"` // If true, send to all connected users
}
SendMessageRequest represents a request to send a message
type SendMessageResult ¶ added in v0.3.1
type SendMessageResult struct {
Success bool `json:"success"`
Platform string `json:"platform"`
ChannelID string `json:"channel_id,omitempty"`
Content string `json:"content"`
Error string `json:"error,omitempty"`
}
SendMessageResult represents the result of sending a message
type SendMessageTool ¶ added in v0.3.1
type SendMessageTool struct {
BaseTool
// contains filtered or unexported fields
}
SendMessageTool allows the agent to send messages to any connected gateway platform This enables the agent to proactively communicate with users across Telegram, Discord, Slack, etc.
func NewSendMessageTool ¶ added in v0.3.1
func NewSendMessageTool(gateway GatewaySender) *SendMessageTool
NewSendMessageTool creates a new send message tool
func (*SendMessageTool) Execute ¶ added in v0.3.1
func (t *SendMessageTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
Execute sends a message through the gateway
func (*SendMessageTool) GetConnectedPlatforms ¶ added in v0.3.1
func (t *SendMessageTool) GetConnectedPlatforms() []string
GetConnectedPlatforms returns list of connected platforms
func (*SendMessageTool) SetGateway ¶ added in v0.3.1
func (t *SendMessageTool) SetGateway(gateway GatewaySender)
SetGateway updates the gateway sender (for late binding)
type SessionSearchTool ¶
type SessionSearchTool struct {
// contains filtered or unexported fields
}
SessionSearchTool searches through past conversation sessions
func GetSessionSearchTool ¶
func GetSessionSearchTool() *SessionSearchTool
GetSessionSearchTool creates a new session search tool
func (*SessionSearchTool) Description ¶
func (t *SessionSearchTool) Description() string
Description returns the tool description
func (*SessionSearchTool) Execute ¶
func (t *SessionSearchTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
Execute performs the session search
func (*SessionSearchTool) Name ¶
func (t *SessionSearchTool) Name() string
Name returns the tool name
func (*SessionSearchTool) Parameters ¶
func (t *SessionSearchTool) Parameters() map[string]interface{}
func (*SessionSearchTool) Schema ¶
func (t *SessionSearchTool) Schema() map[string]interface{}
Parameters returns the tool parameters schema
type SingularityBackend ¶
type SingularityBackend struct {
// contains filtered or unexported fields
}
SingularityBackend executes commands in Singularity containers
func NewSingularityBackend ¶
func NewSingularityBackend() *SingularityBackend
func (*SingularityBackend) Configure ¶
func (b *SingularityBackend) Configure(imagePath string, bindPaths []string, overlayPath string)
func (*SingularityBackend) Description ¶
func (b *SingularityBackend) Description() string
func (*SingularityBackend) Execute ¶
func (b *SingularityBackend) Execute(ctx context.Context, cmd string, workDir string, timeout time.Duration) (*ExecutionResult, error)
func (*SingularityBackend) Health ¶
func (b *SingularityBackend) Health() error
func (*SingularityBackend) IsAvailable ¶
func (b *SingularityBackend) IsAvailable() bool
func (*SingularityBackend) Name ¶
func (b *SingularityBackend) Name() string
func (*SingularityBackend) SetContain ¶
func (b *SingularityBackend) SetContain(contain bool)
type SkillData ¶
type SkillData map[string]interface{}
SkillData represents skill data as a map to avoid circular imports
type SkillInfoProvider ¶
type SkillInfoProvider interface {
ListSkills() []string
GetSkillInfo(name string) (description string, tools []string, content string, err error)
}
SkillInfoProvider 技能信息提供者接口(用于解耦循环依赖)
type SkillInvokeTool ¶
type SkillInvokeTool struct {
BaseTool
// contains filtered or unexported fields
}
SkillInvokeTool 技能调用工具
func NewSkillInvokeTool ¶
func NewSkillInvokeTool(provider SkillInfoProvider) *SkillInvokeTool
NewSkillInvokeTool 创建技能调用工具
func (*SkillInvokeTool) Execute ¶
func (t *SkillInvokeTool) Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
Execute 执行技能调用
func (*SkillInvokeTool) ValidateParams ¶
func (t *SkillInvokeTool) ValidateParams(params map[string]interface{}) error
ValidateParams 实现 ParamValidator 接口
type SkillListTool ¶
type SkillListTool struct {
*BaseTool
// contains filtered or unexported fields
}
SkillListTool lists all available skills
func NewSkillListTool ¶
func NewSkillListTool() *SkillListTool
NewSkillListTool creates a new skill list tool
func (*SkillListTool) Execute ¶
func (t *SkillListTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
Execute lists all skills
func (*SkillListTool) MarshalJSON ¶
func (t *SkillListTool) MarshalJSON() ([]byte, error)
MarshalJSON for SkillListTool
func (*SkillListTool) SetManager ¶
func (t *SkillListTool) SetManager(mgr SkillsManager)
SetManager sets the skills manager
type SkillManageTool ¶
type SkillManageTool struct {
*BaseTool
// contains filtered or unexported fields
}
SkillManageTool allows creating, updating, and deleting skills
func NewSkillManageTool ¶
func NewSkillManageTool() *SkillManageTool
NewSkillManageTool creates a new skill manage tool
func (*SkillManageTool) Execute ¶
func (t *SkillManageTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
Execute manages skills
func (*SkillManageTool) MarshalJSON ¶
func (t *SkillManageTool) MarshalJSON() ([]byte, error)
MarshalJSON for SkillManageTool
func (*SkillManageTool) SetManager ¶
func (t *SkillManageTool) SetManager(mgr SkillsManager)
SetManager sets the skills manager
type SkillViewTool ¶
type SkillViewTool struct {
*BaseTool
// contains filtered or unexported fields
}
SkillViewTool shows detailed information about a skill
func NewSkillViewTool ¶
func NewSkillViewTool() *SkillViewTool
NewSkillViewTool creates a new skill view tool
func (*SkillViewTool) Execute ¶
func (t *SkillViewTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
Execute returns skill information
func (*SkillViewTool) MarshalJSON ¶
func (t *SkillViewTool) MarshalJSON() ([]byte, error)
MarshalJSON for SkillViewTool
func (*SkillViewTool) SetManager ¶
func (t *SkillViewTool) SetManager(mgr SkillsManager)
SetManager sets the skills manager
type SkillsManager ¶
type SkillsManager interface {
List() map[string]SkillData
Get(name string) (SkillData, error)
GetCategories() []string
GetSkillDir(name string) (string, error)
Create(name, description, content, category string, tags []string) (SkillData, error)
Update(name, content string) error
Delete(name string) error
}
SkillsManager interface for skills manager
type StackFrame ¶ added in v0.3.0
type StackFrame struct {
Function string `json:"function"`
File string `json:"file"`
Line int `json:"line"`
}
StackFrame represents a single frame in a stack trace
type StringTool ¶
type StringTool struct {
BaseTool
}
func NewStringTool ¶
func NewStringTool() *StringTool
type StructureResult ¶ added in v0.3.0
type StructureResult struct {
ProjectType string `json:"project_type"`
RootDir string `json:"root_dir"`
TopLevelDirs []string `json:"top_level_dirs"`
TopLevelFiles []string `json:"top_level_files"`
KeyFiles []string `json:"key_files"`
TestDirs []string `json:"test_dirs"`
ConfigFiles []string `json:"config_files"`
DependencyInfo string `json:"dependency_info"`
VCS string `json:"vcs"`
BuildFiles []string `json:"build_files"`
}
StructureResult holds the output of project structure analysis.
type SuggestFixTool ¶ added in v0.3.0
type SuggestFixTool struct {
*BaseTool
}
SuggestFixTool suggests fixes for errors
func NewSuggestFixTool ¶ added in v0.3.0
func NewSuggestFixTool() *SuggestFixTool
NewSuggestFixTool creates a new suggest fix tool
type SystemInfoTool ¶
type SystemInfoTool struct {
BaseTool
}
func NewSystemInfoTool ¶
func NewSystemInfoTool() *SystemInfoTool
type TTLCache ¶
type TTLCache struct {
// contains filtered or unexported fields
}
func NewTTLCache ¶
type TTSAvailableVoicesTool ¶ added in v0.3.0
type TTSAvailableVoicesTool struct {
BaseTool
}
TTSAvailableVoicesTool 获取可用的 TTS 声音工具
func NewTTSAvailableVoicesTool ¶ added in v0.3.0
func NewTTSAvailableVoicesTool() *TTSAvailableVoicesTool
NewTTSAvailableVoicesTool 创建 TTS 可用声音工具
type TTSTool ¶
type TTSTool struct {
BaseTool
// contains filtered or unexported fields
}
TTSTool 文字转语音工具
func (*TTSTool) SetManager ¶ added in v0.3.0
SetManager sets the voice manager for the tool
func (*TTSTool) ValidateParams ¶
ValidateParams 验证参数
type TencentProvider ¶ added in v0.3.0
type TencentProvider struct {
// contains filtered or unexported fields
}
TencentProvider 腾讯云短信提供商
func NewTencentProvider ¶ added in v0.3.0
func NewTencentProvider(config *TencentSMSConfig) *TencentProvider
NewTencentProvider 创建腾讯云短信提供商
func (*TencentProvider) Send ¶ added in v0.3.0
func (p *TencentProvider) Send(ctx context.Context, msg *SMSMessage) error
Send 发送短信
type TencentSMSConfig ¶ added in v0.3.0
type TencentSMSConfig struct {
SecretID string `json:"secret_id" yaml:"secret_id"` // Secret ID
SecretKey string `json:"secret_key" yaml:"secret_key"` // Secret Key
SDKAppID string `json:"sdk_app_id" yaml:"sdk_app_id"` // SDK App ID
SignName string `json:"sign_name" yaml:"sign_name"` // 短信签名
Endpoint string `json:"endpoint" yaml:"endpoint"` // API 端点
}
TencentSMSConfig 腾讯云短信配置
type TerminalBackend ¶
type TerminalBackend interface {
// Name returns the backend name
Name() string
// Description returns the backend description
Description() string
// Execute runs a command in the backend
Execute(ctx context.Context, cmd string, workDir string, timeout time.Duration) (*ExecutionResult, error)
// IsAvailable checks if the backend is available
IsAvailable() bool
// Health checks the backend health
Health() error
}
TerminalBackend defines the interface for different terminal execution backends
type TerminalTool ¶
type TerminalTool struct {
// contains filtered or unexported fields
}
TerminalTool provides enhanced terminal execution with backend support
func NewTerminalTool ¶
func NewTerminalTool() *TerminalTool
func (*TerminalTool) Description ¶
func (t *TerminalTool) Description() string
func (*TerminalTool) Execute ¶
func (t *TerminalTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*TerminalTool) Name ¶
func (t *TerminalTool) Name() string
func (*TerminalTool) Schema ¶
func (t *TerminalTool) Schema() map[string]interface{}
type TodoItem ¶
type TodoItem struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Status string `json:"status"` // pending, in_progress, completed, cancelled
Priority string `json:"priority,omitempty"` // low, medium, high
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
}
TodoItem represents a single todo item
type TodoTool ¶
type TodoTool struct {
// contains filtered or unexported fields
}
TodoTool manages todo items
func (*TodoTool) Description ¶
Description returns the tool description
func (*TodoTool) Parameters ¶
type Tool ¶
type Tool interface {
// Name 返回工具名称
Name() string
// Description 返回工具描述
Description() string
// Schema 返回 OpenAI function calling 格式的 JSON Schema
Schema() map[string]interface{}
// Execute 执行工具,返回结果或错误
Execute(ctx context.Context, params map[string]interface{}) (interface{}, error)
}
Tool 定义所有工具的统一接口(参考 PicoClaw 设计)
func GetEnabledTools ¶
GetEnabledTools returns tools based on enabled toolsets
type ToolCache ¶
type ToolCache interface {
// Get 获取缓存结果
Get(key string) (*ToolResult, bool)
// Set 设置缓存结果
Set(key string, result *ToolResult, ttl time.Duration)
// Delete 删除缓存
Delete(key string)
// Clear 清空缓存
Clear()
// Size 返回缓存条目数
Size() int
}
ToolCache 工具结果缓存接口
type ToolContext ¶
type ToolContext struct {
context.Context
SessionID string // 会话ID
UserID string // 用户ID
RequestID string // 请求ID
ToolName string // 当前工具名称
Metadata map[string]any // 元数据
Logger Logger // 日志器
Metrics MetricsRecorder // 指标记录器
StartTime time.Time // 开始时间
}
ToolContext 工具执行上下文,扩展标准 context.Context
func FromContext ¶
func FromContext(ctx context.Context) *ToolContext
FromContext 从 context.Context 获取 ToolContext
func NewToolContext ¶
func NewToolContext(parent context.Context) *ToolContext
NewToolContext 创建工具上下文
func (*ToolContext) GetMetadata ¶
func (tc *ToolContext) GetMetadata(key string) (any, bool)
GetMetadata 获取元数据
func (*ToolContext) SetMetadata ¶
func (tc *ToolContext) SetMetadata(key string, value any)
SetMetadata 设置元数据
func (*ToolContext) ToContext ¶
func (tc *ToolContext) ToContext() context.Context
ToContext 将 ToolContext 转为标准 context.Context
func (*ToolContext) WithLogger ¶
func (tc *ToolContext) WithLogger(logger Logger) *ToolContext
WithLogger 设置日志器
func (*ToolContext) WithMetrics ¶
func (tc *ToolContext) WithMetrics(metrics MetricsRecorder) *ToolContext
WithMetrics 设置指标记录器
func (*ToolContext) WithRequest ¶
func (tc *ToolContext) WithRequest(requestID string) *ToolContext
WithRequest 设置请求ID
func (*ToolContext) WithSession ¶
func (tc *ToolContext) WithSession(sessionID string) *ToolContext
WithSession 设置会话ID
func (*ToolContext) WithTool ¶
func (tc *ToolContext) WithTool(toolName string) *ToolContext
WithTool 设置工具名称
func (*ToolContext) WithUser ¶
func (tc *ToolContext) WithUser(userID string) *ToolContext
WithUser 设置用户ID
type ToolExecutionResult ¶
type ToolExecutionResult struct {
ToolName string
Params map[string]interface{}
Result interface{}
Error error
Duration time.Duration
Recovered bool // 是否从 panic 中恢复
}
ToolExecutionResult 工具执行结果
type ToolExecutor ¶
type ToolExecutor interface {
ExecuteWithProtection(ctx context.Context, tool Tool, params map[string]interface{}, timeout time.Duration) ToolExecutionResult
}
ToolExecutor 工具执行器接口
type ToolGroup ¶
type ToolGroup struct {
Name string // 分组名称
Description string // 分组描述
Tools []Tool // 分组中的工具
Enabled bool // 是否启用
Metadata map[string]any // 分组元数据
}
ToolGroup 工具分组
type ToolInfo ¶
type ToolInfo struct {
Name string `json:"name"`
Description string `json:"description"`
Schema map[string]interface{} `json:"schema"`
}
ToolInfo 工具信息
type ToolResult ¶
type ToolResult struct {
Success bool // 是否成功
Data any // 结果数据
Error string // 错误信息
ErrorCode string // 错误码
Metadata map[string]any // 执行元数据
Duration time.Duration // 执行耗时
Warnings []string // 警告信息
}
ToolResult 标准化工具执行结果
func NewErrorResultWithCode ¶
func NewErrorResultWithCode(err string, code string) *ToolResult
NewErrorResultWithCode 创建带错误码的结果
func (*ToolResult) AddWarning ¶
func (r *ToolResult) AddWarning(warning string) *ToolResult
AddWarning 添加警告
func (*ToolResult) WithDuration ¶
func (r *ToolResult) WithDuration(d time.Duration) *ToolResult
WithDuration 设置执行耗时
func (*ToolResult) WithMetadata ¶
func (r *ToolResult) WithMetadata(key string, value any) *ToolResult
WithMetadata 添加元数据
type ToolSchema ¶
type ToolSchema struct{}
ToolSchema 工具 Schema 转换工具
func (*ToolSchema) ToOpenAISchema ¶
func (ts *ToolSchema) ToOpenAISchema(tool Tool) map[string]interface{}
ToOpenAISchema 将工具转换为 OpenAI function calling 格式
func (*ToolSchema) ToOpenAISchemas ¶
func (ts *ToolSchema) ToOpenAISchemas(tools []Tool) []map[string]interface{}
ToOpenAISchemas 批量转换工具为 OpenAI 格式
type ToolsetDefinition ¶
type ToolsetDefinition struct {
Name string `json:"name"`
Description string `json:"description"`
Tools []string `json:"tools"`
Includes []string `json:"includes"` // Include other toolsets
}
ToolsetDefinition defines a named group of tools
func GetToolset ¶
func GetToolset(name string) *ToolsetDefinition
GetToolset returns a toolset by name
type TraceExecutionTool ¶ added in v0.3.0
type TraceExecutionTool struct {
*BaseTool
}
TraceExecutionTool traces code execution
func NewTraceExecutionTool ¶ added in v0.3.0
func NewTraceExecutionTool() *TraceExecutionTool
NewTraceExecutionTool creates a new trace execution tool
type TwilioConfig ¶ added in v0.3.0
type TwilioConfig struct {
AccountSID string `json:"account_sid" yaml:"account_sid"` // Account SID
AuthToken string `json:"auth_token" yaml:"auth_token"` // Auth Token
FromNumber string `json:"from_number" yaml:"from_number"` // 发件人号码
}
TwilioConfig Twilio 配置
type TwilioProvider ¶ added in v0.3.0
type TwilioProvider struct {
// contains filtered or unexported fields
}
TwilioProvider Twilio 短信提供商
func NewTwilioProvider ¶ added in v0.3.0
func NewTwilioProvider(config *TwilioConfig) *TwilioProvider
NewTwilioProvider 创建 Twilio 提供商
func (*TwilioProvider) Send ¶ added in v0.3.0
func (p *TwilioProvider) Send(ctx context.Context, msg *SMSMessage) error
Send 发送短信
type VideoAnalyzeTool ¶
type VideoAnalyzeTool struct {
BaseTool
}
VideoAnalyzeTool 视频理解工具
func NewVideoAnalyzeTool ¶
func NewVideoAnalyzeTool() *VideoAnalyzeTool
NewVideoAnalyzeTool 创建视频理解工具
type VideoGenConfig ¶ added in v0.3.1
type VideoGenConfig struct {
Provider string `json:"provider"` // "replicate", "fal", "stability", "local"
APIKey string `json:"api_key"`
Model string `json:"model"` // e.g., "stable-video-diffusion", "animate-diff"
DefaultDuration int `json:"default_duration"` // seconds
OutputDir string `json:"output_dir"`
}
VideoGenConfig holds configuration for video generation
type VideoGenRequest ¶ added in v0.3.1
type VideoGenRequest struct {
Prompt string `json:"prompt"`
ImageURL string `json:"image_url,omitempty"` // optional: image-to-video
Duration int `json:"duration,omitempty"` // seconds
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
FPS int `json:"fps,omitempty"`
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
}
VideoGenRequest represents a video generation request
type VideoGenResult ¶ added in v0.3.1
type VideoGenResult struct {
Success bool `json:"success"`
VideoPath string `json:"video_path,omitempty"`
VideoURL string `json:"video_url,omitempty"`
Duration int `json:"duration"`
Width int `json:"width"`
Height int `json:"height"`
FPS int `json:"fps"`
Provider string `json:"provider"`
Model string `json:"model"`
Error string `json:"error,omitempty"`
}
VideoGenResult represents the result of video generation
type VideoGenerateTool ¶ added in v0.3.1
type VideoGenerateTool struct {
BaseTool
// contains filtered or unexported fields
}
VideoGenerateTool generates videos using pluggable provider backends
func NewVideoGenerateTool ¶ added in v0.3.1
func NewVideoGenerateTool(config *VideoGenConfig) *VideoGenerateTool
NewVideoGenerateTool creates a new video generation tool
type WebExtractTool ¶
type WebExtractTool struct{}
func (*WebExtractTool) Description ¶
func (t *WebExtractTool) Description() string
func (*WebExtractTool) Execute ¶
func (t *WebExtractTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*WebExtractTool) Name ¶
func (t *WebExtractTool) Name() string
func (*WebExtractTool) Schema ¶
func (t *WebExtractTool) Schema() map[string]interface{}
type WebFetchTool ¶
type WebFetchTool struct{}
WebFetchTool fetches and parses web pages using goquery
func NewWebFetchTool ¶
func NewWebFetchTool() *WebFetchTool
NewWebFetchTool creates a new web fetch tool
func (*WebFetchTool) Description ¶
func (t *WebFetchTool) Description() string
func (*WebFetchTool) Execute ¶
func (t *WebFetchTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*WebFetchTool) Name ¶
func (t *WebFetchTool) Name() string
func (*WebFetchTool) Schema ¶
func (t *WebFetchTool) Schema() map[string]interface{}
type WebSearchResult ¶
type WebSearchResult struct {
Title string `json:"title"`
URL string `json:"url"`
Snippet string `json:"snippet"`
}
WebSearchResult represents a search result
type WebSearchTool ¶
type WebSearchTool struct{}
WebSearchTool provides web search capabilities with China-friendly engines
func (*WebSearchTool) Description ¶
func (t *WebSearchTool) Description() string
func (*WebSearchTool) Execute ¶
func (t *WebSearchTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*WebSearchTool) Name ¶
func (t *WebSearchTool) Name() string
func (*WebSearchTool) Parameters ¶
func (t *WebSearchTool) Parameters() map[string]interface{}
func (*WebSearchTool) Schema ¶
func (t *WebSearchTool) Schema() map[string]interface{}
type WebSelectTool ¶
type WebSelectTool struct{}
WebSelectTool extracts specific elements from web pages
func NewWebSelectTool ¶
func NewWebSelectTool() *WebSelectTool
NewWebSelectTool creates a new web select tool
func (*WebSelectTool) Description ¶
func (t *WebSelectTool) Description() string
func (*WebSelectTool) Execute ¶
func (t *WebSelectTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*WebSelectTool) Name ¶
func (t *WebSelectTool) Name() string
func (*WebSelectTool) Schema ¶
func (t *WebSelectTool) Schema() map[string]interface{}
type WriteFileTool ¶
type WriteFileTool struct{}
func (*WriteFileTool) Description ¶
func (t *WriteFileTool) Description() string
func (*WriteFileTool) Execute ¶
func (t *WriteFileTool) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)
func (*WriteFileTool) Name ¶
func (t *WriteFileTool) Name() string
func (*WriteFileTool) Schema ¶
func (t *WriteFileTool) Schema() map[string]interface{}
type XSearchRequest ¶ added in v0.3.1
type XSearchRequest struct {
Query string `json:"query"`
MaxResults int `json:"max_results"`
Type string `json:"type"` // "latest", "top", "users"
}
XSearchRequest represents an X search request
type XSearchResponse ¶ added in v0.3.1
type XSearchResponse struct {
Results []XSearchResult `json:"results"`
TotalCount int `json:"total_count"`
Query string `json:"query"`
}
XSearchResponse is the response from X search
type XSearchResult ¶ added in v0.3.1
type XSearchResult struct {
ID string `json:"id"`
Author string `json:"author"`
AuthorID string `json:"author_id"`
Text string `json:"text"`
Likes int `json:"likes"`
Retweets int `json:"retweets"`
Replies int `json:"replies"`
CreatedAt string `json:"created_at"`
URL string `json:"url"`
}
XSearchResult represents a single X post
type XSearchTool ¶ added in v0.3.1
type XSearchTool struct {
BaseTool
// contains filtered or unexported fields
}
XSearchTool searches X (Twitter) for posts, threads, and trends
func NewXSearchTool ¶ added in v0.3.1
func NewXSearchTool(apiKey, bearerToken string) *XSearchTool
NewXSearchTool creates a new X search tool
Source Files
¶
- asr_tool.go
- async.go
- base.go
- batch_file_tool.go
- browser.go
- browser_tools.go
- cache.go
- clarify_tool.go
- context.go
- cronjob_tool.go
- debug_tools.go
- delegate_tools.go
- diff_tool.go
- directory_tree_tool.go
- docs.go
- email_tool.go
- env_tool.go
- execute_code_tool.go
- execute_tool.go
- file_edit_tool.go
- file_search_tool.go
- file_tools.go
- gitignore_tool.go
- group.go
- ha_tools.go
- image_gen_tool.go
- interrupt_tool.go
- json_tool.go
- kanban_tools.go
- lint.go
- lsp_tool.go
- math_tool.go
- memory_tools.go
- middleware.go
- plugin_exec.go
- plugin_tool.go
- plugin_tool_loader.go
- project_tool.go
- registry.go
- result.go
- send_message_tool.go
- session_search.go
- skill_invoke_tool.go
- skill_tools.go
- sms_tool.go
- string_tool.go
- terminal_backend.go
- todo_tool.go
- toolset.go
- tts_tool.go
- video_analyze.go
- video_xsearch_computer.go
- web_tools.go