tools

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 45 Imported by: 1

Documentation

Index

Constants

View Source
const MaxReadFileSize = 64 * 1024 // 64KB limit to avoid context overflow
View Source
const (
	MaxRegexPatternLength = 200
)

Variables

View Source
var (
	ErrSessionNotFound = errors.New("session not found")
	ErrSessionDone     = errors.New("session already completed")
	ErrPTYNotSupported = errors.New("PTY is not supported on this platform")
	ErrNoStdin         = errors.New("no stdin available")
)

Functions

func ToolChannel added in v0.2.1

func ToolChannel(ctx context.Context) string

ToolChannel extracts the channel from ctx, or "" if unset.

func ToolChatID added in v0.2.1

func ToolChatID(ctx context.Context) string

ToolChatID extracts the chatID from ctx, or "" if unset.

func ToolMessageID added in v0.2.5

func ToolMessageID(ctx context.Context) string

ToolMessageID extracts the current inbound message ID from ctx, or "" if unset.

func ToolReplyToMessageID added in v0.2.5

func ToolReplyToMessageID(ctx context.Context) string

ToolReplyToMessageID extracts the current inbound reply target from ctx, or "" if unset.

func ToolToSchema

func ToolToSchema(tool Tool) map[string]any

func WithToolContext added in v0.2.1

func WithToolContext(ctx context.Context, channel, chatID string) context.Context

WithToolContext returns a child context carrying channel and chatID.

func WithToolInboundContext added in v0.2.5

func WithToolInboundContext(
	ctx context.Context,
	channel, chatID, messageID, replyToMessageID string,
) context.Context

WithToolInboundContext returns a child context carrying channel/chat and inbound IDs.

func WithToolMessageContext added in v0.2.5

func WithToolMessageContext(ctx context.Context, messageID, replyToMessageID string) context.Context

WithToolMessageContext returns a child context carrying inbound message IDs.

Types

type APIKeyIterator added in v0.2.2

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

func (*APIKeyIterator) Next added in v0.2.2

func (it *APIKeyIterator) Next() (string, bool)

type APIKeyPool added in v0.2.2

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

func NewAPIKeyPool added in v0.2.2

func NewAPIKeyPool(keys []string) *APIKeyPool

func (*APIKeyPool) NewIterator added in v0.2.2

func (p *APIKeyPool) NewIterator() *APIKeyIterator

type AppendFileTool

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

func NewAppendFileTool

func NewAppendFileTool(workspace string, restrict bool, allowPaths ...[]*regexp.Regexp) *AppendFileTool

func (*AppendFileTool) Description

func (t *AppendFileTool) Description() string

func (*AppendFileTool) Execute

func (t *AppendFileTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*AppendFileTool) Name

func (t *AppendFileTool) Name() string

func (*AppendFileTool) Parameters

func (t *AppendFileTool) Parameters() map[string]any

type AsyncCallback added in v0.1.2

type AsyncCallback func(ctx context.Context, result *ToolResult)

AsyncCallback is a function type that async tools use to notify completion. When an async tool finishes its work, it calls this callback with the result.

The ctx parameter allows the callback to be canceled if the agent is shutting down. The result parameter contains the tool's execution result.

type AsyncExecutor added in v0.2.1

type AsyncExecutor interface {
	Tool
	// ExecuteAsync runs the tool asynchronously. The callback cb will be
	// invoked (possibly from another goroutine) when the async operation
	// completes. cb is guaranteed to be non-nil by the caller (registry).
	ExecuteAsync(ctx context.Context, args map[string]any, cb AsyncCallback) *ToolResult
}

AsyncExecutor is an optional interface that tools can implement to support asynchronous execution with completion callbacks.

Unlike the old AsyncTool pattern (SetCallback + Execute), AsyncExecutor receives the callback as a parameter of ExecuteAsync. This eliminates the data race where concurrent calls could overwrite each other's callbacks on a shared tool instance.

This is useful for:

  • Long-running operations that shouldn't block the agent loop
  • Subagent spawns that complete independently
  • Background tasks that need to report results later

Example:

func (t *SpawnTool) ExecuteAsync(ctx context.Context, args map[string]any, cb AsyncCallback) *ToolResult {
    go func() {
        result := t.runSubagent(ctx, args)
        if cb != nil { cb(ctx, result) }
    }()
    return AsyncResult("Subagent spawned, will report back")
}

type BM25SearchTool added in v0.2.2

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

func NewBM25SearchTool added in v0.2.2

func NewBM25SearchTool(r *ToolRegistry, ttl int, maxSearchResults int) *BM25SearchTool

func (*BM25SearchTool) Description added in v0.2.2

func (t *BM25SearchTool) Description() string

func (*BM25SearchTool) Execute added in v0.2.2

func (t *BM25SearchTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*BM25SearchTool) Name added in v0.2.2

func (t *BM25SearchTool) Name() string

func (*BM25SearchTool) Parameters added in v0.2.2

func (t *BM25SearchTool) Parameters() map[string]any

type BaiduSearchProvider added in v0.2.4

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

func (*BaiduSearchProvider) Search added in v0.2.4

func (p *BaiduSearchProvider) Search(
	ctx context.Context,
	query string,
	count int,
	rangeCode string,
) (string, error)

type BraveSearchProvider added in v0.1.2

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

func (*BraveSearchProvider) Search added in v0.1.2

func (p *BraveSearchProvider) Search(
	ctx context.Context,
	query string,
	count int,
	rangeCode string,
) (string, error)

type CronTool added in v0.1.1

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

CronTool provides scheduling capabilities for the agent

func NewCronTool added in v0.1.1

func NewCronTool(
	cronService *cron.CronService, executor JobExecutor, msgBus *bus.MessageBus, workspace string, restrict bool,
	execTimeout time.Duration, config *config.Config,
) (*CronTool, error)

NewCronTool creates a new CronTool execTimeout: 0 means no timeout, >0 sets the timeout duration

func (*CronTool) Description added in v0.1.1

func (t *CronTool) Description() string

Description returns the tool description

func (*CronTool) Execute added in v0.1.1

func (t *CronTool) Execute(ctx context.Context, args map[string]any) *ToolResult

Execute runs the tool with the given arguments

func (*CronTool) ExecuteJob added in v0.1.1

func (t *CronTool) ExecuteJob(ctx context.Context, job *cron.CronJob) string

ExecuteJob executes a cron job through the agent

func (*CronTool) Name added in v0.1.1

func (t *CronTool) Name() string

Name returns the tool name

func (*CronTool) Parameters added in v0.1.1

func (t *CronTool) Parameters() map[string]any

Parameters returns the tool parameters schema

type DuckDuckGoSearchProvider added in v0.1.2

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

func (*DuckDuckGoSearchProvider) Search added in v0.1.2

func (p *DuckDuckGoSearchProvider) Search(
	ctx context.Context,
	query string,
	count int,
	rangeCode string,
) (string, error)

type EditFileTool

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

EditFileTool edits a file by replacing old_text with new_text. The old_text must exist exactly in the file.

func NewEditFileTool

func NewEditFileTool(workspace string, restrict bool, allowPaths ...[]*regexp.Regexp) *EditFileTool

NewEditFileTool creates a new EditFileTool with optional directory restriction.

func (*EditFileTool) Description

func (t *EditFileTool) Description() string

func (*EditFileTool) Execute

func (t *EditFileTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*EditFileTool) Name

func (t *EditFileTool) Name() string

func (*EditFileTool) Parameters

func (t *EditFileTool) Parameters() map[string]any

type ExecRequest added in v0.2.5

type ExecRequest struct {
	Action     string            `json:"action"`
	Command    string            `json:"command,omitempty"`
	PTY        bool              `json:"pty,omitempty"`
	Background bool              `json:"background,omitempty"`
	Timeout    int               `json:"timeout,omitempty"`
	Env        map[string]string `json:"env,omitempty"`
	Cwd        string            `json:"cwd,omitempty"`
	SessionID  string            `json:"sessionId,omitempty"`
	Data       string            `json:"data,omitempty"`
}

type ExecResponse added in v0.2.5

type ExecResponse struct {
	SessionID string        `json:"sessionId,omitempty"`
	Status    string        `json:"status,omitempty"`
	ExitCode  int           `json:"exitCode,omitempty"`
	Output    string        `json:"output,omitempty"`
	Error     string        `json:"error,omitempty"`
	Sessions  []SessionInfo `json:"sessions,omitempty"`
}

type ExecTool

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

func NewExecTool

func NewExecTool(workingDir string, restrict bool, allowPaths ...[]*regexp.Regexp) (*ExecTool, error)

func NewExecToolWithConfig added in v0.2.0

func NewExecToolWithConfig(
	workingDir string,
	restrict bool,
	config *config.Config,
	allowPaths ...[]*regexp.Regexp,
) (*ExecTool, error)

func (*ExecTool) Description

func (t *ExecTool) Description() string

func (*ExecTool) Execute

func (t *ExecTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*ExecTool) Name

func (t *ExecTool) Name() string

func (*ExecTool) Parameters

func (t *ExecTool) Parameters() map[string]any

func (*ExecTool) SetAllowPatterns

func (t *ExecTool) SetAllowPatterns(patterns []string) error

func (*ExecTool) SetRestrictToWorkspace

func (t *ExecTool) SetRestrictToWorkspace(restrict bool)

func (*ExecTool) SetTimeout

func (t *ExecTool) SetTimeout(timeout time.Duration)

type FindSkillsTool added in v0.2.0

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

FindSkillsTool allows the LLM agent to search for installable skills from registries.

func NewFindSkillsTool added in v0.2.0

func NewFindSkillsTool(registryMgr *skills.RegistryManager, cache *skills.SearchCache) *FindSkillsTool

NewFindSkillsTool creates a new FindSkillsTool. registryMgr is the shared registry manager (built from config in createToolRegistry). cache is the search cache for deduplicating similar queries.

func (*FindSkillsTool) Description added in v0.2.0

func (t *FindSkillsTool) Description() string

func (*FindSkillsTool) Execute added in v0.2.0

func (t *FindSkillsTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*FindSkillsTool) Name added in v0.2.0

func (t *FindSkillsTool) Name() string

func (*FindSkillsTool) Parameters added in v0.2.0

func (t *FindSkillsTool) Parameters() map[string]any

type FunctionCall

type FunctionCall struct {
	Name      string `json:"name"`
	Arguments string `json:"arguments"`
}

type GLMSearchProvider added in v0.2.1

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

func (*GLMSearchProvider) Search added in v0.2.1

func (p *GLMSearchProvider) Search(
	ctx context.Context,
	query string,
	count int,
	rangeCode string,
) (string, error)

type HiddenToolDoc added in v0.2.2

type HiddenToolDoc struct {
	Name        string
	Description string
}

HiddenToolDoc is a lightweight representation of a hidden tool for search indexing.

type HiddenToolSnapshot added in v0.2.2

type HiddenToolSnapshot struct {
	Docs    []HiddenToolDoc
	Version uint64
}

HiddenToolSnapshot holds a consistent snapshot of hidden tools and the registry version at which it was taken. Used by BM25SearchTool cache.

type I2CTool added in v0.1.2

type I2CTool struct{}

I2CTool provides I2C bus interaction for reading sensors and controlling peripherals.

func NewI2CTool added in v0.1.2

func NewI2CTool() *I2CTool

func (*I2CTool) Description added in v0.1.2

func (t *I2CTool) Description() string

func (*I2CTool) Execute added in v0.1.2

func (t *I2CTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*I2CTool) Name added in v0.1.2

func (t *I2CTool) Name() string

func (*I2CTool) Parameters added in v0.1.2

func (t *I2CTool) Parameters() map[string]any

type InstallSkillTool added in v0.2.0

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

InstallSkillTool allows the LLM agent to install skills from registries. It shares the same RegistryManager that FindSkillsTool uses, so all registries configured in config are available for installation.

func NewInstallSkillTool added in v0.2.0

func NewInstallSkillTool(registryMgr *skills.RegistryManager, workspace string) *InstallSkillTool

NewInstallSkillTool creates a new InstallSkillTool. registryMgr is the shared registry manager (same instance as FindSkillsTool). workspace is the root workspace directory; skills install to {workspace}/skills/{slug}/.

func (*InstallSkillTool) Description added in v0.2.0

func (t *InstallSkillTool) Description() string

func (*InstallSkillTool) Execute added in v0.2.0

func (t *InstallSkillTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*InstallSkillTool) Name added in v0.2.0

func (t *InstallSkillTool) Name() string

func (*InstallSkillTool) Parameters added in v0.2.0

func (t *InstallSkillTool) Parameters() map[string]any

type JobExecutor added in v0.1.1

type JobExecutor interface {
	ProcessDirectWithChannel(ctx context.Context, content, sessionKey, channel, chatID string) (string, error)
	// PublishResponseIfNeeded sends response to the outbound bus only when the
	// agent did not already deliver content through the message tool in this round.
	PublishResponseIfNeeded(ctx context.Context, channel, chatID, response string)
}

JobExecutor is the interface for executing cron jobs through the agent

type LLMProvider

type LLMProvider interface {
	Chat(
		ctx context.Context,
		messages []Message,
		tools []ToolDefinition,
		model string,
		options map[string]any,
	) (*LLMResponse, error)
	GetDefaultModel() string
}

type LLMResponse

type LLMResponse struct {
	Content      string     `json:"content"`
	ToolCalls    []ToolCall `json:"tool_calls,omitempty"`
	FinishReason string     `json:"finish_reason"`
	Usage        *UsageInfo `json:"usage,omitempty"`
}

type ListDirTool

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

func NewListDirTool added in v0.1.1

func NewListDirTool(workspace string, restrict bool, allowPaths ...[]*regexp.Regexp) *ListDirTool

func (*ListDirTool) Description

func (t *ListDirTool) Description() string

func (*ListDirTool) Execute

func (t *ListDirTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*ListDirTool) Name

func (t *ListDirTool) Name() string

func (*ListDirTool) Parameters

func (t *ListDirTool) Parameters() map[string]any

type LoadImageTool added in v0.2.5

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

LoadImageTool loads a local image file into the MediaStore and returns a media:// reference. The agent loop's resolveMediaRefs will then base64-encode it and attach it as an image_url part in the next LLM request, enabling vision on local files — the same pipeline used when a user sends an image through a chat channel.

This is intentionally different from SendFileTool:

  • SendFileTool → MediaResult + WithResponseHandled() → sends file to user, ends turn
  • LoadImageTool → plain ToolResult with media:// in ForLLM → LLM sees the image next turn

func NewLoadImageTool added in v0.2.5

func NewLoadImageTool(
	workspace string,
	restrict bool,
	maxFileSize int,
	store media.MediaStore,
	allowPaths ...[]*regexp.Regexp,
) *LoadImageTool

func (*LoadImageTool) Description added in v0.2.5

func (t *LoadImageTool) Description() string

func (*LoadImageTool) Execute added in v0.2.5

func (t *LoadImageTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*LoadImageTool) Name added in v0.2.5

func (t *LoadImageTool) Name() string

func (*LoadImageTool) Parameters added in v0.2.5

func (t *LoadImageTool) Parameters() map[string]any

func (*LoadImageTool) SetContext added in v0.2.5

func (t *LoadImageTool) SetContext(channel, chatID string)

func (*LoadImageTool) SetMediaStore added in v0.2.5

func (t *LoadImageTool) SetMediaStore(store media.MediaStore)

type MCPManager added in v0.2.1

type MCPManager interface {
	CallTool(
		ctx context.Context,
		serverName, toolName string,
		arguments map[string]any,
	) (*mcp.CallToolResult, error)
}

MCPManager defines the interface for MCP manager operations This allows for easier testing with mock implementations

type MCPTool added in v0.2.1

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

MCPTool wraps an MCP tool to implement the Tool interface

func NewMCPTool added in v0.2.1

func NewMCPTool(manager MCPManager, serverName string, tool *mcp.Tool) *MCPTool

NewMCPTool creates a new MCP tool wrapper

func (*MCPTool) Description added in v0.2.1

func (t *MCPTool) Description() string

Description returns the tool description

func (*MCPTool) Execute added in v0.2.1

func (t *MCPTool) Execute(ctx context.Context, args map[string]any) *ToolResult

Execute executes the MCP tool

func (*MCPTool) Name added in v0.2.1

func (t *MCPTool) Name() string

Name returns the tool name, prefixed with the server name. The total length is capped at 64 characters (OpenAI-compatible API limit). A short hash of the original (unsanitized) server and tool names is appended whenever sanitization is lossy or the name is truncated, ensuring that two names which differ only in disallowed characters remain distinct after sanitization.

func (*MCPTool) Parameters added in v0.2.1

func (t *MCPTool) Parameters() map[string]any

Parameters returns the tool parameters schema

func (*MCPTool) SetMediaStore added in v0.2.4

func (t *MCPTool) SetMediaStore(store media.MediaStore)

type Message

type Message struct {
	Role       string     `json:"role"`
	Content    string     `json:"content"`
	ToolCalls  []ToolCall `json:"tool_calls,omitempty"`
	ToolCallID string     `json:"tool_call_id,omitempty"`
}

type MessageTool

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

func NewMessageTool

func NewMessageTool() *MessageTool

func (*MessageTool) Description

func (t *MessageTool) Description() string

func (*MessageTool) Execute

func (t *MessageTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*MessageTool) HasSentInRound added in v0.1.2

func (t *MessageTool) HasSentInRound() bool

HasSentInRound returns true if the message tool sent a message during the current round.

func (*MessageTool) Name

func (t *MessageTool) Name() string

func (*MessageTool) Parameters

func (t *MessageTool) Parameters() map[string]any

func (*MessageTool) ResetSentInRound added in v0.2.1

func (t *MessageTool) ResetSentInRound()

ResetSentInRound resets the per-round send tracker. Called by the agent loop at the start of each inbound message processing round.

func (*MessageTool) SetSendCallback

func (t *MessageTool) SetSendCallback(callback SendCallback)

type PerplexitySearchProvider added in v0.2.0

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

func (*PerplexitySearchProvider) Search added in v0.2.0

func (p *PerplexitySearchProvider) Search(
	ctx context.Context,
	query string,
	count int,
	rangeCode string,
) (string, error)

type ProcessSession added in v0.2.5

type ProcessSession struct {
	ID         string
	PID        int
	Command    string
	PTY        bool
	Background bool
	StartTime  int64
	ExitCode   int
	Status     string
	// contains filtered or unexported fields
}

func (*ProcessSession) GetExitCode added in v0.2.5

func (s *ProcessSession) GetExitCode() int

func (*ProcessSession) GetPtyKeyMode added in v0.2.5

func (s *ProcessSession) GetPtyKeyMode() PtyKeyMode

func (*ProcessSession) GetStatus added in v0.2.5

func (s *ProcessSession) GetStatus() string

func (*ProcessSession) IsDone added in v0.2.5

func (s *ProcessSession) IsDone() bool

func (*ProcessSession) Kill added in v0.2.5

func (s *ProcessSession) Kill() error

func (*ProcessSession) Read added in v0.2.5

func (s *ProcessSession) Read() string

func (*ProcessSession) SetExitCode added in v0.2.5

func (s *ProcessSession) SetExitCode(code int)

func (*ProcessSession) SetPtyKeyMode added in v0.2.5

func (s *ProcessSession) SetPtyKeyMode(mode PtyKeyMode)

func (*ProcessSession) SetStatus added in v0.2.5

func (s *ProcessSession) SetStatus(status string)

func (*ProcessSession) ToSessionInfo added in v0.2.5

func (s *ProcessSession) ToSessionInfo() SessionInfo

func (*ProcessSession) Write added in v0.2.5

func (s *ProcessSession) Write(data string) error

type PtyKeyMode added in v0.2.5

type PtyKeyMode uint8

PtyKeyMode represents arrow key encoding mode for PTY sessions. Programs send smkx/rmkx sequences to switch between CSI and SS3 modes.

const (
	PtyKeyModeCSI PtyKeyMode = iota // triggered by rmkx (\x1b[?1l)
	PtyKeyModeSS3                   // triggered by smkx (\x1b[?1h)
)
const PtyKeyModeNotFound PtyKeyMode = 255

type ReactionCallback added in v0.2.5

type ReactionCallback func(ctx context.Context, channel, chatID, messageID string) error

type ReactionTool added in v0.2.5

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

func NewReactionTool added in v0.2.5

func NewReactionTool() *ReactionTool

func (*ReactionTool) Description added in v0.2.5

func (t *ReactionTool) Description() string

func (*ReactionTool) Execute added in v0.2.5

func (t *ReactionTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*ReactionTool) Name added in v0.2.5

func (t *ReactionTool) Name() string

func (*ReactionTool) Parameters added in v0.2.5

func (t *ReactionTool) Parameters() map[string]any

func (*ReactionTool) SetReactionCallback added in v0.2.5

func (t *ReactionTool) SetReactionCallback(callback ReactionCallback)

type ReadFileLinesTool added in v0.2.5

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

func NewReadFileLinesTool added in v0.2.5

func NewReadFileLinesTool(
	workspace string,
	restrict bool,
	maxReadFileSize int,
	allowPaths ...[]*regexp.Regexp,
) *ReadFileLinesTool

func (*ReadFileLinesTool) Description added in v0.2.5

func (t *ReadFileLinesTool) Description() string

func (*ReadFileLinesTool) Execute added in v0.2.5

func (t *ReadFileLinesTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*ReadFileLinesTool) Name added in v0.2.5

func (t *ReadFileLinesTool) Name() string

func (*ReadFileLinesTool) Parameters added in v0.2.5

func (t *ReadFileLinesTool) Parameters() map[string]any

type ReadFileTool

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

func NewReadFileBytesTool added in v0.2.5

func NewReadFileBytesTool(
	workspace string,
	restrict bool,
	maxReadFileSize int,
	allowPaths ...[]*regexp.Regexp,
) *ReadFileTool

func NewReadFileTool added in v0.1.1

func NewReadFileTool(
	workspace string,
	restrict bool,
	maxReadFileSize int,
	allowPaths ...[]*regexp.Regexp,
) *ReadFileTool

func (*ReadFileTool) Description

func (t *ReadFileTool) Description() string

func (*ReadFileTool) Execute

func (t *ReadFileTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*ReadFileTool) Name

func (t *ReadFileTool) Name() string

func (*ReadFileTool) Parameters

func (t *ReadFileTool) Parameters() map[string]any

type RegexSearchTool added in v0.2.2

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

func NewRegexSearchTool added in v0.2.2

func NewRegexSearchTool(r *ToolRegistry, ttl int, maxSearchResults int) *RegexSearchTool

func (*RegexSearchTool) Description added in v0.2.2

func (t *RegexSearchTool) Description() string

func (*RegexSearchTool) Execute added in v0.2.2

func (t *RegexSearchTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*RegexSearchTool) Name added in v0.2.2

func (t *RegexSearchTool) Name() string

func (*RegexSearchTool) Parameters added in v0.2.2

func (t *RegexSearchTool) Parameters() map[string]any

type SPITool added in v0.1.2

type SPITool struct{}

SPITool provides SPI bus interaction for high-speed peripheral communication.

func NewSPITool added in v0.1.2

func NewSPITool() *SPITool

func (*SPITool) Description added in v0.1.2

func (t *SPITool) Description() string

func (*SPITool) Execute added in v0.1.2

func (t *SPITool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*SPITool) Name added in v0.1.2

func (t *SPITool) Name() string

func (*SPITool) Parameters added in v0.1.2

func (t *SPITool) Parameters() map[string]any

type SearXNGSearchProvider added in v0.2.1

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

func (*SearXNGSearchProvider) Search added in v0.2.1

func (p *SearXNGSearchProvider) Search(
	ctx context.Context,
	query string,
	count int,
	rangeCode string,
) (string, error)

type SearchProvider added in v0.1.2

type SearchProvider interface {
	Search(ctx context.Context, query string, count int, rangeCode string) (string, error)
}

type SendCallback

type SendCallback func(channel, chatID, content, replyToMessageID string) error

type SendFileTool added in v0.2.1

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

SendFileTool allows the LLM to send a local file (image, document, etc.) to the user on the current chat channel via the MediaStore pipeline.

func NewSendFileTool added in v0.2.1

func NewSendFileTool(
	workspace string,
	restrict bool,
	maxFileSize int,
	store media.MediaStore,
	allowPaths ...[]*regexp.Regexp,
) *SendFileTool

func (*SendFileTool) Description added in v0.2.1

func (t *SendFileTool) Description() string

func (*SendFileTool) Execute added in v0.2.1

func (t *SendFileTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*SendFileTool) Name added in v0.2.1

func (t *SendFileTool) Name() string

func (*SendFileTool) Parameters added in v0.2.1

func (t *SendFileTool) Parameters() map[string]any

func (*SendFileTool) SetContext added in v0.2.1

func (t *SendFileTool) SetContext(channel, chatID string)

func (*SendFileTool) SetMediaStore added in v0.2.1

func (t *SendFileTool) SetMediaStore(store media.MediaStore)

type SendTTSTool added in v0.2.5

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

func NewSendTTSTool added in v0.2.5

func NewSendTTSTool(provider tts.TTSProvider, store media.MediaStore) *SendTTSTool

func (*SendTTSTool) Description added in v0.2.5

func (t *SendTTSTool) Description() string

func (*SendTTSTool) Execute added in v0.2.5

func (t *SendTTSTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*SendTTSTool) Name added in v0.2.5

func (t *SendTTSTool) Name() string

func (*SendTTSTool) Parameters added in v0.2.5

func (t *SendTTSTool) Parameters() map[string]any

func (*SendTTSTool) SetMediaStore added in v0.2.5

func (t *SendTTSTool) SetMediaStore(store media.MediaStore)

type SessionInfo added in v0.2.5

type SessionInfo struct {
	ID        string `json:"id"`
	Command   string `json:"command"`
	Status    string `json:"status"`
	PID       int    `json:"pid"`
	StartedAt int64  `json:"startedAt"`
}

type SessionManager added in v0.2.5

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

func NewSessionManager added in v0.2.5

func NewSessionManager() *SessionManager

func (*SessionManager) Add added in v0.2.5

func (sm *SessionManager) Add(session *ProcessSession)

func (*SessionManager) Get added in v0.2.5

func (sm *SessionManager) Get(sessionID string) (*ProcessSession, error)

func (*SessionManager) List added in v0.2.5

func (sm *SessionManager) List() []SessionInfo

func (*SessionManager) Remove added in v0.2.5

func (sm *SessionManager) Remove(sessionID string)

type SpawnStatusTool added in v0.2.4

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

SpawnStatusTool reports the status of subagents that were spawned via the spawn tool. It can query a specific task by ID, or list every known task with a summary count broken-down by status.

func NewSpawnStatusTool added in v0.2.4

func NewSpawnStatusTool(manager *SubagentManager) *SpawnStatusTool

NewSpawnStatusTool creates a SpawnStatusTool backed by the given manager.

func (*SpawnStatusTool) Description added in v0.2.4

func (t *SpawnStatusTool) Description() string

func (*SpawnStatusTool) Execute added in v0.2.4

func (t *SpawnStatusTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*SpawnStatusTool) Name added in v0.2.4

func (t *SpawnStatusTool) Name() string

func (*SpawnStatusTool) Parameters added in v0.2.4

func (t *SpawnStatusTool) Parameters() map[string]any

type SpawnSubTurnFunc added in v0.2.4

type SpawnSubTurnFunc func(
	ctx context.Context,
	task, label, agentID string,
	tools *ToolRegistry,
	maxTokens int,
	temperature float64,
	hasMaxTokens, hasTemperature bool,
) (*ToolResult, error)

type SpawnTool

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

func NewSpawnTool

func NewSpawnTool(manager *SubagentManager) *SpawnTool

func (*SpawnTool) Description

func (t *SpawnTool) Description() string

func (*SpawnTool) Execute

func (t *SpawnTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*SpawnTool) ExecuteAsync added in v0.2.1

func (t *SpawnTool) ExecuteAsync(
	ctx context.Context,
	args map[string]any,
	cb AsyncCallback,
) *ToolResult

ExecuteAsync implements AsyncExecutor. The callback is passed through to the subagent manager as a call parameter — never stored on the SpawnTool instance.

func (*SpawnTool) Name

func (t *SpawnTool) Name() string

func (*SpawnTool) Parameters

func (t *SpawnTool) Parameters() map[string]any

func (*SpawnTool) SetAllowlistChecker added in v0.2.0

func (t *SpawnTool) SetAllowlistChecker(check func(targetAgentID string) bool)

func (*SpawnTool) SetSpawner added in v0.2.4

func (t *SpawnTool) SetSpawner(spawner SubTurnSpawner)

SetSpawner sets the SubTurnSpawner for direct sub-turn execution.

type SubTurnConfig added in v0.2.4

type SubTurnConfig struct {
	Model              string
	Tools              []Tool
	SystemPrompt       string
	MaxTokens          int
	Temperature        float64
	Async              bool          // true for async (spawn), false for sync (subagent)
	Critical           bool          // continue running after parent finishes gracefully
	Timeout            time.Duration // 0 = use default (5 minutes)
	MaxContextRunes    int           // 0 = auto, -1 = no limit, >0 = explicit limit
	ActualSystemPrompt string
	InitialMessages    []providers.Message
	InitialTokenBudget *atomic.Int64 // Shared token budget for team members; nil if no budget
}

SubTurnConfig holds configuration for spawning a sub-turn.

type SubTurnSpawner added in v0.2.4

type SubTurnSpawner interface {
	SpawnSubTurn(ctx context.Context, cfg SubTurnConfig) (*ToolResult, error)
}

SubTurnSpawner is an interface for spawning sub-turns. This avoids circular dependency between tools and agent packages.

type SubagentManager

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

func NewSubagentManager

func NewSubagentManager(
	provider providers.LLMProvider,
	defaultModel, workspace string,
) *SubagentManager

func (*SubagentManager) GetTask

func (sm *SubagentManager) GetTask(taskID string) (*SubagentTask, bool)

func (*SubagentManager) GetTaskCopy added in v0.2.4

func (sm *SubagentManager) GetTaskCopy(taskID string) (SubagentTask, bool)

GetTaskCopy returns a copy of the task with the given ID, taken under the read lock, so the caller receives a consistent snapshot with no data race.

func (*SubagentManager) ListTaskCopies added in v0.2.4

func (sm *SubagentManager) ListTaskCopies() []SubagentTask

ListTaskCopies returns value copies of all tasks, taken under the read lock, so callers receive consistent snapshots with no data race.

func (*SubagentManager) ListTasks

func (sm *SubagentManager) ListTasks() []*SubagentTask

func (*SubagentManager) RegisterTool added in v0.1.2

func (sm *SubagentManager) RegisterTool(tool Tool)

RegisterTool registers a tool for subagent execution.

func (*SubagentManager) SetLLMOptions added in v0.2.0

func (sm *SubagentManager) SetLLMOptions(maxTokens int, temperature float64)

SetLLMOptions sets max tokens and temperature for subagent LLM calls.

func (*SubagentManager) SetMediaResolver added in v0.2.5

func (sm *SubagentManager) SetMediaResolver(
	resolver func([]providers.Message) []providers.Message,
)

SetMediaResolver injects a message preprocessor that resolves media:// refs into LLM-ready content before each tool-loop iteration. This is only used by the legacy RunToolLoop fallback path.

func (*SubagentManager) SetSpawner added in v0.2.4

func (sm *SubagentManager) SetSpawner(spawner SpawnSubTurnFunc)

func (*SubagentManager) SetTools added in v0.1.2

func (sm *SubagentManager) SetTools(tools *ToolRegistry)

SetTools sets the tool registry for subagent execution. If not set, subagent will have access to the provided tools.

func (*SubagentManager) Spawn

func (sm *SubagentManager) Spawn(
	ctx context.Context,
	task, label, agentID, originChannel, originChatID string,
	callback AsyncCallback,
) (string, error)

type SubagentTask

type SubagentTask struct {
	ID            string
	Task          string
	Label         string
	AgentID       string
	OriginChannel string
	OriginChatID  string
	Status        string
	Result        string
	Created       int64
}

type SubagentTool added in v0.1.2

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

SubagentTool executes a subagent task synchronously and returns the result. It directly calls SubTurnSpawner with Async=false for synchronous execution.

func NewSubagentTool added in v0.1.2

func NewSubagentTool(manager *SubagentManager) *SubagentTool

func (*SubagentTool) Description added in v0.1.2

func (t *SubagentTool) Description() string

func (*SubagentTool) Execute added in v0.1.2

func (t *SubagentTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*SubagentTool) Name added in v0.1.2

func (t *SubagentTool) Name() string

func (*SubagentTool) Parameters added in v0.1.2

func (t *SubagentTool) Parameters() map[string]any

func (*SubagentTool) SetSpawner added in v0.2.4

func (t *SubagentTool) SetSpawner(spawner SubTurnSpawner)

SetSpawner sets the SubTurnSpawner for direct sub-turn execution.

type TavilySearchProvider added in v0.2.0

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

func (*TavilySearchProvider) Search added in v0.2.0

func (p *TavilySearchProvider) Search(
	ctx context.Context,
	query string,
	count int,
	rangeCode string,
) (string, error)

type Tool

type Tool interface {
	Name() string
	Description() string
	Parameters() map[string]any
	Execute(ctx context.Context, args map[string]any) *ToolResult
}

Tool is the interface that all tools must implement.

type ToolCall

type ToolCall struct {
	ID        string         `json:"id"`
	Type      string         `json:"type"`
	Function  *FunctionCall  `json:"function,omitempty"`
	Name      string         `json:"name,omitempty"`
	Arguments map[string]any `json:"arguments,omitempty"`
}

type ToolDefinition

type ToolDefinition struct {
	Type     string                 `json:"type"`
	Function ToolFunctionDefinition `json:"function"`
}

type ToolEntry added in v0.2.2

type ToolEntry struct {
	Tool   Tool
	IsCore bool
	TTL    int
}

type ToolFunctionDefinition

type ToolFunctionDefinition struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Parameters  map[string]any `json:"parameters"`
}

type ToolLoopConfig added in v0.1.2

type ToolLoopConfig struct {
	Provider      providers.LLMProvider
	Model         string
	Tools         *ToolRegistry
	MaxIterations int
	LLMOptions    map[string]any

	// MediaResolver resolves media:// refs in messages before each LLM call.
	// This is optional and is mainly used by subagent legacy fallback execution
	// so subagents can reuse the same multimodal media handling as the main loop.
	MediaResolver func(messages []providers.Message) []providers.Message
}

ToolLoopConfig configures the tool execution loop.

type ToolLoopResult added in v0.1.2

type ToolLoopResult struct {
	Content    string
	Iterations int
}

ToolLoopResult contains the result of running the tool loop.

func RunToolLoop added in v0.1.2

func RunToolLoop(
	ctx context.Context,
	config ToolLoopConfig,
	messages []providers.Message,
	channel, chatID string,
) (*ToolLoopResult, error)

RunToolLoop executes the LLM + tool call iteration loop. This is the core agent logic that can be reused by both main agent and subagents.

type ToolRegistry

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

func NewToolRegistry

func NewToolRegistry() *ToolRegistry

func (*ToolRegistry) Clone added in v0.2.4

func (r *ToolRegistry) Clone() *ToolRegistry

Clone creates an independent copy of the registry containing the same tool entries (shallow copy of each ToolEntry). This is used to give subagents a snapshot of the parent agent's tools without sharing the same registry — tools registered on the parent after cloning (e.g. spawn, spawn_status) will NOT be visible to the clone, preventing recursive subagent spawning. The version counter is reset to 0 in the clone as it's a new independent registry.

func (*ToolRegistry) Count added in v0.1.1

func (r *ToolRegistry) Count() int

Count returns the number of registered tools.

func (*ToolRegistry) Execute

func (r *ToolRegistry) Execute(ctx context.Context, name string, args map[string]any) *ToolResult

func (*ToolRegistry) ExecuteWithContext added in v0.1.1

func (r *ToolRegistry) ExecuteWithContext(
	ctx context.Context,
	name string,
	args map[string]any,
	channel, chatID string,
	asyncCallback AsyncCallback,
) *ToolResult

ExecuteWithContext executes a tool with channel/chatID context and optional async callback. If the tool implements AsyncExecutor and a non-nil callback is provided, ExecuteAsync is called instead of Execute — the callback is a parameter, never stored as mutable state on the tool.

func (*ToolRegistry) Get

func (r *ToolRegistry) Get(name string) (Tool, bool)

func (*ToolRegistry) GetAll added in v0.2.4

func (r *ToolRegistry) GetAll() []Tool

GetAll returns all registered tools (both core and non-core with TTL > 0). Used by SubTurn to inherit parent's tool set.

func (*ToolRegistry) GetDefinitions

func (r *ToolRegistry) GetDefinitions() []map[string]any

func (*ToolRegistry) GetSummaries added in v0.1.1

func (r *ToolRegistry) GetSummaries() []string

GetSummaries returns human-readable summaries of all registered tools. Returns a slice of "name - description" strings.

func (*ToolRegistry) List added in v0.1.1

func (r *ToolRegistry) List() []string

List returns a list of all registered tool names.

func (*ToolRegistry) PromoteTools added in v0.2.2

func (r *ToolRegistry) PromoteTools(names []string, ttl int)

PromoteTools atomically sets the TTL for multiple non-core tools. This prevents a concurrent TickTTL from decrementing between promotions.

func (*ToolRegistry) Register

func (r *ToolRegistry) Register(tool Tool)

func (*ToolRegistry) RegisterHidden added in v0.2.2

func (r *ToolRegistry) RegisterHidden(tool Tool)

RegisterHidden saves hidden tools (visible only via TTL)

func (*ToolRegistry) SearchBM25 added in v0.2.2

func (r *ToolRegistry) SearchBM25(query string, maxSearchResults int) []ToolSearchResult

SearchBM25 ranks hidden tools against query using BM25 via utils.BM25Engine. This non-cached variant rebuilds the engine on every call. Used by tests and any code that doesn't hold a BM25SearchTool instance.

func (*ToolRegistry) SearchRegex added in v0.2.2

func (r *ToolRegistry) SearchRegex(pattern string, maxSearchResults int) ([]ToolSearchResult, error)

func (*ToolRegistry) SetMediaStore added in v0.2.4

func (r *ToolRegistry) SetMediaStore(store media.MediaStore)

SetMediaStore injects a MediaStore into all registered tools that can consume it, and remembers it for future registrations.

func (*ToolRegistry) SnapshotHiddenTools added in v0.2.2

func (r *ToolRegistry) SnapshotHiddenTools() HiddenToolSnapshot

SnapshotHiddenTools returns all non-core tools and the current registry version under a single read-lock, guaranteeing consistency between the two values.

func (*ToolRegistry) TickTTL added in v0.2.2

func (r *ToolRegistry) TickTTL()

TickTTL decreases TTL only for non-core tools

func (*ToolRegistry) ToProviderDefs added in v0.1.2

func (r *ToolRegistry) ToProviderDefs() []providers.ToolDefinition

ToProviderDefs converts tool definitions to provider-compatible format. This is the format expected by LLM provider APIs.

func (*ToolRegistry) Version added in v0.2.2

func (r *ToolRegistry) Version() uint64

Version returns the current registry version (atomically).

type ToolResult added in v0.1.2

type ToolResult struct {
	// ForLLM is the content sent to the LLM for context.
	// Required for all results.
	ForLLM string `json:"for_llm"`

	// ForUser is the content sent directly to the user.
	// If empty, no user message is sent.
	// Silent=true overrides this field.
	ForUser string `json:"for_user,omitempty"`

	// Silent suppresses sending any message to the user.
	// When true, ForUser is ignored even if set.
	Silent bool `json:"silent"`

	// IsError indicates whether the tool execution failed.
	// When true, the result should be treated as an error.
	IsError bool `json:"is_error"`

	// Async indicates whether the tool is running asynchronously.
	// When true, the tool will complete later and notify via callback.
	Async bool `json:"async"`

	// Err is the underlying error (not JSON serialized).
	// Used for internal error handling and logging.
	Err error `json:"-"`

	// Media contains media store refs produced by this tool.
	// When non-empty, the agent will publish these as OutboundMediaMessage.
	Media []string `json:"media,omitempty"`

	// Messages holds the ephemeral session history after execution.
	// Only populated by SubTurn executions; used by evaluator_optimizer
	// to carry stateful worker context across evaluation iterations.
	Messages []providers.Message `json:"-"`

	// ArtifactTags exposes local artifact paths back to the LLM in a structured
	// form, e.g. "[file:/tmp/example.png]". This is used when a tool produced a
	// reusable local artifact but did not deliver it to the user yet.
	ArtifactTags []string `json:"artifact_tags,omitempty"`

	// ResponseHandled indicates that this tool execution already satisfied the
	// user's request at the channel/output level, so the agent loop can stop
	// without a follow-up assistant response.
	ResponseHandled bool `json:"response_handled,omitempty"`
}

ToolResult represents the structured return value from tool execution. It provides clear semantics for different types of results and supports async operations, user-facing messages, and error handling.

func AsyncResult added in v0.1.2

func AsyncResult(forLLM string) *ToolResult

AsyncResult creates a ToolResult for async operations. The task will run in the background and complete later.

Use this for long-running operations like: - Subagent spawns - Background processing - External API calls with callbacks

Example:

result := AsyncResult("Subagent spawned, will report back")

func ErrorResult added in v0.1.2

func ErrorResult(message string) *ToolResult

ErrorResult creates a ToolResult representing an error. Sets IsError=true and includes the error message.

Example:

result := ErrorResult("Failed to connect to database: connection refused")

func MediaResult added in v0.2.0

func MediaResult(forLLM string, mediaRefs []string) *ToolResult

MediaResult creates a ToolResult with media refs for the user. The agent will publish these refs as OutboundMediaMessage.

Example:

result := MediaResult("Image generated successfully", []string{"media://abc123"})

func NewToolResult added in v0.1.2

func NewToolResult(forLLM string) *ToolResult

NewToolResult creates a basic ToolResult with content for the LLM. Use this when you need a simple result with default behavior.

Example:

result := NewToolResult("File updated successfully")

func SilentResult added in v0.1.2

func SilentResult(forLLM string) *ToolResult

SilentResult creates a ToolResult that is silent (no user message). The content is only sent to the LLM for context.

Use this for operations that should not spam the user, such as: - File reads/writes - Status updates - Background operations

Example:

result := SilentResult("Config file saved")

func UserResult added in v0.1.2

func UserResult(content string) *ToolResult

UserResult creates a ToolResult with content for both LLM and user. Both ForLLM and ForUser are set to the same content.

Use this when the user needs to see the result directly: - Command execution output - Fetched web content - Query results

Example:

result := UserResult("Total files found: 42")

func (*ToolResult) ContentForLLM added in v0.2.4

func (tr *ToolResult) ContentForLLM() string

ContentForLLM returns the normalized textual content to append to the conversation after a tool call. Errors fall back to Err when ForLLM is empty.

func (*ToolResult) MarshalJSON added in v0.1.2

func (tr *ToolResult) MarshalJSON() ([]byte, error)

MarshalJSON implements custom JSON serialization. The Err field is excluded from JSON output via the json:"-" tag.

func (*ToolResult) WithError added in v0.1.2

func (tr *ToolResult) WithError(err error) *ToolResult

WithError sets the Err field and returns the result for chaining. This preserves the error for logging while keeping it out of JSON.

Example:

result := ErrorResult("Operation failed").WithError(err)

func (*ToolResult) WithResponseHandled added in v0.2.4

func (tr *ToolResult) WithResponseHandled() *ToolResult

WithResponseHandled marks the tool result as already delivered to the user.

type ToolSearchResult added in v0.2.2

type ToolSearchResult struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

ToolSearchResult represents the result returned to the LLM. Parameters are omitted from the JSON response to save context tokens; the LLM will see full schemas via ToProviderDefs after promotion.

type UsageInfo

type UsageInfo struct {
	PromptTokens     int `json:"prompt_tokens"`
	CompletionTokens int `json:"completion_tokens"`
	TotalTokens      int `json:"total_tokens"`
}

type WebFetchTool

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

func NewWebFetchTool

func NewWebFetchTool(maxChars int, format string, fetchLimitBytes int64) (*WebFetchTool, error)

func NewWebFetchToolWithConfig added in v0.2.4

func NewWebFetchToolWithConfig(
	maxChars int,
	proxy string,
	format string,
	fetchLimitBytes int64,
	privateHostWhitelist []string,
) (*WebFetchTool, error)

func NewWebFetchToolWithProxy added in v0.2.0

func NewWebFetchToolWithProxy(
	maxChars int,
	proxy string,
	format string,
	fetchLimitBytes int64,
	privateHostWhitelist []string,
) (*WebFetchTool, error)

func (*WebFetchTool) Description

func (t *WebFetchTool) Description() string

func (*WebFetchTool) Execute

func (t *WebFetchTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*WebFetchTool) Name

func (t *WebFetchTool) Name() string

func (*WebFetchTool) Parameters

func (t *WebFetchTool) Parameters() map[string]any

type WebSearchTool

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

func NewWebSearchTool

func NewWebSearchTool(opts WebSearchToolOptions) (*WebSearchTool, error)

func (*WebSearchTool) Description

func (t *WebSearchTool) Description() string

func (*WebSearchTool) Execute

func (t *WebSearchTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*WebSearchTool) Name

func (t *WebSearchTool) Name() string

func (*WebSearchTool) Parameters

func (t *WebSearchTool) Parameters() map[string]any

type WebSearchToolOptions added in v0.1.2

type WebSearchToolOptions struct {
	BraveAPIKeys          []string
	BraveMaxResults       int
	BraveEnabled          bool
	TavilyAPIKeys         []string
	TavilyBaseURL         string
	TavilyMaxResults      int
	TavilyEnabled         bool
	DuckDuckGoMaxResults  int
	DuckDuckGoEnabled     bool
	PerplexityAPIKeys     []string
	PerplexityMaxResults  int
	PerplexityEnabled     bool
	SearXNGBaseURL        string
	SearXNGMaxResults     int
	SearXNGEnabled        bool
	GLMSearchAPIKey       string
	GLMSearchBaseURL      string
	GLMSearchEngine       string
	GLMSearchMaxResults   int
	GLMSearchEnabled      bool
	BaiduSearchAPIKey     string
	BaiduSearchBaseURL    string
	BaiduSearchMaxResults int
	BaiduSearchEnabled    bool
	Proxy                 string
}

type WriteFileTool

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

func NewWriteFileTool added in v0.1.1

func NewWriteFileTool(
	workspace string,
	restrict bool,
	allowPaths ...[]*regexp.Regexp,
) *WriteFileTool

func (*WriteFileTool) Description

func (t *WriteFileTool) Description() string

func (*WriteFileTool) Execute

func (t *WriteFileTool) Execute(ctx context.Context, args map[string]any) *ToolResult

func (*WriteFileTool) Name

func (t *WriteFileTool) Name() string

func (*WriteFileTool) Parameters

func (t *WriteFileTool) Parameters() map[string]any

Jump to

Keyboard shortcuts

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