Documentation
¶
Index ¶
- func BashTool() api.Tool
- func DiffEdit(path, oldStr, newStr string) (string, error)
- func EditTool() api.Tool
- func GlobTool() api.Tool
- func GrepTool() api.Tool
- func ReadTool() api.Tool
- func WebFetchTool() api.Tool
- func WebSearchTool() api.Tool
- func WriteTool() api.Tool
- type BashExecutor
- type EditExecutor
- type GlobExecutor
- type GrepExecutor
- type ReadExecutor
- type SearchResult
- type WebFetchExecutor
- type WebSearchExecutor
- type WriteExecutor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiffEdit ¶
DiffEdit computes a unified diff of replacing the first occurrence of oldStr with newStr in the file at path, without modifying the file.
func WebFetchTool ¶
WebFetchTool returns the Tool definition for fetching web page content.
func WebSearchTool ¶
WebSearchTool returns the Tool definition for DuckDuckGo web search.
Types ¶
type BashExecutor ¶
BashExecutor implements api.ToolExecutor for the bash tool. Timeout controls the execution deadline; zero means 30s default.
func (BashExecutor) ExecuteTool ¶
func (b BashExecutor) ExecuteTool(ctx context.Context, _ string, input map[string]any) (string, error)
ExecuteTool runs the bash command from input["command"] and returns combined output. Returns an error on missing/empty command, timeout, or non-zero exit code.
type EditExecutor ¶
type EditExecutor struct{}
EditExecutor implements api.ToolExecutor for the edit tool.
func (EditExecutor) ExecuteTool ¶
func (e EditExecutor) ExecuteTool(_ context.Context, _ string, input map[string]any) (string, error)
ExecuteTool replaces the first occurrence of old_string with new_string in the file at path. Returns a unified diff of the change on success.
type GlobExecutor ¶
type GlobExecutor struct{}
GlobExecutor implements api.ToolExecutor for the glob tool.
func (GlobExecutor) ExecuteTool ¶
func (g GlobExecutor) ExecuteTool(_ context.Context, _ string, input map[string]any) (string, error)
ExecuteTool walks the filesystem from input["path"] (default ".") and returns all files matching input["pattern"], sorted by modification time (newest first).
type GrepExecutor ¶
type GrepExecutor struct{}
GrepExecutor implements api.ToolExecutor for the grep tool.
func (GrepExecutor) ExecuteTool ¶
func (g GrepExecutor) ExecuteTool(_ context.Context, _ string, input map[string]any) (string, error)
ExecuteTool searches files under input["path"] (default ".") for lines matching input["pattern"] (regex). An optional input["glob"] filters which files are searched. Returns up to 200 matches in file:line:content format.
type ReadExecutor ¶
type ReadExecutor struct{}
ReadExecutor implements api.ToolExecutor for the read tool.
func (ReadExecutor) ExecuteTool ¶
func (r ReadExecutor) ExecuteTool(_ context.Context, _ string, input map[string]any) (string, error)
ExecuteTool reads the file at input["path"] and returns its contents with line numbers in cat-n format. Optional offset (1-based) and limit control which lines are returned.
type SearchResult ¶
SearchResult holds a single DuckDuckGo search result.
type WebFetchExecutor ¶
WebFetchExecutor implements api.ToolExecutor for the web_fetch tool. Client overrides the HTTP client (nil uses a default).
func (*WebFetchExecutor) ExecuteTool ¶
func (w *WebFetchExecutor) ExecuteTool(ctx context.Context, _ string, input map[string]any) (string, error)
ExecuteTool fetches the URL from input["url"] and returns its text content.
type WebSearchExecutor ¶
WebSearchExecutor implements api.ToolExecutor for the web_search tool. Client overrides the HTTP client (nil uses a default with timeout via context). BaseURL overrides the DuckDuckGo endpoint (for testing).
func (*WebSearchExecutor) ExecuteTool ¶
func (w *WebSearchExecutor) ExecuteTool(ctx context.Context, _ string, input map[string]any) (string, error)
ExecuteTool performs a DuckDuckGo search and returns formatted results.
type WriteExecutor ¶
type WriteExecutor struct{}
WriteExecutor implements api.ToolExecutor for the write tool.
func (WriteExecutor) ExecuteTool ¶
func (w WriteExecutor) ExecuteTool(_ context.Context, _ string, input map[string]any) (string, error)
ExecuteTool writes input["content"] to the file at input["path"]. Relative paths that escape the working directory via ".." are rejected.