tool

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AskUserKindSingle = "single"
	AskUserKindMulti  = "multi"
	AskUserKindText   = "text"

	AskUserStatusSubmitted = "submitted"
	AskUserStatusCancelled = "cancelled"

	AskUserCompletionUnanswered = "unanswered"
	AskUserCompletionPartial    = "partial"
	AskUserCompletionAnswered   = "answered"

	AskUserAnswerModeNone                 = "none"
	AskUserAnswerModeFreeformOnly         = "freeform_only"
	AskUserAnswerModeSelectionOnly        = "selection_only"
	AskUserAnswerModeSelectionAndFreeform = "selection_and_freeform"
)

Variables

This section is empty.

Functions

func CheckpointSaver added in v1.1.50

func CheckpointSaver(mgr *checkpoint.Manager) func(filePath, oldContent, newContent, toolCall string) error

CheckpointSaver returns a pre-write hook that saves checkpoints to the given manager. This is the standard hook used by TUI/daemon/ACP modes. Checkpoint saving is in-memory only; errors are logged but do not abort writes.

func FormatToolInline added in v1.1.49

func FormatToolInline(name, detail string) string

FormatToolInline combines DisplayName and Detail into a single display string, matching the TUI format: "Read /tmp/test.go" or "go test ./...".

func RegisterBuiltinTools

func RegisterBuiltinTools(registry *Registry, policy permission.PermissionPolicy, workingDir string) error

RegisterBuiltinTools registers all built-in tools. If policy is nil, no sandbox path checking is enforced (permissive mode).

func RelativizePath added in v1.1.49

func RelativizePath(path, workingDir string) string

RelativizePath tries to make an absolute path relative to workingDir.

func SetPreWriteHook added in v1.1.50

func SetPreWriteHook(fn func(filePath, oldContent, newContent, toolCall string) error)

SetPreWriteHook sets a global hook called before file writes. The hook receives (filePath, oldContent, newContent, toolName) and is used to save undo checkpoints. If the hook returns an error, the write is aborted.

func StripHTML

func StripHTML(s string) string

StripHTML removes HTML tags and decodes common entities.

func TodoDir added in v1.1.7

func TodoDir(workspace string) string

func TodoFilePath added in v1.1.7

func TodoFilePath(workspace string) string

func ToolDef

func ToolDef(t Tool) provider.ToolDefinition

ToolDef creates a provider.ToolDefinition from a Tool.

Types

type AllowedPathChecker

type AllowedPathChecker func(path string) bool

AllowedPathChecker is a function that checks if a path is allowed by sandbox policy.

type AskUserAnswer added in v1.1.12

type AskUserAnswer struct {
	ID                string   `json:"id"`
	Title             string   `json:"title"`
	Kind              string   `json:"kind"`
	CompletionStatus  string   `json:"completion_status"`
	AnswerMode        string   `json:"answer_mode"`
	Answered          bool     `json:"answered"`
	SelectedChoiceIDs []string `json:"selected_choice_ids,omitempty"`
	SelectedChoices   []string `json:"selected_choices,omitempty"`
	FreeformText      string   `json:"freeform_text,omitempty"`
}

type AskUserChoice added in v1.1.12

type AskUserChoice struct {
	ID    string `json:"id"`
	Label string `json:"label"`
}

type AskUserHandler added in v1.1.12

type AskUserHandler func(context.Context, AskUserRequest) (AskUserResponse, error)

type AskUserQuestion added in v1.1.12

type AskUserQuestion struct {
	ID            string          `json:"id"`
	Title         string          `json:"title"`
	Prompt        string          `json:"prompt"`
	Kind          string          `json:"kind"`
	Choices       []AskUserChoice `json:"choices,omitempty"`
	AllowFreeform bool            `json:"allow_freeform,omitempty"`
	Placeholder   string          `json:"placeholder,omitempty"`
}

type AskUserRequest added in v1.1.12

type AskUserRequest struct {
	Title     string            `json:"title,omitempty"`
	Questions []AskUserQuestion `json:"questions"`
}

type AskUserResponse added in v1.1.12

type AskUserResponse struct {
	Status        string          `json:"status"`
	Title         string          `json:"title,omitempty"`
	QuestionCount int             `json:"question_count"`
	AnsweredCount int             `json:"answered_count"`
	Answers       []AskUserAnswer `json:"answers"`
}

type AskUserTool added in v1.1.12

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

func NewAskUserTool added in v1.1.12

func NewAskUserTool() *AskUserTool

func (*AskUserTool) Description added in v1.1.12

func (t *AskUserTool) Description() string

func (*AskUserTool) Execute added in v1.1.12

func (t *AskUserTool) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (*AskUserTool) HasHandler added in v1.1.15

func (t *AskUserTool) HasHandler() bool

func (*AskUserTool) Name added in v1.1.12

func (t *AskUserTool) Name() string

func (*AskUserTool) Parameters added in v1.1.12

func (t *AskUserTool) Parameters() json.RawMessage

func (*AskUserTool) SetHandler added in v1.1.12

func (t *AskUserTool) SetHandler(handler AskUserHandler)

type BackgroundTaskProvider added in v1.1.45

type BackgroundTaskProvider interface {
	GetTaskOutput(taskID string) (string, bool)
}

BackgroundTaskProvider retrieves output from background tasks (subagents, shell jobs).

type Cloner added in v1.2.7

type Cloner interface {
	Clone() Tool
}

Cloner is an optional interface that tools can implement to provide a deep copy. Tools that hold mutable state (e.g., WorkingDir) MUST implement Clone so that each agent gets its own independent tool instances. Tools without mutable state can safely skip this interface — they will be shared between agents.

This is critical for correctness in concurrent scenarios (sub-agents, swarm teammates using different worktrees). Without cloning, syncToolWorkingDir would mutate a shared WorkingDir field, causing tool executions to land in the wrong directory.

type CommandGate added in v1.1.45

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

CommandGate performs safety checks on shell commands before execution. Inspired by Claude Code's bashSecurity.ts architecture:

Layer 1: Pre-checks — control chars, injection patterns, parser differentials Layer 2: Catastrophic block — patterns with zero legitimate use Layer 3: Destructive warning — informational, doesn't block

The gate runs regardless of autopilot mode. In supervised mode, "ask" results prompt the user. In autopilot mode, "ask" results still block execution unless an explicit override is configured.

func NewCommandGate added in v1.1.45

func NewCommandGate() *CommandGate

NewCommandGate creates the command safety gate with all rules.

func (*CommandGate) Check added in v1.1.45

func (g *CommandGate) Check(cmd string) GateResult

Check evaluates a command against all safety rules. Returns a GateResult with Behavior = Allow, Ask, or Block.

func (*CommandGate) IsDestructive added in v1.1.45

func (g *CommandGate) IsDestructive(cmd string) bool

IsDestructive returns true if the command matches any block or ask rule.

type CommandJob

type CommandJob struct {
	ID           string
	Command      string
	Status       CommandJobStatus
	Timeout      time.Duration
	StartedAt    time.Time
	EndedAt      time.Time
	TotalLines   int
	BufferedFrom int
	Lines        []string
	ErrText      string
	// contains filtered or unexported fields
}

type CommandJobManager

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

func NewCommandJobManager

func NewCommandJobManager(workingDir string) *CommandJobManager

func (*CommandJobManager) AutoBackground added in v1.1.45

func (m *CommandJobManager) AutoBackground(cmd *exec.Cmd, command string, initialStdout, initialStderr string) string

AutoBackground adopts an already-running command process into a background job. The caller loses ownership of cmd — the job manager will Wait for it and capture output. initialStdout/initialStderr is output already captured before the migration.

func (*CommandJobManager) List

func (*CommandJobManager) Read

func (m *CommandJobManager) Read(id string, tailLines, sinceLine int) (CommandJobSnapshot, error)

func (*CommandJobManager) Start

func (m *CommandJobManager) Start(ctx context.Context, command string, timeout time.Duration) (*CommandJobSnapshot, error)

func (*CommandJobManager) Stop

func (*CommandJobManager) Wait

func (m *CommandJobManager) Wait(ctx context.Context, id string, wait time.Duration, tailLines, sinceLine int) (CommandJobSnapshot, error)

func (*CommandJobManager) Write added in v1.0.23

func (m *CommandJobManager) Write(id, input string, appendNewline bool) (CommandJobSnapshot, error)

type CommandJobSnapshot

type CommandJobSnapshot struct {
	ID            string
	Command       string
	Status        CommandJobStatus
	Timeout       time.Duration
	StartedAt     time.Time
	EndedAt       time.Time
	TotalLines    int
	BufferedFrom  int
	Lines         []string
	Duration      time.Duration
	ErrText       string
	Running       bool
	TruncatedHead bool
}

type CommandJobStatus

type CommandJobStatus string
const (
	CommandJobRunning   CommandJobStatus = "running"
	CommandJobCompleted CommandJobStatus = "completed"
	CommandJobFailed    CommandJobStatus = "failed"
	CommandJobCancelled CommandJobStatus = "cancelled"
	CommandJobTimedOut  CommandJobStatus = "timed_out"
)

type ConfigAccess added in v1.1.45

type ConfigAccess interface {
	Get(key string) (string, bool)
	Set(key, value string) error
	List() map[string]string
}

ConfigAccess provides read/write access to runtime configuration.

type ConfigTool added in v1.1.45

type ConfigTool struct {
	Access ConfigAccess
}

ConfigTool reads or writes a configuration setting. When value is provided, it writes; otherwise it reads.

func (ConfigTool) Description added in v1.1.45

func (t ConfigTool) Description() string

func (ConfigTool) Execute added in v1.1.45

func (t ConfigTool) Execute(_ context.Context, input json.RawMessage) (Result, error)

func (ConfigTool) Name added in v1.1.45

func (t ConfigTool) Name() string

func (ConfigTool) Parameters added in v1.1.45

func (t ConfigTool) Parameters() json.RawMessage

type CronCreateTool added in v1.1.45

type CronCreateTool struct {
	Scheduler *cron.Scheduler
}

CronCreateTool creates a new scheduled job.

func (CronCreateTool) Description added in v1.1.45

func (t CronCreateTool) Description() string

func (CronCreateTool) Execute added in v1.1.45

func (t CronCreateTool) Execute(_ context.Context, input json.RawMessage) (Result, error)

func (CronCreateTool) Name added in v1.1.45

func (t CronCreateTool) Name() string

func (CronCreateTool) Parameters added in v1.1.45

func (t CronCreateTool) Parameters() json.RawMessage

type CronDeleteTool added in v1.1.45

type CronDeleteTool struct {
	Scheduler *cron.Scheduler
}

CronDeleteTool deletes a scheduled job.

func (CronDeleteTool) Description added in v1.1.45

func (t CronDeleteTool) Description() string

func (CronDeleteTool) Execute added in v1.1.45

func (t CronDeleteTool) Execute(_ context.Context, input json.RawMessage) (Result, error)

func (CronDeleteTool) Name added in v1.1.45

func (t CronDeleteTool) Name() string

func (CronDeleteTool) Parameters added in v1.1.45

func (t CronDeleteTool) Parameters() json.RawMessage

type CronListTool added in v1.1.45

type CronListTool struct {
	Scheduler *cron.Scheduler
}

CronListTool lists all scheduled jobs.

func (CronListTool) Description added in v1.1.45

func (t CronListTool) Description() string

func (CronListTool) Execute added in v1.1.45

func (t CronListTool) Execute(_ context.Context, _ json.RawMessage) (Result, error)

func (CronListTool) Name added in v1.1.45

func (t CronListTool) Name() string

func (CronListTool) Parameters added in v1.1.45

func (t CronListTool) Parameters() json.RawMessage

type EditFile

type EditFile struct {
	SandboxCheck AllowedPathChecker
}

EditFile implements the edit_file tool for find-and-replace editing.

func (EditFile) Description

func (t EditFile) Description() string

func (EditFile) Execute

func (t EditFile) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (EditFile) Name

func (t EditFile) Name() string

func (EditFile) Parameters

func (t EditFile) Parameters() json.RawMessage

type EnterPlanModeTool added in v1.1.45

type EnterPlanModeTool struct {
	Switcher ModeSwitcher
}

func (EnterPlanModeTool) Description added in v1.1.45

func (t EnterPlanModeTool) Description() string

func (EnterPlanModeTool) Execute added in v1.1.45

func (EnterPlanModeTool) Name added in v1.1.45

func (t EnterPlanModeTool) Name() string

func (EnterPlanModeTool) Parameters added in v1.1.45

func (t EnterPlanModeTool) Parameters() json.RawMessage

type EnterWorktree added in v1.1.45

type EnterWorktree struct {
	WorkingDir string
}

EnterWorktree creates a new git worktree for isolated work.

func (EnterWorktree) Clone added in v1.2.7

func (t EnterWorktree) Clone() Tool

Clone returns an independent copy of EnterWorktree for use by a different agent.

func (EnterWorktree) Description added in v1.1.45

func (t EnterWorktree) Description() string

func (EnterWorktree) Execute added in v1.1.45

func (t EnterWorktree) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (EnterWorktree) Name added in v1.1.45

func (t EnterWorktree) Name() string

func (EnterWorktree) Parameters added in v1.1.45

func (t EnterWorktree) Parameters() json.RawMessage

type ExitPlanModeTool added in v1.1.45

type ExitPlanModeTool struct {
	Switcher    ModeSwitcher
	DefaultMode permission.PermissionMode
}

func (ExitPlanModeTool) Description added in v1.1.45

func (t ExitPlanModeTool) Description() string

func (ExitPlanModeTool) Execute added in v1.1.45

func (t ExitPlanModeTool) Execute(_ context.Context, input json.RawMessage) (Result, error)

func (ExitPlanModeTool) Name added in v1.1.45

func (t ExitPlanModeTool) Name() string

func (ExitPlanModeTool) Parameters added in v1.1.45

func (t ExitPlanModeTool) Parameters() json.RawMessage

type ExitWorktree added in v1.1.45

type ExitWorktree struct {
	WorkingDir string
}

ExitWorktree exits and optionally removes a git worktree.

func (ExitWorktree) Clone added in v1.2.7

func (t ExitWorktree) Clone() Tool

Clone returns an independent copy of ExitWorktree for use by a different agent.

func (ExitWorktree) Description added in v1.1.45

func (t ExitWorktree) Description() string

func (ExitWorktree) Execute added in v1.1.45

func (t ExitWorktree) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (ExitWorktree) Name added in v1.1.45

func (t ExitWorktree) Name() string

func (ExitWorktree) Parameters added in v1.1.45

func (t ExitWorktree) Parameters() json.RawMessage

type GateBehavior added in v1.1.45

type GateBehavior int
const (
	Allow GateBehavior = iota
	Ask
	Block
)

type GateResult added in v1.1.45

type GateResult struct {
	Behavior   GateBehavior
	CleanedCmd string   // sanitized command (may differ from original)
	Reason     string   // human-readable explanation
	Warnings   []string // informational warnings (shown but don't affect flow)
}

GateResult is the outcome of a command gate check.

func (GateResult) Allowed added in v1.1.45

func (r GateResult) Allowed() bool

Allowed returns true if the command can execute without confirmation.

func (GateResult) IsBlocked added in v1.1.45

func (r GateResult) IsBlocked() bool

IsBlocked returns true if the command must never execute.

func (GateResult) NeedsConfirmation added in v1.1.45

func (r GateResult) NeedsConfirmation() bool

NeedsConfirmation returns true if the command requires user approval.

type GetMCPPromptTool

type GetMCPPromptTool struct {
	Runtime MCPRuntime
}

func (GetMCPPromptTool) Description

func (t GetMCPPromptTool) Description() string

func (GetMCPPromptTool) Execute

func (t GetMCPPromptTool) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (GetMCPPromptTool) Name

func (t GetMCPPromptTool) Name() string

func (GetMCPPromptTool) Parameters

func (t GetMCPPromptTool) Parameters() json.RawMessage

type GitAdd added in v1.1.45

type GitAdd struct {
	WorkingDir string
}

GitAdd implements the git_add tool.

func (GitAdd) Clone added in v1.2.7

func (t GitAdd) Clone() Tool

Clone returns an independent copy of this tool for use by a different agent.

func (GitAdd) Description added in v1.1.45

func (t GitAdd) Description() string

func (GitAdd) Execute added in v1.1.45

func (t GitAdd) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (GitAdd) Name added in v1.1.45

func (t GitAdd) Name() string

func (GitAdd) Parameters added in v1.1.45

func (t GitAdd) Parameters() json.RawMessage

type GitBlame added in v1.1.45

type GitBlame struct{ WorkingDir string }

GitBlame implements the git_blame tool.

func (GitBlame) Clone added in v1.2.7

func (t GitBlame) Clone() Tool

Clone returns an independent copy of this tool for use by a different agent.

func (GitBlame) Description added in v1.1.45

func (t GitBlame) Description() string

func (GitBlame) Execute added in v1.1.45

func (t GitBlame) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (GitBlame) Name added in v1.1.45

func (t GitBlame) Name() string

func (GitBlame) Parameters added in v1.1.45

func (t GitBlame) Parameters() json.RawMessage

type GitBranchList added in v1.1.45

type GitBranchList struct{ WorkingDir string }

GitBranchList implements the git_branch_list tool.

func (GitBranchList) Clone added in v1.2.7

func (t GitBranchList) Clone() Tool

Clone returns an independent copy of this tool for use by a different agent.

func (GitBranchList) Description added in v1.1.45

func (t GitBranchList) Description() string

func (GitBranchList) Execute added in v1.1.45

func (t GitBranchList) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (GitBranchList) Name added in v1.1.45

func (t GitBranchList) Name() string

func (GitBranchList) Parameters added in v1.1.45

func (t GitBranchList) Parameters() json.RawMessage

type GitCommit added in v1.1.45

type GitCommit struct{ WorkingDir string }

GitCommit implements the git_commit tool.

func (GitCommit) Clone added in v1.2.7

func (t GitCommit) Clone() Tool

Clone returns an independent copy of this tool for use by a different agent.

func (GitCommit) Description added in v1.1.45

func (t GitCommit) Description() string

func (GitCommit) Execute added in v1.1.45

func (t GitCommit) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (GitCommit) Name added in v1.1.45

func (t GitCommit) Name() string

func (GitCommit) Parameters added in v1.1.45

func (t GitCommit) Parameters() json.RawMessage

type GitDiff

type GitDiff struct{ WorkingDir string }

GitDiff implements the git_diff tool.

func (GitDiff) Clone added in v1.2.7

func (t GitDiff) Clone() Tool

Clone returns an independent copy of this tool for use by a different agent.

func (GitDiff) Description

func (t GitDiff) Description() string

func (GitDiff) Execute

func (t GitDiff) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (GitDiff) Name

func (t GitDiff) Name() string

func (GitDiff) Parameters

func (t GitDiff) Parameters() json.RawMessage

type GitLog

type GitLog struct{ WorkingDir string }

GitLog implements the git_log tool.

func (GitLog) Clone added in v1.2.7

func (t GitLog) Clone() Tool

Clone returns an independent copy of this tool for use by a different agent.

func (GitLog) Description

func (t GitLog) Description() string

func (GitLog) Execute

func (t GitLog) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (GitLog) Name

func (t GitLog) Name() string

func (GitLog) Parameters

func (t GitLog) Parameters() json.RawMessage

type GitRemote added in v1.1.45

type GitRemote struct{ WorkingDir string }

GitRemote implements the git_remote tool.

func (GitRemote) Clone added in v1.2.7

func (t GitRemote) Clone() Tool

Clone returns an independent copy of this tool for use by a different agent.

func (GitRemote) Description added in v1.1.45

func (t GitRemote) Description() string

func (GitRemote) Execute added in v1.1.45

func (t GitRemote) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (GitRemote) Name added in v1.1.45

func (t GitRemote) Name() string

func (GitRemote) Parameters added in v1.1.45

func (t GitRemote) Parameters() json.RawMessage

type GitShow added in v1.1.45

type GitShow struct{ WorkingDir string }

GitShow implements the git_show tool.

func (GitShow) Clone added in v1.2.7

func (t GitShow) Clone() Tool

Clone returns an independent copy of this tool for use by a different agent.

func (GitShow) Description added in v1.1.45

func (t GitShow) Description() string

func (GitShow) Execute added in v1.1.45

func (t GitShow) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (GitShow) Name added in v1.1.45

func (t GitShow) Name() string

func (GitShow) Parameters added in v1.1.45

func (t GitShow) Parameters() json.RawMessage

type GitStash added in v1.1.45

type GitStash struct{ WorkingDir string }

GitStash implements the git_stash tool for push/pop/apply/drop operations.

func (GitStash) Clone added in v1.2.7

func (t GitStash) Clone() Tool

Clone returns an independent copy of this tool for use by a different agent.

func (GitStash) Description added in v1.1.45

func (t GitStash) Description() string

func (GitStash) Execute added in v1.1.45

func (t GitStash) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (GitStash) Name added in v1.1.45

func (t GitStash) Name() string

func (GitStash) Parameters added in v1.1.45

func (t GitStash) Parameters() json.RawMessage

type GitStashList added in v1.1.45

type GitStashList struct{ WorkingDir string }

GitStashList implements the git_stash_list tool.

func (GitStashList) Clone added in v1.2.7

func (t GitStashList) Clone() Tool

Clone returns an independent copy of this tool for use by a different agent.

func (GitStashList) Description added in v1.1.45

func (t GitStashList) Description() string

func (GitStashList) Execute added in v1.1.45

func (t GitStashList) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (GitStashList) Name added in v1.1.45

func (t GitStashList) Name() string

func (GitStashList) Parameters added in v1.1.45

func (t GitStashList) Parameters() json.RawMessage

type GitStatus

type GitStatus struct{ WorkingDir string }

GitStatus implements the git_status tool.

func (GitStatus) Clone added in v1.2.7

func (t GitStatus) Clone() Tool

Clone returns an independent copy of this tool for use by a different agent.

func (GitStatus) Description

func (t GitStatus) Description() string

func (GitStatus) Execute

func (t GitStatus) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (GitStatus) Name

func (t GitStatus) Name() string

func (GitStatus) Parameters

func (t GitStatus) Parameters() json.RawMessage

type Glob

type Glob struct {
	SandboxCheck AllowedPathChecker
}

Glob implements the glob tool for file path matching.

func (Glob) Description

func (t Glob) Description() string

func (Glob) Execute

func (t Glob) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (Glob) Name

func (t Glob) Name() string

func (Glob) Parameters

func (t Glob) Parameters() json.RawMessage

type Grep added in v1.1.45

type Grep struct {
	SandboxCheck AllowedPathChecker
}

Grep implements a powerful file content search tool (ripgrep wrapper with Go fallback).

func (Grep) Description added in v1.1.45

func (t Grep) Description() string

func (Grep) Execute added in v1.1.45

func (t Grep) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (Grep) Name added in v1.1.45

func (t Grep) Name() string

func (Grep) Parameters added in v1.1.45

func (t Grep) Parameters() json.RawMessage

type ListAgentsTool

type ListAgentsTool struct {
	Manager *subagent.Manager
}

ListAgentsTool implements the list_agents tool.

func (ListAgentsTool) Description

func (t ListAgentsTool) Description() string

func (ListAgentsTool) Execute

func (t ListAgentsTool) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (ListAgentsTool) Name

func (t ListAgentsTool) Name() string

func (ListAgentsTool) Parameters

func (t ListAgentsTool) Parameters() json.RawMessage

type ListCommandsTool

type ListCommandsTool struct {
	Manager *CommandJobManager
}

func (ListCommandsTool) Description

func (t ListCommandsTool) Description() string

func (ListCommandsTool) Execute

func (t ListCommandsTool) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (ListCommandsTool) Name

func (t ListCommandsTool) Name() string

func (ListCommandsTool) Parameters

func (t ListCommandsTool) Parameters() json.RawMessage

type ListDir

type ListDir struct {
	SandboxCheck AllowedPathChecker
}

ListDir implements the list_directory tool.

func (ListDir) Description

func (t ListDir) Description() string

func (ListDir) Execute

func (t ListDir) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (ListDir) Name

func (t ListDir) Name() string

func (ListDir) Parameters

func (t ListDir) Parameters() json.RawMessage

type ListMCPCapabilitiesTool

type ListMCPCapabilitiesTool struct {
	Runtime MCPRuntime
}

func (ListMCPCapabilitiesTool) Description

func (t ListMCPCapabilitiesTool) Description() string

func (ListMCPCapabilitiesTool) Execute

func (ListMCPCapabilitiesTool) Name

func (ListMCPCapabilitiesTool) Parameters

func (t ListMCPCapabilitiesTool) Parameters() json.RawMessage

type MCPPromptMessage

type MCPPromptMessage struct {
	Role string
	Text string
	Raw  string
}

type MCPPromptResult

type MCPPromptResult struct {
	Description string
	Messages    []MCPPromptMessage
}

type MCPResourceContent

type MCPResourceContent struct {
	URI      string
	MIMEType string
	Text     string
	Blob     string
}

type MCPResourceResult

type MCPResourceResult struct {
	Contents []MCPResourceContent
}

type MCPRuntime

type MCPRuntime interface {
	SnapshotMCP() []MCPServerSnapshot
	GetPrompt(ctx context.Context, server, name string, args map[string]interface{}) (*MCPPromptResult, error)
	ReadResource(ctx context.Context, server, uri string) (*MCPResourceResult, error)
}

type MCPServerSnapshot

type MCPServerSnapshot struct {
	Name          string
	Connected     bool
	Pending       bool
	Error         string
	ToolNames     []string
	PromptNames   []string
	ResourceNames []string
}

type ModeSwitcher added in v1.1.45

type ModeSwitcher interface {
	SetMode(mode permission.PermissionMode)
	// RememberMode saves the given mode as the "previous" mode so it
	// can be restored by a later mode switch. Returns the mode that
	// was previously remembered (SupervisedMode if none).
	RememberMode(mode permission.PermissionMode) permission.PermissionMode
	// RestoreMode returns the remembered mode, or the given fallback.
	RestoreMode(fallback permission.PermissionMode) permission.PermissionMode
}

ModeSwitcher switches the agent's permission mode and remembers the previous mode so that exit_plan_mode can restore it.

type MultiEditFile added in v1.1.45

type MultiEditFile struct {
	SandboxCheck AllowedPathChecker
}

MultiEditFile applies multiple find-and-replace edits to a single file in one call.

func (MultiEditFile) Description added in v1.1.45

func (t MultiEditFile) Description() string

func (MultiEditFile) Execute added in v1.1.45

func (t MultiEditFile) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (MultiEditFile) Name added in v1.1.45

func (t MultiEditFile) Name() string

func (MultiEditFile) Parameters added in v1.1.45

func (t MultiEditFile) Parameters() json.RawMessage

type NotebookEdit added in v1.1.45

type NotebookEdit struct {
	SandboxCheck AllowedPathChecker
}

NotebookEdit edits Jupyter Notebook (.ipynb) cells.

func (NotebookEdit) Description added in v1.1.45

func (t NotebookEdit) Description() string

func (NotebookEdit) Execute added in v1.1.45

func (t NotebookEdit) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (NotebookEdit) Name added in v1.1.45

func (t NotebookEdit) Name() string

func (NotebookEdit) Parameters added in v1.1.45

func (t NotebookEdit) Parameters() json.RawMessage

type ReadCommandOutputTool

type ReadCommandOutputTool struct {
	Manager *CommandJobManager
}

func (ReadCommandOutputTool) Description

func (t ReadCommandOutputTool) Description() string

func (ReadCommandOutputTool) Execute

func (t ReadCommandOutputTool) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (ReadCommandOutputTool) Name

func (t ReadCommandOutputTool) Name() string

func (ReadCommandOutputTool) Parameters

func (t ReadCommandOutputTool) Parameters() json.RawMessage

type ReadFile

type ReadFile struct {
	SandboxCheck AllowedPathChecker
}

ReadFile implements the read_file tool.

func (ReadFile) Description

func (t ReadFile) Description() string

func (ReadFile) Execute

func (t ReadFile) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (ReadFile) Name

func (t ReadFile) Name() string

func (ReadFile) Parameters

func (t ReadFile) Parameters() json.RawMessage

type ReadMCPResourceTool

type ReadMCPResourceTool struct {
	Runtime MCPRuntime
}

func (ReadMCPResourceTool) Description

func (t ReadMCPResourceTool) Description() string

func (ReadMCPResourceTool) Execute

func (t ReadMCPResourceTool) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (ReadMCPResourceTool) Name

func (t ReadMCPResourceTool) Name() string

func (ReadMCPResourceTool) Parameters

func (t ReadMCPResourceTool) Parameters() json.RawMessage

type Registry

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

Registry manages the set of available tools.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates an empty tool registry.

func (*Registry) Clone added in v1.2.7

func (r *Registry) Clone() *Registry

Clone creates a deep copy of the registry. Tools implementing the Cloner interface are individually cloned; others are shared (they are stateless). This is used when creating sub-agents and swarm teammates so each agent has its own independent tool instances with separate WorkingDir fields.

func (*Registry) Get

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

Get returns a tool by name.

func (*Registry) List

func (r *Registry) List() []Tool

List returns all registered tools.

func (*Registry) Register

func (r *Registry) Register(t Tool) error

Register adds a tool to the registry. Returns error if name is already taken.

func (*Registry) ToDefinitions

func (r *Registry) ToDefinitions() []provider.ToolDefinition

ToDefinitions converts all tools to provider.ToolDefinition for the LLM.

func (*Registry) ToolNames

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

ToolNames returns the names of all registered tools.

func (*Registry) Unregister

func (r *Registry) Unregister(name string) bool

Unregister removes a tool by name.

type Result

type Result struct {
	Content string        `json:"content"`
	IsError bool          `json:"is_error"`
	Images  []ResultImage `json:"images,omitempty"`
	// SuggestedWorkingDir is an optional hint from a tool that the agent's
	// working directory should change. When non-empty, the agent loop will
	// update its WorkingDir to this value so subsequent tool calls (e.g.
	// run_command, read_file) operate in the new directory automatically.
	SuggestedWorkingDir string `json:"suggested_working_dir,omitempty"`
	// FollowUpMessages are additional messages injected after the tool_result.
	// Used by inline skills to inject skill instructions as a user message,
	// forcing the model to process and act on them.
	FollowUpMessages []provider.Message `json:"follow_up_messages,omitempty"`
}

Result is the output returned to the LLM. IsError: true means the tool execution had a user-visible error (shown to LLM). The Go error return is for system-level failures only (panic recovery, etc).

type ResultImage added in v1.1.34

type ResultImage struct {
	MIME       string `json:"mime"`        // "image/png", "image/jpeg", etc.
	Base64     string `json:"base64"`      // base64-encoded image data
	Width      int    `json:"width"`       // original pixel width (0 if unknown)
	Height     int    `json:"height"`      // original pixel height (0 if unknown)
	SourcePath string `json:"source_path"` // file path the image was read from
}

ResultImage carries a single image within a tool Result.

type RunCommand

type RunCommand struct {
	// WorkingDir is the fixed working directory set by the agent.
	// LLM-provided working_dir is ignored to prevent sandbox escape.
	WorkingDir string
	// JobManager is used to auto-background long-running commands.
	JobManager *CommandJobManager
	// Policy provides the current permission mode. When set and the mode
	// is Bypass or Autopilot, "Ask" gate results are automatically downgraded
	// to Allow (with a warning log) instead of blocking execution.
	Policy permission.PermissionPolicy
}

RunCommand implements the run_command tool for executing shell commands.

func (RunCommand) Clone added in v1.2.7

func (t RunCommand) Clone() Tool

Clone returns an independent copy of this tool for use by a different agent.

func (RunCommand) Description

func (t RunCommand) Description() string

func (RunCommand) Execute

func (t RunCommand) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (RunCommand) Name

func (t RunCommand) Name() string

func (RunCommand) Parameters

func (t RunCommand) Parameters() json.RawMessage

type SaveMemoryTool

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

SaveMemoryTool lets the agent save experiences to persistent memory.

func NewSaveMemoryTool

func NewSaveMemoryTool(globalMem, projectMem *memory.AutoMemory) *SaveMemoryTool

NewSaveMemoryTool creates a save_memory tool with global and project memory.

func (*SaveMemoryTool) Description

func (t *SaveMemoryTool) Description() string

func (*SaveMemoryTool) Execute

func (t *SaveMemoryTool) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (*SaveMemoryTool) Name

func (t *SaveMemoryTool) Name() string

func (*SaveMemoryTool) Parameters

func (t *SaveMemoryTool) Parameters() json.RawMessage

type SearchFiles

type SearchFiles struct {
	SandboxCheck AllowedPathChecker
}

SearchFiles implements the search_files tool (grep-like content search).

func (SearchFiles) Description

func (t SearchFiles) Description() string

func (SearchFiles) Execute

func (t SearchFiles) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (SearchFiles) Name

func (t SearchFiles) Name() string

func (SearchFiles) Parameters

func (t SearchFiles) Parameters() json.RawMessage

type SendMessageTool added in v1.1.45

type SendMessageTool struct {
	Manager  *subagent.Manager
	SwarmMgr *swarm.Manager
}

SendMessageTool sends a message to one or all running sub-agents or swarm teammates.

func (SendMessageTool) Description added in v1.1.45

func (t SendMessageTool) Description() string

func (SendMessageTool) Execute added in v1.1.45

func (t SendMessageTool) Execute(_ context.Context, input json.RawMessage) (Result, error)

func (SendMessageTool) Name added in v1.1.45

func (t SendMessageTool) Name() string

func (SendMessageTool) Parameters added in v1.1.45

func (t SendMessageTool) Parameters() json.RawMessage

type SkillExecutionEvent added in v1.1.43

type SkillExecutionEvent struct {
	Name   string
	Ref    string
	Scope  string
	Mode   SkillExecutionMode
	Result Result
	Err    error
}

type SkillExecutionMode added in v1.1.43

type SkillExecutionMode string
const (
	SkillExecutionModeInline SkillExecutionMode = "inline"
	SkillExecutionModeFork   SkillExecutionMode = "fork"
	SkillExecutionModeMCP    SkillExecutionMode = "mcp"
)

type SkillLookup

type SkillLookup interface {
	Get(name string) (*commands.Command, bool)
}

type SkillTool

type SkillTool struct {
	Skills           SkillLookup
	Runtime          MCPRuntime
	Provider         provider.Provider
	Tools            *Registry
	AgentFactory     subagent.AgentFactory
	WorkingDir       string                          // working directory to propagate to sub-agent
	OnSkillUsed      func(ref string)                // optional callback when a skill is loaded by the agent
	OnSkillCompleted func(event SkillExecutionEvent) // optional callback when execution finishes
}

func (SkillTool) Clone added in v1.2.7

func (t SkillTool) Clone() Tool

Clone returns an independent copy of SkillTool for use by a different agent. Skills, Runtime, Provider, Tools, AgentFactory, and callbacks are shared. Only WorkingDir is agent-specific.

func (SkillTool) Description

func (t SkillTool) Description() string

func (SkillTool) Execute

func (t SkillTool) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (SkillTool) Name

func (t SkillTool) Name() string

func (SkillTool) Parameters

func (t SkillTool) Parameters() json.RawMessage

type SleepTool added in v1.1.45

type SleepTool struct{}

SleepTool pauses execution for a specified duration.

func (SleepTool) Description added in v1.1.45

func (t SleepTool) Description() string

func (SleepTool) Execute added in v1.1.45

func (t SleepTool) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (SleepTool) Name added in v1.1.45

func (t SleepTool) Name() string

func (SleepTool) Parameters added in v1.1.45

func (t SleepTool) Parameters() json.RawMessage

type SpawnAgentTool

type SpawnAgentTool struct {
	Manager      *subagent.Manager
	Provider     provider.Provider
	Tools        *Registry
	AgentFactory subagent.AgentFactory
	WorkingDir   string // working directory to propagate to sub-agent
}

SpawnAgentTool implements the spawn_agent tool.

func (SpawnAgentTool) Clone added in v1.2.7

func (t SpawnAgentTool) Clone() Tool

Clone returns an independent copy of SpawnAgentTool for use by a different agent. Manager, Provider, AgentFactory, and Tools are intentionally shared across agents (they coordinate sub-agent lifecycle). Only WorkingDir is agent-specific.

func (SpawnAgentTool) Description

func (t SpawnAgentTool) Description() string

func (SpawnAgentTool) Execute

func (t SpawnAgentTool) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (SpawnAgentTool) Name

func (t SpawnAgentTool) Name() string

func (SpawnAgentTool) Parameters

func (t SpawnAgentTool) Parameters() json.RawMessage

type StartCommandTool

type StartCommandTool struct {
	Manager *CommandJobManager
	Policy  permission.PermissionPolicy
}

func (StartCommandTool) Description

func (t StartCommandTool) Description() string

func (StartCommandTool) Execute

func (t StartCommandTool) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (StartCommandTool) Name

func (t StartCommandTool) Name() string

func (StartCommandTool) Parameters

func (t StartCommandTool) Parameters() json.RawMessage

type StopCommandTool

type StopCommandTool struct {
	Manager *CommandJobManager
}

func (StopCommandTool) Description

func (t StopCommandTool) Description() string

func (StopCommandTool) Execute

func (t StopCommandTool) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (StopCommandTool) Name

func (t StopCommandTool) Name() string

func (StopCommandTool) Parameters

func (t StopCommandTool) Parameters() json.RawMessage

type SwarmTaskClaimTool added in v1.1.45

type SwarmTaskClaimTool struct {
	Manager *swarm.Manager
}

func (SwarmTaskClaimTool) Description added in v1.1.45

func (t SwarmTaskClaimTool) Description() string

func (SwarmTaskClaimTool) Execute added in v1.1.45

func (t SwarmTaskClaimTool) Execute(_ context.Context, input json.RawMessage) (Result, error)

func (SwarmTaskClaimTool) Name added in v1.1.45

func (t SwarmTaskClaimTool) Name() string

func (SwarmTaskClaimTool) Parameters added in v1.1.45

func (t SwarmTaskClaimTool) Parameters() json.RawMessage

type SwarmTaskCompleteTool added in v1.1.45

type SwarmTaskCompleteTool struct {
	Manager *swarm.Manager
}

func (SwarmTaskCompleteTool) Description added in v1.1.45

func (t SwarmTaskCompleteTool) Description() string

func (SwarmTaskCompleteTool) Execute added in v1.1.45

func (SwarmTaskCompleteTool) Name added in v1.1.45

func (t SwarmTaskCompleteTool) Name() string

func (SwarmTaskCompleteTool) Parameters added in v1.1.45

func (t SwarmTaskCompleteTool) Parameters() json.RawMessage

type SwarmTaskCreateTool added in v1.1.45

type SwarmTaskCreateTool struct {
	Manager *swarm.Manager
}

func (SwarmTaskCreateTool) Description added in v1.1.45

func (t SwarmTaskCreateTool) Description() string

func (SwarmTaskCreateTool) Execute added in v1.1.45

func (SwarmTaskCreateTool) Name added in v1.1.45

func (t SwarmTaskCreateTool) Name() string

func (SwarmTaskCreateTool) Parameters added in v1.1.45

func (t SwarmTaskCreateTool) Parameters() json.RawMessage

type SwarmTaskListTool added in v1.1.45

type SwarmTaskListTool struct {
	Manager *swarm.Manager
}

func (SwarmTaskListTool) Description added in v1.1.45

func (t SwarmTaskListTool) Description() string

func (SwarmTaskListTool) Execute added in v1.1.45

func (t SwarmTaskListTool) Execute(_ context.Context, input json.RawMessage) (Result, error)

func (SwarmTaskListTool) Name added in v1.1.45

func (t SwarmTaskListTool) Name() string

func (SwarmTaskListTool) Parameters added in v1.1.45

func (t SwarmTaskListTool) Parameters() json.RawMessage

type TaskCreateTool added in v1.1.45

type TaskCreateTool struct {
	Manager *task.Manager
}

func (TaskCreateTool) Description added in v1.1.45

func (t TaskCreateTool) Description() string

func (TaskCreateTool) Execute added in v1.1.45

func (t TaskCreateTool) Execute(_ context.Context, input json.RawMessage) (Result, error)

func (TaskCreateTool) Name added in v1.1.45

func (t TaskCreateTool) Name() string

func (TaskCreateTool) Parameters added in v1.1.45

func (t TaskCreateTool) Parameters() json.RawMessage

type TaskGetTool added in v1.1.45

type TaskGetTool struct {
	Manager *task.Manager
}

func (TaskGetTool) Description added in v1.1.45

func (t TaskGetTool) Description() string

func (TaskGetTool) Execute added in v1.1.45

func (t TaskGetTool) Execute(_ context.Context, input json.RawMessage) (Result, error)

func (TaskGetTool) Name added in v1.1.45

func (t TaskGetTool) Name() string

func (TaskGetTool) Parameters added in v1.1.45

func (t TaskGetTool) Parameters() json.RawMessage

type TaskListTool added in v1.1.45

type TaskListTool struct {
	Manager *task.Manager
}

func (TaskListTool) Description added in v1.1.45

func (t TaskListTool) Description() string

func (TaskListTool) Execute added in v1.1.45

func (t TaskListTool) Execute(_ context.Context, _ json.RawMessage) (Result, error)

func (TaskListTool) Name added in v1.1.45

func (t TaskListTool) Name() string

func (TaskListTool) Parameters added in v1.1.45

func (t TaskListTool) Parameters() json.RawMessage

type TaskOutputTool added in v1.1.45

type TaskOutputTool struct {
	Provider BackgroundTaskProvider
}

TaskOutputTool retrieves the output of a background task by ID.

func (TaskOutputTool) Description added in v1.1.45

func (t TaskOutputTool) Description() string

func (TaskOutputTool) Execute added in v1.1.45

func (t TaskOutputTool) Execute(_ context.Context, input json.RawMessage) (Result, error)

func (TaskOutputTool) Name added in v1.1.45

func (t TaskOutputTool) Name() string

func (TaskOutputTool) Parameters added in v1.1.45

func (t TaskOutputTool) Parameters() json.RawMessage

type TaskStopTool added in v1.1.45

type TaskStopTool struct {
	Manager *task.Manager
}

func (TaskStopTool) Description added in v1.1.45

func (t TaskStopTool) Description() string

func (TaskStopTool) Execute added in v1.1.45

func (t TaskStopTool) Execute(_ context.Context, input json.RawMessage) (Result, error)

func (TaskStopTool) Name added in v1.1.45

func (t TaskStopTool) Name() string

func (TaskStopTool) Parameters added in v1.1.45

func (t TaskStopTool) Parameters() json.RawMessage

type TaskUpdateTool added in v1.1.45

type TaskUpdateTool struct {
	Manager *task.Manager
}

func (TaskUpdateTool) Description added in v1.1.45

func (t TaskUpdateTool) Description() string

func (TaskUpdateTool) Execute added in v1.1.45

func (t TaskUpdateTool) Execute(_ context.Context, input json.RawMessage) (Result, error)

func (TaskUpdateTool) Name added in v1.1.45

func (t TaskUpdateTool) Name() string

func (TaskUpdateTool) Parameters added in v1.1.45

func (t TaskUpdateTool) Parameters() json.RawMessage

type TeamCreateTool added in v1.1.45

type TeamCreateTool struct {
	Manager *swarm.Manager
}

func (TeamCreateTool) Description added in v1.1.45

func (t TeamCreateTool) Description() string

func (TeamCreateTool) Execute added in v1.1.45

func (t TeamCreateTool) Execute(_ context.Context, input json.RawMessage) (Result, error)

func (TeamCreateTool) Name added in v1.1.45

func (t TeamCreateTool) Name() string

func (TeamCreateTool) Parameters added in v1.1.45

func (t TeamCreateTool) Parameters() json.RawMessage

type TeamDeleteTool added in v1.1.45

type TeamDeleteTool struct {
	Manager *swarm.Manager
}

func (TeamDeleteTool) Description added in v1.1.45

func (t TeamDeleteTool) Description() string

func (TeamDeleteTool) Execute added in v1.1.45

func (t TeamDeleteTool) Execute(_ context.Context, input json.RawMessage) (Result, error)

func (TeamDeleteTool) Name added in v1.1.45

func (t TeamDeleteTool) Name() string

func (TeamDeleteTool) Parameters added in v1.1.45

func (t TeamDeleteTool) Parameters() json.RawMessage

type TeammateListTool added in v1.1.45

type TeammateListTool struct {
	Manager *swarm.Manager
}

func (TeammateListTool) Description added in v1.1.45

func (t TeammateListTool) Description() string

func (TeammateListTool) Execute added in v1.1.45

func (t TeammateListTool) Execute(_ context.Context, input json.RawMessage) (Result, error)

func (TeammateListTool) Name added in v1.1.45

func (t TeammateListTool) Name() string

func (TeammateListTool) Parameters added in v1.1.45

func (t TeammateListTool) Parameters() json.RawMessage

type TeammateResultsTool added in v1.1.45

type TeammateResultsTool struct {
	Manager *swarm.Manager
}

func (TeammateResultsTool) Description added in v1.1.45

func (t TeammateResultsTool) Description() string

func (TeammateResultsTool) Execute added in v1.1.45

func (TeammateResultsTool) Name added in v1.1.45

func (t TeammateResultsTool) Name() string

func (TeammateResultsTool) Parameters added in v1.1.45

func (t TeammateResultsTool) Parameters() json.RawMessage

type TeammateShutdownTool added in v1.1.45

type TeammateShutdownTool struct {
	Manager *swarm.Manager
}

func (TeammateShutdownTool) Description added in v1.1.45

func (t TeammateShutdownTool) Description() string

func (TeammateShutdownTool) Execute added in v1.1.45

func (TeammateShutdownTool) Name added in v1.1.45

func (t TeammateShutdownTool) Name() string

func (TeammateShutdownTool) Parameters added in v1.1.45

func (t TeammateShutdownTool) Parameters() json.RawMessage

type TeammateSpawnTool added in v1.1.45

type TeammateSpawnTool struct {
	Manager *swarm.Manager
}

func (TeammateSpawnTool) Description added in v1.1.45

func (t TeammateSpawnTool) Description() string

func (TeammateSpawnTool) Execute added in v1.1.45

func (t TeammateSpawnTool) Execute(_ context.Context, input json.RawMessage) (Result, error)

func (TeammateSpawnTool) Name added in v1.1.45

func (t TeammateSpawnTool) Name() string

func (TeammateSpawnTool) Parameters added in v1.1.45

func (t TeammateSpawnTool) Parameters() json.RawMessage

type Todo

type Todo struct {
	ID      string `json:"id"`
	Content string `json:"content"`
	Status  string `json:"status"` // "pending", "in_progress", "done"
}

Todo represents a single todo item.

type TodoWrite

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

TodoWrite implements the todo_write tool — manages a persistent todo list.

func NewTodoWrite

func NewTodoWrite(dir string) *TodoWrite

NewTodoWrite creates a TodoWrite tool. dir defaults to ~/.ggcode.

func NewWorkspaceTodoWrite added in v1.1.7

func NewWorkspaceTodoWrite(workspace string) *TodoWrite

func (*TodoWrite) Description

func (t *TodoWrite) Description() string

func (*TodoWrite) Execute

func (t *TodoWrite) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (*TodoWrite) ListTodos

func (t *TodoWrite) ListTodos() ([]Todo, error)

ListTodos reads and returns all todos from disk.

func (*TodoWrite) Name

func (t *TodoWrite) Name() string

func (*TodoWrite) Parameters

func (t *TodoWrite) Parameters() json.RawMessage

type Tool

type Tool interface {
	// Name returns the unique tool identifier (e.g., "read_file").
	Name() string

	// Description returns a human-readable description shown to the LLM.
	Description() string

	// Parameters returns a JSON Schema object describing the tool's input.
	// Must be a valid JSON object with "type": "object" at minimum.
	Parameters() json.RawMessage

	// Execute runs the tool with the given input and returns the result.
	Execute(ctx context.Context, input json.RawMessage) (Result, error)
}

Tool is the interface every tool (built-in, MCP-adapted, or plugin) must implement.

func NewLSPTools added in v1.1.25

func NewLSPTools(workingDir string, readSandbox, writeSandbox AllowedPathChecker) []Tool

type ToolPresentation added in v1.1.49

type ToolPresentation struct {
	DisplayName string // e.g. "Read", "Edit", "go test ./..."
	Detail      string // e.g. "/tmp/test.go", ""
}

ToolPresentation holds the human-readable display info for a tool call.

func DescribeTool added in v1.1.49

func DescribeTool(toolName, rawArgs string) ToolPresentation

DescribeTool returns a human-readable presentation for a tool call. It picks the key argument(s) for each tool and formats them compactly. This is the shared implementation used by TUI, daemon, IM, and ACP.

type WaitAgentTool

type WaitAgentTool struct {
	Manager *subagent.Manager
}

WaitAgentTool implements the wait_agent tool.

func (WaitAgentTool) Description

func (t WaitAgentTool) Description() string

func (WaitAgentTool) Execute

func (t WaitAgentTool) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (WaitAgentTool) Name

func (t WaitAgentTool) Name() string

func (WaitAgentTool) Parameters

func (t WaitAgentTool) Parameters() json.RawMessage

type WaitCommandTool

type WaitCommandTool struct {
	Manager *CommandJobManager
}

func (WaitCommandTool) Description

func (t WaitCommandTool) Description() string

func (WaitCommandTool) Execute

func (t WaitCommandTool) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (WaitCommandTool) Name

func (t WaitCommandTool) Name() string

func (WaitCommandTool) Parameters

func (t WaitCommandTool) Parameters() json.RawMessage

type WebFetch

type WebFetch struct {
	// AllowPrivate disables SSRF protection. Only use for testing.
	AllowPrivate bool
}

WebFetch implements the web_fetch tool — fetches a URL and returns text content.

func (WebFetch) Description

func (t WebFetch) Description() string

func (WebFetch) Execute

func (t WebFetch) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (WebFetch) Name

func (t WebFetch) Name() string

func (WebFetch) Parameters

func (t WebFetch) Parameters() json.RawMessage

type WebSearch

type WebSearch struct{}

WebSearch implements the web_search tool — searches using DuckDuckGo HTML.

func (WebSearch) Description

func (t WebSearch) Description() string

func (WebSearch) Execute

func (t WebSearch) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (WebSearch) Name

func (t WebSearch) Name() string

func (WebSearch) Parameters

func (t WebSearch) Parameters() json.RawMessage

type WriteCommandInputTool added in v1.0.23

type WriteCommandInputTool struct {
	Manager *CommandJobManager
}

func (WriteCommandInputTool) Description added in v1.0.23

func (t WriteCommandInputTool) Description() string

func (WriteCommandInputTool) Execute added in v1.0.23

func (t WriteCommandInputTool) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (WriteCommandInputTool) Name added in v1.0.23

func (t WriteCommandInputTool) Name() string

func (WriteCommandInputTool) Parameters added in v1.0.23

func (t WriteCommandInputTool) Parameters() json.RawMessage

type WriteFile

type WriteFile struct {
	SandboxCheck AllowedPathChecker
}

WriteFile implements the write_file tool.

func (WriteFile) Description

func (t WriteFile) Description() string

func (WriteFile) Execute

func (t WriteFile) Execute(ctx context.Context, input json.RawMessage) (Result, error)

func (WriteFile) Name

func (t WriteFile) Name() string

func (WriteFile) Parameters

func (t WriteFile) Parameters() json.RawMessage

Jump to

Keyboard shortcuts

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