tools

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: GPL-3.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDeliveryFileNotFound = errors.New("send_file: file does not exist")

Functions

func RenderSearchResults

func RenderSearchResults(providerNames []string, query string, results []SearchResult) string

RenderSearchResults formats structured hits the same way regardless of which provider produced them.

func ResolveProjectFile added in v0.1.2

func ResolveProjectFile(projectDir, path string) (string, toolkit.FileDelivery, error)

ResolveProjectFile revalidates a persisted project-relative delivery path and returns its resolved absolute filename and current file metadata.

Types

type APIKeyPool

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

APIKeyPool round-robins a set of provider API keys so a single bad key doesn't fail every request.

func NewAPIKeyPool

func NewAPIKeyPool(keys []string) *APIKeyPool

func (*APIKeyPool) Len

func (p *APIKeyPool) Len() int

func (*APIKeyPool) Next

func (p *APIKeyPool) Next() (string, bool)

type AskQuestionsTool added in v0.3.2

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

AskQuestionsTool lets a streaming session ask the user for information the model cannot safely infer.

func NewAskQuestionsTool added in v0.3.2

func NewAskQuestionsTool(interactions *interaction.Manager) *AskQuestionsTool

func (AskQuestionsTool) Description added in v0.3.2

func (AskQuestionsTool) Description() string

func (*AskQuestionsTool) Execute added in v0.3.2

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

func (AskQuestionsTool) Name added in v0.3.2

func (AskQuestionsTool) Name() string

func (AskQuestionsTool) Parameters added in v0.3.2

func (AskQuestionsTool) Parameters() map[string]any

func (AskQuestionsTool) Scopes added in v0.3.2

func (AskQuestionsTool) Scopes() []toolkit.Scope

type ChatHistoryReadTool added in v0.1.2

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

func NewChatHistoryReadTool added in v0.1.2

func NewChatHistoryReadTool(db *gorm.DB, sessions activePathLoader) *ChatHistoryReadTool

func (ChatHistoryReadTool) Description added in v0.1.2

func (ChatHistoryReadTool) Description() string

func (ChatHistoryReadTool) Execute added in v0.1.2

func (t ChatHistoryReadTool) Execute(ctx context.Context, rawArgs map[string]any) *toolkit.ToolResult

func (ChatHistoryReadTool) Name added in v0.1.2

func (ChatHistoryReadTool) Name() string

func (ChatHistoryReadTool) Parameters added in v0.1.2

func (ChatHistoryReadTool) Parameters() map[string]any

func (ChatHistoryReadTool) Scopes added in v0.1.2

func (ChatHistoryReadTool) Scopes() []toolkit.Scope

type ChatHistorySearchTool

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

ChatHistorySearchTool lets the LLM look up specific prior chat history by keyword/regex, deliberately scoped to "find this particular exchange" rather than general-purpose memory recall.

Matching is done entirely in Go (substring/regexp over messages loaded via parameterized GORM queries) rather than pushed into SQL, per the platform's "no SQL statements" constraint. Results are rendered as a compact, de-duplicated transcript with per-message truncation so a search can never flood the model's context window.

func NewChatHistorySearchTool

func NewChatHistorySearchTool(db *gorm.DB, sessions *session.Service) *ChatHistorySearchTool

NewChatHistorySearchTool creates the tool.

func (ChatHistorySearchTool) Description

func (ChatHistorySearchTool) Description() string

func (ChatHistorySearchTool) Execute

func (t ChatHistorySearchTool) Execute(ctx context.Context, rawArgs map[string]any) *toolkit.ToolResult

func (ChatHistorySearchTool) Name

func (ChatHistorySearchTool) Parameters

func (ChatHistorySearchTool) Parameters() map[string]any

func (ChatHistorySearchTool) Scopes

func (ChatHistorySearchTool) Scopes() []toolkit.Scope

Scopes restricts this tool to interactive sessions: chat history search has no meaning for headless workflow runs that have no chat history.

type CreateProjectTool

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

CreateProjectTool lets the LLM create a new Project: an on-disk folder (with a skeleton AGENTS.md) that file/shell tools can be scoped to. It is deliberately excluded from every default ToolGroup; a session only gains it once the user explicitly activates the group that includes it, which is this platform's stand-in for "explicit user authorization" since it has no interactive approval flow.

func NewCreateProjectTool

func NewCreateProjectTool(projects *project.Service) *CreateProjectTool

NewCreateProjectTool creates the tool.

func (CreateProjectTool) Audited

func (CreateProjectTool) Audited() bool

func (CreateProjectTool) Description

func (CreateProjectTool) Description() string

func (CreateProjectTool) Execute

func (t CreateProjectTool) Execute(_ context.Context, args map[string]any) *toolkit.ToolResult

func (CreateProjectTool) Name

func (CreateProjectTool) Name() string

func (CreateProjectTool) Parameters

func (CreateProjectTool) Parameters() map[string]any

type FileAccessConfig

type FileAccessConfig struct {
	AllowOutsideProject bool
	SharedRoots         []string
}

FileAccessConfig controls the paths exposed through tools that operate on the filesystem. A nil SharedRoots uses the system temporary directory; a non-nil slice replaces that default, which is useful for tests and embedded callers.

type ListProjectsTool

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

ListProjectsTool lets the LLM see which Projects already exist, so it can suggest reusing one instead of creating a duplicate.

func NewListProjectsTool

func NewListProjectsTool(projects *project.Service) *ListProjectsTool

NewListProjectsTool creates the tool.

func (ListProjectsTool) Description

func (ListProjectsTool) Description() string

func (ListProjectsTool) Execute

func (ListProjectsTool) Name

func (ListProjectsTool) Name() string

func (ListProjectsTool) Parameters

func (ListProjectsTool) Parameters() map[string]any

type Provider

type Provider interface {
	// Name identifies the provider in results and error messages.
	Name() string
	// Search returns up to count structured results for query.
	Search(ctx context.Context, query string, count int) ([]SearchResult, error)
}

Provider is a single web-search backend. Providers are thin adapters over an HTTP API or a page scrape and return structured results; formatting is the tool's job, not the provider's.

type SearchResult

type SearchResult struct {
	Title   string
	URL     string
	Snippet string
}

SearchResult is one structured web-search hit. Providers return these; the tool renders them uniformly for the LLM.

type SendFileTool added in v0.1.2

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

SendFileTool explicitly delivers a local Project file to the user. Delivery records a project-relative reference; the host revalidates the file when it persists and serves the attachment.

func NewSendFileTool added in v0.1.2

func NewSendFileTool(enabled bool) *SendFileTool

func (*SendFileTool) Available added in v0.1.2

func (t *SendFileTool) Available() bool

func (SendFileTool) Description added in v0.1.2

func (SendFileTool) Description() string

func (*SendFileTool) Execute added in v0.1.2

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

func (SendFileTool) Name added in v0.1.2

func (SendFileTool) Name() string

func (SendFileTool) Parameters added in v0.1.2

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

type SendNotificationTool

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

SendNotificationTool exposes QQ C2C markdown notifications to the LLM. The reusable QQ client (token caching, expiry-aware refresh, markdown delivery) lives in pkg/qq; this file is only the Tool adapter.

func NewSendNotificationTool

func NewSendNotificationTool(client *qq.Client) *SendNotificationTool

NewSendNotificationTool exposes notifications through the application's shared QQ client.

func (SendNotificationTool) Audited

func (SendNotificationTool) Audited() bool

func (*SendNotificationTool) Available

func (t *SendNotificationTool) Available() bool

func (SendNotificationTool) Description

func (SendNotificationTool) Description() string

func (*SendNotificationTool) Execute

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

func (SendNotificationTool) Name

func (SendNotificationTool) Parameters

func (SendNotificationTool) Parameters() map[string]any

type ShellConfig

type ShellConfig struct {
	Enabled         bool
	Timeout         time.Duration
	Access          FileAccessConfig
	Backend         string
	SSHDestination  string
	SSHProjectsRoot string
}

ShellConfig selects the host on which commands run. The tool's public parameters are independent of this configuration.

type ShellTool

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

ShellTool runs one shell command in the current Project. It intentionally exposes ordinary shell semantics only: use standard shell commands for inspection, file operations, background jobs, and process management.

func NewShellTool

func NewShellTool(enabled bool, timeout time.Duration) *ShellTool

func NewShellToolWithAccess

func NewShellToolWithAccess(enabled bool, timeout time.Duration, access FileAccessConfig) *ShellTool

func NewShellToolWithConfig

func NewShellToolWithConfig(config ShellConfig) (*ShellTool, error)

NewShellToolWithConfig constructs a tool whose local or SSH backend is selected at process startup. SSH authentication remains the responsibility of the user's OpenSSH configuration and agent.

func (ShellTool) Audited

func (ShellTool) Audited() bool

func (*ShellTool) Available

func (t *ShellTool) Available() bool

func (ShellTool) Description

func (ShellTool) Description() string

func (*ShellTool) Example

func (t *ShellTool) Example() string

Example returns a concrete shell invocation (uname -a) together with the host's actual response, so the model sees both the tool's I/O format and the environment it runs in. It is attached to the tool's description when the tool is registered to an LLM request.

func (*ShellTool) Execute

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

func (ShellTool) Name

func (ShellTool) Name() string

func (ShellTool) Parameters

func (ShellTool) Parameters() map[string]any

func (*ShellTool) SetInteractionManager

func (t *ShellTool) SetInteractionManager(manager *interaction.Manager)

SetInteractionManager enables user confirmation requested by the model or required by the fallback policy. It is wired from cmd/hephaestus/main.go; direct callers can omit it when no interactive approval surface is available.

type SubagentAwaitTool added in v0.1.2

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

func NewSubagentAwaitTool added in v0.1.2

func NewSubagentAwaitTool(service subagentStarter) *SubagentAwaitTool

func (SubagentAwaitTool) Description added in v0.1.2

func (SubagentAwaitTool) Description() string

func (SubagentAwaitTool) Execute added in v0.1.2

func (t SubagentAwaitTool) Execute(ctx context.Context, _ map[string]any) *toolkit.ToolResult

func (SubagentAwaitTool) Name added in v0.1.2

func (SubagentAwaitTool) Name() string

func (SubagentAwaitTool) Parameters added in v0.1.2

func (SubagentAwaitTool) Parameters() map[string]any

type SubagentTool added in v0.1.2

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

func NewForkTool added in v0.1.2

func NewForkTool(db *gorm.DB, service subagentStarter) *SubagentTool

func NewSpawnTool added in v0.1.2

func NewSpawnTool(db *gorm.DB, service subagentStarter) *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) *toolkit.ToolResult

func (SubagentTool) Name added in v0.1.2

func (t SubagentTool) Name() string

func (SubagentTool) Parameters added in v0.1.2

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

type WebFetchConfig

type WebFetchConfig struct {
	Provider         string
	FirecrawlAPIKey  string
	ChromePath       string
	MaxChars         int
	FirecrawlBaseURL string
	// LLMClient, when set, enables LLM summarization of large fetched pages:
	// content over SummaryMaxChars is condensed before it is returned to the
	// calling agent. When nil, large pages are returned truncated only.
	LLMClient       *llm.Client
	SummaryMaxChars int
}

type WebFetchTool

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

WebFetchTool fetches readable content from a public HTTP(S) URL.

func NewWebFetchTool

func NewWebFetchTool(config WebFetchConfig) (*WebFetchTool, error)

func (WebFetchTool) Description

func (WebFetchTool) Description() string

func (*WebFetchTool) Execute

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

func (WebFetchTool) Name

func (WebFetchTool) Name() string

func (WebFetchTool) Parameters

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

type WebSearchConfig

type WebSearchConfig struct {
	SearXNGBaseURL                           string
	SerpAPIEngine                            string
	BraveAPIKeys, TavilyAPIKeys, SerpAPIKeys []string
	Notifier                                 *notify.Notifier
	// LLMClient, when set, enables LLM condensation of result lists: rendered
	// results over SummaryMaxChars are condensed before being returned to the
	// calling agent. When nil, results are returned as-is.
	LLMClient       *llm.Client
	SummaryMaxChars int
}

WebSearchConfig configures optional providers. DuckDuckGo and Sogou are always enabled and need no configuration.

type WebSearchTool

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

WebSearchTool selects provider groups for each request, searches the selected providers concurrently, then filters and samples their results.

func NewWebSearchTool

func NewWebSearchTool(config WebSearchConfig) *WebSearchTool

NewWebSearchTool builds the provider groups used for per-request selection. DuckDuckGo and Sogou are always present; API-backed providers are optional.

func (WebSearchTool) Description

func (WebSearchTool) Description() string

func (*WebSearchTool) Execute

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

func (WebSearchTool) Name

func (WebSearchTool) Name() string

func (WebSearchTool) Parameters

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

Jump to

Keyboard shortcuts

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