tools

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 22 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllBaseTools

func GetAllBaseTools() []types.Tool

GetAllBaseTools returns all built-in tool implementations.

func IsSearchOrReadCommand

func IsSearchOrReadCommand(cmd string) (isSearch, isRead, isList bool)

IsSearchOrReadCommand classifies a bash command for UI collapsing.

func SuggestDedicatedTool

func SuggestDedicatedTool(cmd string) string

SuggestDedicatedTool suggests a dedicated tool for common bash commands.

func ValidateFilePath

func ValidateFilePath(path string, workingDir string, additionalDirs []string) error

ValidateFilePath checks if a file path is within allowed directories.

Types

type AgentMessage added in v0.4.0

type AgentMessage struct {
	From      string `json:"from"`
	To        string `json:"to"`
	Content   string `json:"content"`
	Timestamp string `json:"timestamp"`
	Type      string `json:"type"`
}

AgentMessage is a message sent between agents.

type AgentSpawner

type AgentSpawner func(ctx context.Context, config SubagentConfig) (string, error)

AgentSpawner is a function that creates and runs a subagent. It should be set by the agent package to avoid circular imports.

type AgentTool

type AgentTool struct {
	// Spawner creates and runs a subagent, returning its text output.
	Spawner AgentSpawner

	// Definitions maps agent names to their configurations.
	Definitions map[string]SubagentDefinition
	// contains filtered or unexported fields
}

AgentTool spawns subagents for parallel task execution.

func NewAgentTool

func NewAgentTool(definitions map[string]SubagentDefinition, spawner AgentSpawner) *AgentTool

func (*AgentTool) Call

func (t *AgentTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*AgentTool) Description

func (t *AgentTool) Description() string

func (*AgentTool) InputSchema

func (t *AgentTool) InputSchema() types.ToolInputSchema

func (*AgentTool) IsConcurrencySafe

func (t *AgentTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*AgentTool) IsReadOnly

func (t *AgentTool) IsReadOnly(input map[string]interface{}) bool

func (*AgentTool) Name

func (t *AgentTool) Name() string

func (*AgentTool) Stop

func (t *AgentTool) Stop(name string)

Stop cancels a running subagent.

type AskUserFn

type AskUserFn func(ctx context.Context, question string) (string, error)

AskUserFn is a callback that presents a question to the user and returns their answer.

type AskUserQuestionTool

type AskUserQuestionTool struct {
	// AskFn handles the actual user interaction. Must be set for the tool to work.
	AskFn AskUserFn
}

AskUserQuestionTool asks the user a question and returns their response.

func NewAskUserQuestionTool

func NewAskUserQuestionTool(askFn AskUserFn) *AskUserQuestionTool

func (*AskUserQuestionTool) Call

func (t *AskUserQuestionTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*AskUserQuestionTool) Description

func (t *AskUserQuestionTool) Description() string

func (*AskUserQuestionTool) InputSchema

func (t *AskUserQuestionTool) InputSchema() types.ToolInputSchema

func (*AskUserQuestionTool) IsConcurrencySafe

func (t *AskUserQuestionTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*AskUserQuestionTool) IsReadOnly

func (t *AskUserQuestionTool) IsReadOnly(input map[string]interface{}) bool

func (*AskUserQuestionTool) Name

func (t *AskUserQuestionTool) Name() string

type BashTool

type BashTool struct {
	// Env provides additional environment variables for all commands.
	Env map[string]string
	// contains filtered or unexported fields
}

BashTool executes shell commands with security checks, background support, and large output handling.

func NewBashTool

func NewBashTool() *BashTool

func (*BashTool) Call

func (t *BashTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*BashTool) Description

func (t *BashTool) Description() string

func (*BashTool) GetBackgroundTask

func (t *BashTool) GetBackgroundTask(id string) *backgroundTask

GetBackgroundTask returns a background task by ID.

func (*BashTool) InputSchema

func (t *BashTool) InputSchema() types.ToolInputSchema

func (*BashTool) IsConcurrencySafe

func (t *BashTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*BashTool) IsReadOnly

func (t *BashTool) IsReadOnly(input map[string]interface{}) bool

func (*BashTool) Name

func (t *BashTool) Name() string

type ConfigStore added in v0.4.0

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

ConfigStore is an in-memory key-value config store.

func NewConfigStore added in v0.4.0

func NewConfigStore() *ConfigStore

NewConfigStore creates a new ConfigStore.

func (*ConfigStore) Get added in v0.4.0

func (s *ConfigStore) Get(key string) (interface{}, bool)

func (*ConfigStore) List added in v0.4.0

func (s *ConfigStore) List() map[string]interface{}

func (*ConfigStore) Set added in v0.4.0

func (s *ConfigStore) Set(key string, value interface{})

type ConfigTool added in v0.4.0

type ConfigTool struct{ Store *ConfigStore }

ConfigTool provides get/set/list for session-scoped config.

func NewConfigTool added in v0.4.0

func NewConfigTool(store *ConfigStore) *ConfigTool

NewConfigTool creates a new ConfigTool.

func (*ConfigTool) Call added in v0.4.0

func (t *ConfigTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*ConfigTool) Description added in v0.4.0

func (t *ConfigTool) Description() string

func (*ConfigTool) InputSchema added in v0.4.0

func (t *ConfigTool) InputSchema() types.ToolInputSchema

func (*ConfigTool) IsConcurrencySafe added in v0.4.0

func (t *ConfigTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*ConfigTool) IsReadOnly added in v0.4.0

func (t *ConfigTool) IsReadOnly(input map[string]interface{}) bool

func (*ConfigTool) Name added in v0.4.0

func (t *ConfigTool) Name() string

type CronCreateTool added in v0.4.0

type CronCreateTool struct{ Store *CronStore }

CronCreateTool creates a scheduled cron job.

func NewCronCreateTool added in v0.4.0

func NewCronCreateTool(store *CronStore) *CronCreateTool

func (*CronCreateTool) Call added in v0.4.0

func (t *CronCreateTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*CronCreateTool) Description added in v0.4.0

func (t *CronCreateTool) Description() string

func (*CronCreateTool) InputSchema added in v0.4.0

func (t *CronCreateTool) InputSchema() types.ToolInputSchema

func (*CronCreateTool) IsConcurrencySafe added in v0.4.0

func (t *CronCreateTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*CronCreateTool) IsReadOnly added in v0.4.0

func (t *CronCreateTool) IsReadOnly(input map[string]interface{}) bool

func (*CronCreateTool) Name added in v0.4.0

func (t *CronCreateTool) Name() string

type CronDeleteTool added in v0.4.0

type CronDeleteTool struct{ Store *CronStore }

CronDeleteTool deletes a cron job.

func NewCronDeleteTool added in v0.4.0

func NewCronDeleteTool(store *CronStore) *CronDeleteTool

func (*CronDeleteTool) Call added in v0.4.0

func (t *CronDeleteTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*CronDeleteTool) Description added in v0.4.0

func (t *CronDeleteTool) Description() string

func (*CronDeleteTool) InputSchema added in v0.4.0

func (t *CronDeleteTool) InputSchema() types.ToolInputSchema

func (*CronDeleteTool) IsConcurrencySafe added in v0.4.0

func (t *CronDeleteTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*CronDeleteTool) IsReadOnly added in v0.4.0

func (t *CronDeleteTool) IsReadOnly(input map[string]interface{}) bool

func (*CronDeleteTool) Name added in v0.4.0

func (t *CronDeleteTool) Name() string

type CronJob added in v0.4.0

type CronJob struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Schedule  string `json:"schedule"`
	Command   string `json:"command"`
	Enabled   bool   `json:"enabled"`
	CreatedAt string `json:"createdAt"`
}

CronJob represents a scheduled recurring task.

type CronListTool added in v0.4.0

type CronListTool struct{ Store *CronStore }

CronListTool lists all cron jobs.

func NewCronListTool added in v0.4.0

func NewCronListTool(store *CronStore) *CronListTool

func (*CronListTool) Call added in v0.4.0

func (t *CronListTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*CronListTool) Description added in v0.4.0

func (t *CronListTool) Description() string

func (*CronListTool) InputSchema added in v0.4.0

func (t *CronListTool) InputSchema() types.ToolInputSchema

func (*CronListTool) IsConcurrencySafe added in v0.4.0

func (t *CronListTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*CronListTool) IsReadOnly added in v0.4.0

func (t *CronListTool) IsReadOnly(input map[string]interface{}) bool

func (*CronListTool) Name added in v0.4.0

func (t *CronListTool) Name() string

type CronStore added in v0.4.0

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

CronStore manages cron jobs in memory.

func NewCronStore added in v0.4.0

func NewCronStore() *CronStore

NewCronStore creates a new CronStore.

func (*CronStore) Create added in v0.4.0

func (s *CronStore) Create(name, schedule, command string) *CronJob

func (*CronStore) Delete added in v0.4.0

func (s *CronStore) Delete(id string) bool

func (*CronStore) List added in v0.4.0

func (s *CronStore) List() []CronJob

type EnterPlanModeTool added in v0.4.0

type EnterPlanModeTool struct{ State *PlanModeState }

EnterPlanModeTool activates plan mode.

func NewEnterPlanModeTool added in v0.4.0

func NewEnterPlanModeTool(state *PlanModeState) *EnterPlanModeTool

NewEnterPlanModeTool creates a new EnterPlanModeTool.

func (*EnterPlanModeTool) Call added in v0.4.0

func (t *EnterPlanModeTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*EnterPlanModeTool) Description added in v0.4.0

func (t *EnterPlanModeTool) Description() string

func (*EnterPlanModeTool) InputSchema added in v0.4.0

func (t *EnterPlanModeTool) InputSchema() types.ToolInputSchema

func (*EnterPlanModeTool) IsConcurrencySafe added in v0.4.0

func (t *EnterPlanModeTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*EnterPlanModeTool) IsReadOnly added in v0.4.0

func (t *EnterPlanModeTool) IsReadOnly(input map[string]interface{}) bool

func (*EnterPlanModeTool) Name added in v0.4.0

func (t *EnterPlanModeTool) Name() string

type EnterWorktreeTool added in v0.4.0

type EnterWorktreeTool struct{ Store *WorktreeStore }

EnterWorktreeTool creates an isolated git worktree for parallel work.

func NewEnterWorktreeTool added in v0.4.0

func NewEnterWorktreeTool(store *WorktreeStore) *EnterWorktreeTool

NewEnterWorktreeTool creates a new EnterWorktreeTool.

func (*EnterWorktreeTool) Call added in v0.4.0

func (t *EnterWorktreeTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*EnterWorktreeTool) Description added in v0.4.0

func (t *EnterWorktreeTool) Description() string

func (*EnterWorktreeTool) InputSchema added in v0.4.0

func (t *EnterWorktreeTool) InputSchema() types.ToolInputSchema

func (*EnterWorktreeTool) IsConcurrencySafe added in v0.4.0

func (t *EnterWorktreeTool) IsConcurrencySafe(_ map[string]interface{}) bool

func (*EnterWorktreeTool) IsReadOnly added in v0.4.0

func (t *EnterWorktreeTool) IsReadOnly(_ map[string]interface{}) bool

func (*EnterWorktreeTool) Name added in v0.4.0

func (t *EnterWorktreeTool) Name() string

type Executor

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

Executor runs tool calls with concurrency management.

func NewExecutor

func NewExecutor(registry *Registry, canUseTool types.CanUseToolFn, toolCtx *types.ToolUseContext) *Executor

NewExecutor creates a new tool executor.

func (*Executor) RunTools

func (e *Executor) RunTools(ctx context.Context, calls []ToolCallRequest) []ToolCallResponse

RunTools executes a batch of tool calls, partitioning into concurrent and sequential groups based on tool properties.

type ExitPlanModeTool added in v0.4.0

type ExitPlanModeTool struct{ State *PlanModeState }

ExitPlanModeTool deactivates plan mode and saves the plan.

func NewExitPlanModeTool added in v0.4.0

func NewExitPlanModeTool(state *PlanModeState) *ExitPlanModeTool

NewExitPlanModeTool creates a new ExitPlanModeTool.

func (*ExitPlanModeTool) Call added in v0.4.0

func (t *ExitPlanModeTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*ExitPlanModeTool) Description added in v0.4.0

func (t *ExitPlanModeTool) Description() string

func (*ExitPlanModeTool) InputSchema added in v0.4.0

func (t *ExitPlanModeTool) InputSchema() types.ToolInputSchema

func (*ExitPlanModeTool) IsConcurrencySafe added in v0.4.0

func (t *ExitPlanModeTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*ExitPlanModeTool) IsReadOnly added in v0.4.0

func (t *ExitPlanModeTool) IsReadOnly(input map[string]interface{}) bool

func (*ExitPlanModeTool) Name added in v0.4.0

func (t *ExitPlanModeTool) Name() string

type ExitWorktreeTool added in v0.4.0

type ExitWorktreeTool struct{ Store *WorktreeStore }

ExitWorktreeTool exits and optionally removes a git worktree.

func NewExitWorktreeTool added in v0.4.0

func NewExitWorktreeTool(store *WorktreeStore) *ExitWorktreeTool

NewExitWorktreeTool creates a new ExitWorktreeTool.

func (*ExitWorktreeTool) Call added in v0.4.0

func (t *ExitWorktreeTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*ExitWorktreeTool) Description added in v0.4.0

func (t *ExitWorktreeTool) Description() string

func (*ExitWorktreeTool) InputSchema added in v0.4.0

func (t *ExitWorktreeTool) InputSchema() types.ToolInputSchema

func (*ExitWorktreeTool) IsConcurrencySafe added in v0.4.0

func (t *ExitWorktreeTool) IsConcurrencySafe(_ map[string]interface{}) bool

func (*ExitWorktreeTool) IsReadOnly added in v0.4.0

func (t *ExitWorktreeTool) IsReadOnly(_ map[string]interface{}) bool

func (*ExitWorktreeTool) Name added in v0.4.0

func (t *ExitWorktreeTool) Name() string

type FileEditTool

type FileEditTool struct{}

FileEditTool performs string replacements in files with diff generation, staleness detection, and line ending preservation.

func NewFileEditTool

func NewFileEditTool() *FileEditTool

func (*FileEditTool) Call

func (t *FileEditTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*FileEditTool) Description

func (t *FileEditTool) Description() string

func (*FileEditTool) InputSchema

func (t *FileEditTool) InputSchema() types.ToolInputSchema

func (*FileEditTool) IsConcurrencySafe

func (t *FileEditTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*FileEditTool) IsReadOnly

func (t *FileEditTool) IsReadOnly(input map[string]interface{}) bool

func (*FileEditTool) Name

func (t *FileEditTool) Name() string

type FileReadTool

type FileReadTool struct{}

FileReadTool reads files from the filesystem with support for text, images, PDFs, and Jupyter notebooks.

func NewFileReadTool

func NewFileReadTool() *FileReadTool

func (*FileReadTool) Call

func (t *FileReadTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*FileReadTool) Description

func (t *FileReadTool) Description() string

func (*FileReadTool) InputSchema

func (t *FileReadTool) InputSchema() types.ToolInputSchema

func (*FileReadTool) IsConcurrencySafe

func (t *FileReadTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*FileReadTool) IsReadOnly

func (t *FileReadTool) IsReadOnly(input map[string]interface{}) bool

func (*FileReadTool) Name

func (t *FileReadTool) Name() string

type FileWriteTool

type FileWriteTool struct{}

FileWriteTool writes content to files with staleness detection and diff generation.

func NewFileWriteTool

func NewFileWriteTool() *FileWriteTool

func (*FileWriteTool) Call

func (t *FileWriteTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*FileWriteTool) Description

func (t *FileWriteTool) Description() string

func (*FileWriteTool) InputSchema

func (t *FileWriteTool) InputSchema() types.ToolInputSchema

func (*FileWriteTool) IsConcurrencySafe

func (t *FileWriteTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*FileWriteTool) IsReadOnly

func (t *FileWriteTool) IsReadOnly(input map[string]interface{}) bool

func (*FileWriteTool) Name

func (t *FileWriteTool) Name() string

type GlobTool

type GlobTool struct{}

GlobTool finds files matching glob patterns.

func NewGlobTool

func NewGlobTool() *GlobTool

func (*GlobTool) Call

func (t *GlobTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*GlobTool) Description

func (t *GlobTool) Description() string

func (*GlobTool) InputSchema

func (t *GlobTool) InputSchema() types.ToolInputSchema

func (*GlobTool) IsConcurrencySafe

func (t *GlobTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*GlobTool) IsReadOnly

func (t *GlobTool) IsReadOnly(input map[string]interface{}) bool

func (*GlobTool) Name

func (t *GlobTool) Name() string

type GrepTool

type GrepTool struct{}

GrepTool searches file contents using ripgrep.

func NewGrepTool

func NewGrepTool() *GrepTool

func (*GrepTool) Call

func (t *GrepTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*GrepTool) Description

func (t *GrepTool) Description() string

func (*GrepTool) InputSchema

func (t *GrepTool) InputSchema() types.ToolInputSchema

func (*GrepTool) IsConcurrencySafe

func (t *GrepTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*GrepTool) IsReadOnly

func (t *GrepTool) IsReadOnly(input map[string]interface{}) bool

func (*GrepTool) Name

func (t *GrepTool) Name() string

type LSPTool added in v0.4.0

type LSPTool struct{}

LSPTool provides Language Server Protocol operations via grep-based fallback.

func NewLSPTool added in v0.4.0

func NewLSPTool() *LSPTool

NewLSPTool creates a new LSPTool.

func (*LSPTool) Call added in v0.4.0

func (t *LSPTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*LSPTool) Description added in v0.4.0

func (t *LSPTool) Description() string

func (*LSPTool) InputSchema added in v0.4.0

func (t *LSPTool) InputSchema() types.ToolInputSchema

func (*LSPTool) IsConcurrencySafe added in v0.4.0

func (t *LSPTool) IsConcurrencySafe(_ map[string]interface{}) bool

func (*LSPTool) IsReadOnly added in v0.4.0

func (t *LSPTool) IsReadOnly(_ map[string]interface{}) bool

func (*LSPTool) Name added in v0.4.0

func (t *LSPTool) Name() string

type ListMcpResourcesTool added in v0.4.0

type ListMcpResourcesTool struct{ Client *mcp.Client }

ListMcpResourcesTool lists available resources from connected MCP servers.

func NewListMcpResourcesTool added in v0.4.0

func NewListMcpResourcesTool(client *mcp.Client) *ListMcpResourcesTool

NewListMcpResourcesTool creates a new ListMcpResourcesTool.

func (*ListMcpResourcesTool) Call added in v0.4.0

func (t *ListMcpResourcesTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*ListMcpResourcesTool) Description added in v0.4.0

func (t *ListMcpResourcesTool) Description() string

func (*ListMcpResourcesTool) InputSchema added in v0.4.0

func (t *ListMcpResourcesTool) InputSchema() types.ToolInputSchema

func (*ListMcpResourcesTool) IsConcurrencySafe added in v0.4.0

func (t *ListMcpResourcesTool) IsConcurrencySafe(_ map[string]interface{}) bool

func (*ListMcpResourcesTool) IsReadOnly added in v0.4.0

func (t *ListMcpResourcesTool) IsReadOnly(_ map[string]interface{}) bool

func (*ListMcpResourcesTool) Name added in v0.4.0

func (t *ListMcpResourcesTool) Name() string

type Mailbox added in v0.4.0

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

Mailbox manages inter-agent message queues.

func NewMailbox added in v0.4.0

func NewMailbox() *Mailbox

NewMailbox creates a new Mailbox.

func (*Mailbox) AllNames added in v0.4.0

func (m *Mailbox) AllNames() []string

AllNames returns all registered agent names.

func (*Mailbox) Broadcast added in v0.4.0

func (m *Mailbox) Broadcast(msg AgentMessage)

Broadcast delivers msg to all registered agents atomically.

func (*Mailbox) Read added in v0.4.0

func (m *Mailbox) Read(name string) []AgentMessage

Read drains and returns all messages for the named agent.

func (*Mailbox) Register added in v0.4.0

func (m *Mailbox) Register(name string)

Register adds an agent mailbox (idempotent).

func (*Mailbox) Send added in v0.4.0

func (m *Mailbox) Send(msg AgentMessage)

Send delivers a message to the target mailbox.

type NotebookEditTool added in v0.4.0

type NotebookEditTool struct{}

NotebookEditTool edits Jupyter notebook (.ipynb) cells.

func NewNotebookEditTool added in v0.4.0

func NewNotebookEditTool() *NotebookEditTool

NewNotebookEditTool creates a new NotebookEditTool.

func (*NotebookEditTool) Call added in v0.4.0

func (t *NotebookEditTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*NotebookEditTool) Description added in v0.4.0

func (t *NotebookEditTool) Description() string

func (*NotebookEditTool) InputSchema added in v0.4.0

func (t *NotebookEditTool) InputSchema() types.ToolInputSchema

func (*NotebookEditTool) IsConcurrencySafe added in v0.4.0

func (t *NotebookEditTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*NotebookEditTool) IsReadOnly added in v0.4.0

func (t *NotebookEditTool) IsReadOnly(input map[string]interface{}) bool

func (*NotebookEditTool) Name added in v0.4.0

func (t *NotebookEditTool) Name() string

type PlanModeState added in v0.4.0

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

PlanModeState tracks whether plan mode is active.

func NewPlanModeState added in v0.4.0

func NewPlanModeState() *PlanModeState

NewPlanModeState creates a new PlanModeState.

func (*PlanModeState) GetPlan added in v0.4.0

func (s *PlanModeState) GetPlan() string

GetPlan returns the last saved plan.

func (*PlanModeState) IsActive added in v0.4.0

func (s *PlanModeState) IsActive() bool

IsActive reports whether plan mode is currently active.

type ReadMcpResourceTool added in v0.4.0

type ReadMcpResourceTool struct{ Client *mcp.Client }

ReadMcpResourceTool reads a specific resource from an MCP server.

func NewReadMcpResourceTool added in v0.4.0

func NewReadMcpResourceTool(client *mcp.Client) *ReadMcpResourceTool

NewReadMcpResourceTool creates a new ReadMcpResourceTool.

func (*ReadMcpResourceTool) Call added in v0.4.0

func (t *ReadMcpResourceTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*ReadMcpResourceTool) Description added in v0.4.0

func (t *ReadMcpResourceTool) Description() string

func (*ReadMcpResourceTool) InputSchema added in v0.4.0

func (t *ReadMcpResourceTool) InputSchema() types.ToolInputSchema

func (*ReadMcpResourceTool) IsConcurrencySafe added in v0.4.0

func (t *ReadMcpResourceTool) IsConcurrencySafe(_ map[string]interface{}) bool

func (*ReadMcpResourceTool) IsReadOnly added in v0.4.0

func (t *ReadMcpResourceTool) IsReadOnly(_ map[string]interface{}) bool

func (*ReadMcpResourceTool) Name added in v0.4.0

func (t *ReadMcpResourceTool) Name() string

type Registry

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

Registry manages available tools.

func DefaultRegistry

func DefaultRegistry() *Registry

DefaultRegistry returns a registry with all built-in tools.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates an empty tool registry.

func (*Registry) All

func (r *Registry) All() []types.Tool

All returns all registered tools.

func (*Registry) Filter

func (r *Registry) Filter(fn func(types.Tool) bool) []types.Tool

Filter returns tools matching a filter function.

func (*Registry) Get

func (r *Registry) Get(name string) types.Tool

Get returns a tool by name, or nil if not found.

func (*Registry) Names

func (r *Registry) Names() []string

Names returns all registered tool names.

func (*Registry) Register

func (r *Registry) Register(tool types.Tool)

Register adds a tool to the registry.

type RemoteTriggerTool added in v0.4.0

type RemoteTriggerTool struct{}

RemoteTriggerTool manages remote scheduled agent triggers (stub implementation).

func NewRemoteTriggerTool added in v0.4.0

func NewRemoteTriggerTool() *RemoteTriggerTool

func (*RemoteTriggerTool) Call added in v0.4.0

func (t *RemoteTriggerTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*RemoteTriggerTool) Description added in v0.4.0

func (t *RemoteTriggerTool) Description() string

func (*RemoteTriggerTool) InputSchema added in v0.4.0

func (t *RemoteTriggerTool) InputSchema() types.ToolInputSchema

func (*RemoteTriggerTool) IsConcurrencySafe added in v0.4.0

func (t *RemoteTriggerTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*RemoteTriggerTool) IsReadOnly added in v0.4.0

func (t *RemoteTriggerTool) IsReadOnly(input map[string]interface{}) bool

func (*RemoteTriggerTool) Name added in v0.4.0

func (t *RemoteTriggerTool) Name() string

type SearchResult

type SearchResult struct {
	Title   string `json:"title"`
	URL     string `json:"url"`
	Snippet string `json:"snippet"`
}

SearchResult represents a single search result.

type SendMessageTool added in v0.4.0

type SendMessageTool struct {
	Mailbox *Mailbox
	From    string
}

SendMessageTool sends messages to other agents.

func NewSendMessageTool added in v0.4.0

func NewSendMessageTool(mb *Mailbox, from string) *SendMessageTool

NewSendMessageTool creates a new SendMessageTool.

func (*SendMessageTool) Call added in v0.4.0

func (t *SendMessageTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*SendMessageTool) Description added in v0.4.0

func (t *SendMessageTool) Description() string

func (*SendMessageTool) InputSchema added in v0.4.0

func (t *SendMessageTool) InputSchema() types.ToolInputSchema

func (*SendMessageTool) IsConcurrencySafe added in v0.4.0

func (t *SendMessageTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*SendMessageTool) IsReadOnly added in v0.4.0

func (t *SendMessageTool) IsReadOnly(input map[string]interface{}) bool

func (*SendMessageTool) Name added in v0.4.0

func (t *SendMessageTool) Name() string

type SubagentConfig

type SubagentConfig struct {
	Name         string
	Description  string
	Prompt       string
	Tools        []string
	Model        string
	SystemPrompt string
	CWD          string
}

SubagentConfig defines a subagent to spawn.

type SubagentDefinition

type SubagentDefinition struct {
	Description  string   `json:"description"`
	Instructions string   `json:"instructions"`
	Tools        []string `json:"tools,omitempty"`
	Model        string   `json:"model,omitempty"`
}

SubagentDefinition defines a preconfigured subagent.

type Task

type Task struct {
	ID          string     `json:"id"`
	Subject     string     `json:"subject"`
	Description string     `json:"description"`
	Status      TaskStatus `json:"status"`
	ActiveForm  string     `json:"activeForm,omitempty"`
	Owner       string     `json:"owner,omitempty"`
	CreatedAt   time.Time  `json:"createdAt"`
	UpdatedAt   time.Time  `json:"updatedAt"`
	BlockedBy   []string   `json:"blockedBy,omitempty"`
	Blocks      []string   `json:"blocks,omitempty"`
	Output      string     `json:"output,omitempty"`
}

Task represents a tracked task.

type TaskCreateTool

type TaskCreateTool struct{ Store *TaskStore }

TaskCreateTool creates tasks.

func (*TaskCreateTool) Call

func (t *TaskCreateTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*TaskCreateTool) Description

func (t *TaskCreateTool) Description() string

func (*TaskCreateTool) InputSchema

func (t *TaskCreateTool) InputSchema() types.ToolInputSchema

func (*TaskCreateTool) IsConcurrencySafe

func (t *TaskCreateTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*TaskCreateTool) IsReadOnly

func (t *TaskCreateTool) IsReadOnly(input map[string]interface{}) bool

func (*TaskCreateTool) Name

func (t *TaskCreateTool) Name() string

type TaskGetTool

type TaskGetTool struct{ Store *TaskStore }

TaskGetTool retrieves a task.

func (*TaskGetTool) Call

func (t *TaskGetTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*TaskGetTool) Description

func (t *TaskGetTool) Description() string

func (*TaskGetTool) InputSchema

func (t *TaskGetTool) InputSchema() types.ToolInputSchema

func (*TaskGetTool) IsConcurrencySafe

func (t *TaskGetTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*TaskGetTool) IsReadOnly

func (t *TaskGetTool) IsReadOnly(input map[string]interface{}) bool

func (*TaskGetTool) Name

func (t *TaskGetTool) Name() string

type TaskListTool

type TaskListTool struct{ Store *TaskStore }

TaskListTool lists all tasks.

func (*TaskListTool) Call

func (t *TaskListTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*TaskListTool) Description

func (t *TaskListTool) Description() string

func (*TaskListTool) InputSchema

func (t *TaskListTool) InputSchema() types.ToolInputSchema

func (*TaskListTool) IsConcurrencySafe

func (t *TaskListTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*TaskListTool) IsReadOnly

func (t *TaskListTool) IsReadOnly(input map[string]interface{}) bool

func (*TaskListTool) Name

func (t *TaskListTool) Name() string

type TaskOutputTool added in v0.4.0

type TaskOutputTool struct{ Store *TaskStore }

TaskOutputTool gets the output/result of a task.

func (*TaskOutputTool) Call added in v0.4.0

func (t *TaskOutputTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*TaskOutputTool) Description added in v0.4.0

func (t *TaskOutputTool) Description() string

func (*TaskOutputTool) InputSchema added in v0.4.0

func (t *TaskOutputTool) InputSchema() types.ToolInputSchema

func (*TaskOutputTool) IsConcurrencySafe added in v0.4.0

func (t *TaskOutputTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*TaskOutputTool) IsReadOnly added in v0.4.0

func (t *TaskOutputTool) IsReadOnly(input map[string]interface{}) bool

func (*TaskOutputTool) Name added in v0.4.0

func (t *TaskOutputTool) Name() string

type TaskStatus

type TaskStatus string

TaskStatus represents the status of a task.

const (
	TaskStatusPending    TaskStatus = "pending"
	TaskStatusInProgress TaskStatus = "in_progress"
	TaskStatusCompleted  TaskStatus = "completed"
	TaskStatusDeleted    TaskStatus = "deleted"
	TaskStatusCancelled  TaskStatus = "cancelled"
)

type TaskStopTool added in v0.4.0

type TaskStopTool struct{ Store *TaskStore }

TaskStopTool stops/cancels a running task.

func (*TaskStopTool) Call added in v0.4.0

func (t *TaskStopTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*TaskStopTool) Description added in v0.4.0

func (t *TaskStopTool) Description() string

func (*TaskStopTool) InputSchema added in v0.4.0

func (t *TaskStopTool) InputSchema() types.ToolInputSchema

func (*TaskStopTool) IsConcurrencySafe added in v0.4.0

func (t *TaskStopTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*TaskStopTool) IsReadOnly added in v0.4.0

func (t *TaskStopTool) IsReadOnly(input map[string]interface{}) bool

func (*TaskStopTool) Name added in v0.4.0

func (t *TaskStopTool) Name() string

type TaskStore

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

TaskStore manages tasks in memory.

func NewTaskStore

func NewTaskStore() *TaskStore

NewTaskStore creates a new task store.

func (*TaskStore) Create

func (s *TaskStore) Create(subject, description, activeForm string) *Task

func (*TaskStore) Get

func (s *TaskStore) Get(id string) *Task

func (*TaskStore) List

func (s *TaskStore) List() []*Task

func (*TaskStore) SetOutput added in v0.4.0

func (s *TaskStore) SetOutput(id, output string) bool

func (*TaskStore) Update

func (s *TaskStore) Update(id string, updates map[string]interface{}) *Task

type TaskUpdateTool

type TaskUpdateTool struct{ Store *TaskStore }

TaskUpdateTool updates a task.

func (*TaskUpdateTool) Call

func (t *TaskUpdateTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*TaskUpdateTool) Description

func (t *TaskUpdateTool) Description() string

func (*TaskUpdateTool) InputSchema

func (t *TaskUpdateTool) InputSchema() types.ToolInputSchema

func (*TaskUpdateTool) IsConcurrencySafe

func (t *TaskUpdateTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*TaskUpdateTool) IsReadOnly

func (t *TaskUpdateTool) IsReadOnly(input map[string]interface{}) bool

func (*TaskUpdateTool) Name

func (t *TaskUpdateTool) Name() string

type Team added in v0.4.0

type Team struct {
	ID        string   `json:"id"`
	Name      string   `json:"name"`
	Members   []string `json:"members"`
	CreatedAt string   `json:"createdAt"`
	Status    string   `json:"status"`
}

Team represents a multi-agent team.

type TeamCreateTool added in v0.4.0

type TeamCreateTool struct{ Store *TeamStore }

TeamCreateTool creates a multi-agent team.

func NewTeamCreateTool added in v0.4.0

func NewTeamCreateTool(store *TeamStore) *TeamCreateTool

NewTeamCreateTool creates a new TeamCreateTool.

func (*TeamCreateTool) Call added in v0.4.0

func (t *TeamCreateTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*TeamCreateTool) Description added in v0.4.0

func (t *TeamCreateTool) Description() string

func (*TeamCreateTool) InputSchema added in v0.4.0

func (t *TeamCreateTool) InputSchema() types.ToolInputSchema

func (*TeamCreateTool) IsConcurrencySafe added in v0.4.0

func (t *TeamCreateTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*TeamCreateTool) IsReadOnly added in v0.4.0

func (t *TeamCreateTool) IsReadOnly(input map[string]interface{}) bool

func (*TeamCreateTool) Name added in v0.4.0

func (t *TeamCreateTool) Name() string

type TeamDeleteTool added in v0.4.0

type TeamDeleteTool struct{ Store *TeamStore }

TeamDeleteTool disbands a team.

func NewTeamDeleteTool added in v0.4.0

func NewTeamDeleteTool(store *TeamStore) *TeamDeleteTool

NewTeamDeleteTool creates a new TeamDeleteTool.

func (*TeamDeleteTool) Call added in v0.4.0

func (t *TeamDeleteTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*TeamDeleteTool) Description added in v0.4.0

func (t *TeamDeleteTool) Description() string

func (*TeamDeleteTool) InputSchema added in v0.4.0

func (t *TeamDeleteTool) InputSchema() types.ToolInputSchema

func (*TeamDeleteTool) IsConcurrencySafe added in v0.4.0

func (t *TeamDeleteTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*TeamDeleteTool) IsReadOnly added in v0.4.0

func (t *TeamDeleteTool) IsReadOnly(input map[string]interface{}) bool

func (*TeamDeleteTool) Name added in v0.4.0

func (t *TeamDeleteTool) Name() string

type TeamStore added in v0.4.0

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

TeamStore manages teams in memory.

func NewTeamStore added in v0.4.0

func NewTeamStore() *TeamStore

NewTeamStore creates a new TeamStore.

func (*TeamStore) Create added in v0.4.0

func (s *TeamStore) Create(name string, members []string) *Team

func (*TeamStore) Delete added in v0.4.0

func (s *TeamStore) Delete(id string) (*Team, bool)

func (*TeamStore) List added in v0.4.0

func (s *TeamStore) List() []Team

type TodoItem added in v0.4.0

type TodoItem struct {
	ID       int    `json:"id"`
	Text     string `json:"text"`
	Done     bool   `json:"done"`
	Priority string `json:"priority,omitempty"` // high|medium|low
}

TodoItem represents a single todo entry.

type TodoStore added in v0.4.0

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

TodoStore manages session-scoped todos.

func NewTodoStore added in v0.4.0

func NewTodoStore() *TodoStore

NewTodoStore creates a new TodoStore.

func (*TodoStore) Add added in v0.4.0

func (s *TodoStore) Add(text, priority string) *TodoItem

func (*TodoStore) Clear added in v0.4.0

func (s *TodoStore) Clear()

func (*TodoStore) List added in v0.4.0

func (s *TodoStore) List() []TodoItem

func (*TodoStore) Remove added in v0.4.0

func (s *TodoStore) Remove(id int) bool

func (*TodoStore) Toggle added in v0.4.0

func (s *TodoStore) Toggle(id int) (*TodoItem, bool)

type TodoWriteTool added in v0.4.0

type TodoWriteTool struct{ Store *TodoStore }

TodoWriteTool manages a session todo/checklist.

func NewTodoWriteTool added in v0.4.0

func NewTodoWriteTool(store *TodoStore) *TodoWriteTool

NewTodoWriteTool creates a new TodoWriteTool.

func (*TodoWriteTool) Call added in v0.4.0

func (t *TodoWriteTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*TodoWriteTool) Description added in v0.4.0

func (t *TodoWriteTool) Description() string

func (*TodoWriteTool) InputSchema added in v0.4.0

func (t *TodoWriteTool) InputSchema() types.ToolInputSchema

func (*TodoWriteTool) IsConcurrencySafe added in v0.4.0

func (t *TodoWriteTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*TodoWriteTool) IsReadOnly added in v0.4.0

func (t *TodoWriteTool) IsReadOnly(input map[string]interface{}) bool

func (*TodoWriteTool) Name added in v0.4.0

func (t *TodoWriteTool) Name() string

type ToolCallRequest

type ToolCallRequest struct {
	ToolUseID string
	ToolName  string
	Input     map[string]interface{}
}

ToolCallRequest represents a pending tool call.

type ToolCallResponse

type ToolCallResponse struct {
	ToolUseID string
	Result    *types.ToolResult
	Error     error
}

ToolCallResponse is the result of a tool call execution.

type ToolSearchTool

type ToolSearchTool struct {
	// Registry to search from.
	Registry *Registry
	// DeferredTools are tools announced but not included in the active tool set.
	DeferredTools []types.Tool
}

ToolSearchTool searches for and returns tool schemas. Used for deferred tool discovery — tools announced by name but not loaded until explicitly searched for.

func NewToolSearchTool

func NewToolSearchTool(registry *Registry, deferred []types.Tool) *ToolSearchTool

func (*ToolSearchTool) Call

func (t *ToolSearchTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*ToolSearchTool) Description

func (t *ToolSearchTool) Description() string

func (*ToolSearchTool) InputSchema

func (t *ToolSearchTool) InputSchema() types.ToolInputSchema

func (*ToolSearchTool) IsConcurrencySafe

func (t *ToolSearchTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*ToolSearchTool) IsReadOnly

func (t *ToolSearchTool) IsReadOnly(input map[string]interface{}) bool

func (*ToolSearchTool) Name

func (t *ToolSearchTool) Name() string

type WebFetchTool

type WebFetchTool struct{}

WebFetchTool fetches content from URLs.

func NewWebFetchTool

func NewWebFetchTool() *WebFetchTool

func (*WebFetchTool) Call

func (t *WebFetchTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*WebFetchTool) Description

func (t *WebFetchTool) Description() string

func (*WebFetchTool) InputSchema

func (t *WebFetchTool) InputSchema() types.ToolInputSchema

func (*WebFetchTool) IsConcurrencySafe

func (t *WebFetchTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*WebFetchTool) IsReadOnly

func (t *WebFetchTool) IsReadOnly(input map[string]interface{}) bool

func (*WebFetchTool) Name

func (t *WebFetchTool) Name() string

type WebSearchTool

type WebSearchTool struct {
	// SearchFn is a pluggable search implementation.
	// If nil, the tool returns an error asking to configure a search provider.
	SearchFn func(ctx context.Context, query string, maxResults int) ([]SearchResult, error)
}

WebSearchTool performs web searches. Note: This is a placeholder — actual implementation requires a search API (e.g., Brave Search, Google Custom Search, or a built-in search provider).

func NewWebSearchTool

func NewWebSearchTool() *WebSearchTool

func (*WebSearchTool) Call

func (t *WebSearchTool) Call(ctx context.Context, input map[string]interface{}, tCtx *types.ToolUseContext) (*types.ToolResult, error)

func (*WebSearchTool) Description

func (t *WebSearchTool) Description() string

func (*WebSearchTool) InputSchema

func (t *WebSearchTool) InputSchema() types.ToolInputSchema

func (*WebSearchTool) IsConcurrencySafe

func (t *WebSearchTool) IsConcurrencySafe(input map[string]interface{}) bool

func (*WebSearchTool) IsReadOnly

func (t *WebSearchTool) IsReadOnly(input map[string]interface{}) bool

func (*WebSearchTool) Name

func (t *WebSearchTool) Name() string

type WorktreeEntry added in v0.4.0

type WorktreeEntry struct {
	ID          string
	Path        string
	Branch      string
	OriginalCwd string
}

WorktreeEntry holds metadata for an active git worktree.

type WorktreeStore added in v0.4.0

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

WorktreeStore manages active worktrees in memory.

func NewWorktreeStore added in v0.4.0

func NewWorktreeStore() *WorktreeStore

NewWorktreeStore creates a new WorktreeStore.

func (*WorktreeStore) Add added in v0.4.0

func (s *WorktreeStore) Add(entry *WorktreeEntry)

func (*WorktreeStore) Get added in v0.4.0

func (s *WorktreeStore) Get(id string) (*WorktreeEntry, bool)

func (*WorktreeStore) List added in v0.4.0

func (s *WorktreeStore) List() []string

func (*WorktreeStore) Remove added in v0.4.0

func (s *WorktreeStore) Remove(id string)

Directories

Path Synopsis
Package diff provides unified diff generation.
Package diff provides unified diff generation.

Jump to

Keyboard shortcuts

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