Versions in this module Expand all Collapse all v1 v1.5.0 Oct 12, 2026 Changes in this version + const AbsoluteMaxOutputSize + const DefaultTimeout + const Description + const MaxOutputSize + const MaxTimeout + const MonitorTimeout + const SearchHint + const ToolName + var AcceptEditsReadOnlyCommands = []string + var AcceptEditsWriteCommands = []string + func DefaultTaskDir() string + func DetectShell() string + func GetTaskOutput(taskID string) (string, error) + func GetTaskStatus(taskID string) (string, error) + func IsBackgroundCommand(command string) bool + func KillTask(taskID string) error + func KillTaskProcess(task *BackgroundTask) error + func SandboxAvailable() bool + type BackgroundTask struct + Command string + EndTime *time.Time + ExitCode int + ID string + Output *TaskOutput + Process *exec.Cmd + StartTime time.Time + Status TaskStatus + func (t *BackgroundTask) GetEndTime() *time.Time + func (t *BackgroundTask) GetExitCode() int + func (t *BackgroundTask) GetStatus() TaskStatus + type BackgroundTaskManager struct + func GlobalTaskManager() *BackgroundTaskManager + func NewBackgroundTaskManager(taskDir string) *BackgroundTaskManager + func (m *BackgroundTaskManager) GetTask(id string) *BackgroundTask + func (m *BackgroundTaskManager) Init() error + func (m *BackgroundTaskManager) KillTask(id string) error + func (m *BackgroundTaskManager) ListTasks() []*BackgroundTask + func (m *BackgroundTaskManager) RemoveTask(id string) + func (m *BackgroundTaskManager) StartBackgroundTask(ctx context.Context, command string, workingDir string, env []string, ...) (*BackgroundTask, error) + func (m *BackgroundTaskManager) StartBackgroundTaskArgv(ctx context.Context, name string, args []string, workingDir string, ...) (*BackgroundTask, error) + func (m *BackgroundTaskManager) WaitForTask(id string, timeout time.Duration) (*BackgroundTask, error) + func (m *BackgroundTaskManager) WriteStdin(id string, data string) error + type CommandClassification string + const ClassificationReadOnly + const ClassificationSearch + const ClassificationShell + const ClassificationStateChange + const ClassificationUnknown + const ClassificationVersionControl + const ClassificationWrite + type CommandResult struct + CWD string + Duration int64 + ExitCode int + Sandboxed bool + Stderr string + Stdout string + Timeout bool + type CommandSegment struct + Operator string + Text string + Type SegmentType + type CommandType string + const CommandTypeRead + const CommandTypeSearch + const CommandTypeStateChange + const CommandTypeUnknown + const CommandTypeVersionControl + const CommandTypeWrite + type ExecutionContext struct + Command string + Description string + EnableSandbox bool + MaxOutputSize int64 + OutputChunkCallback func(chunk string, stream string) + RunInBackground bool + SessionID string + Stdin string + Timeout time.Duration + WorkingDirectory string + type JobKillTool struct + func NewJobKillTool() *JobKillTool + func (t *JobKillTool) BackfillInput(_ context.Context, in map[string]any) map[string]any + func (t *JobKillTool) Call(ctx context.Context, input tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error) + func (t *JobKillTool) CheckPermissions(_ context.Context, _ map[string]any, _ tool.ToolUseContext) types.PermissionResult + func (t *JobKillTool) Definition() tool.Definition + func (t *JobKillTool) Description(_ context.Context) (string, error) + func (t *JobKillTool) ExecutesInPlanMode(_ map[string]any) bool + func (t *JobKillTool) FormatResult(data any) string + func (t *JobKillTool) IsConcurrencySafe(_ map[string]any) bool + func (t *JobKillTool) IsEnabled() bool + func (t *JobKillTool) IsReadOnly(_ map[string]any) bool + func (t *JobKillTool) PreparePermissionMatcher(_ context.Context, _ map[string]any) (func(string) bool, error) + func (t *JobKillTool) RequiresUserInteraction() bool + func (t *JobKillTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error) + type JobOutputTool struct + func NewJobOutputTool() *JobOutputTool + func (t *JobOutputTool) BackfillInput(_ context.Context, in map[string]any) map[string]any + func (t *JobOutputTool) Call(ctx context.Context, input tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error) + func (t *JobOutputTool) CheckPermissions(_ context.Context, _ map[string]any, _ tool.ToolUseContext) types.PermissionResult + func (t *JobOutputTool) Definition() tool.Definition + func (t *JobOutputTool) Description(_ context.Context) (string, error) + func (t *JobOutputTool) ExecutesInPlanMode(_ map[string]any) bool + func (t *JobOutputTool) FormatResult(data any) string + func (t *JobOutputTool) IsConcurrencySafe(_ map[string]any) bool + func (t *JobOutputTool) IsEnabled() bool + func (t *JobOutputTool) IsReadOnly(_ map[string]any) bool + func (t *JobOutputTool) PreparePermissionMatcher(_ context.Context, _ map[string]any) (func(string) bool, error) + func (t *JobOutputTool) RequiresUserInteraction() bool + func (t *JobOutputTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error) + type MonitorTool struct + func NewMonitorTool(workingDir string) *MonitorTool + func (t *MonitorTool) BackfillInput(_ context.Context, input map[string]any) map[string]any + func (t *MonitorTool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error) + func (t *MonitorTool) CheckPermissions(_ context.Context, input map[string]any, _ tool.ToolUseContext) types.PermissionResult + func (t *MonitorTool) Definition() tool.Definition + func (t *MonitorTool) Description(_ context.Context) (string, error) + func (t *MonitorTool) FormatResult(data any) string + func (t *MonitorTool) IsConcurrencySafe(_ map[string]any) bool + func (t *MonitorTool) IsEnabled() bool + func (t *MonitorTool) IsReadOnly(_ map[string]any) bool + func (t *MonitorTool) ValidateInput(_ context.Context, input map[string]any) (map[string]any, error) + type ParsedCommand struct + EnvVars map[string]string + HasRedirections bool + IsCompound bool + Original string + Segments []CommandSegment + type Parser struct + func NewParser() *Parser + func (p *Parser) GetCommandType(command string) CommandType + func (p *Parser) IsSilentCommand(command string) bool + func (p *Parser) ParseCommand(command string) *ParsedCommand + type SecurityValidator struct + func NewSecurityValidator() *SecurityValidator + func (v *SecurityValidator) GetCommandClassification(command string) CommandClassification + func (v *SecurityValidator) ValidateCommand(command string) *SecurityViolation + func (v *SecurityValidator) ValidateGitCommand(command string) *SecurityViolation + func (v *SecurityValidator) ValidateWorkspace(command string, workspaceRoot string) *SecurityViolation + type SecurityViolation struct + Command string + Reason string + Severity Severity + Violation string + func (v *SecurityViolation) Error() string + type SegmentType string + const SegmentTypeCommand + const SegmentTypeLogical + const SegmentTypePipe + const SegmentTypeRedirection + const SegmentTypeSequential + type Severity string + const SeverityCritical + const SeverityHigh + const SeverityLow + const SeverityMedium + type TaskOutput struct + Path string + StderrBuffer []byte + StdoutBuffer []byte + func NewTaskOutput(path string) *TaskOutput + type TaskOutputReader struct + func NewTaskOutputReader(taskID string) (*TaskOutputReader, error) + func NewTaskOutputReaderFrom(manager *BackgroundTaskManager, taskID string) (*TaskOutputReader, error) + func (r *TaskOutputReader) IsRunning() bool + func (r *TaskOutputReader) ReadOutput() (string, error) + type TaskStatus int + const TaskStatusBackgrounded + const TaskStatusCompleted + const TaskStatusKilled + const TaskStatusRunning + const TaskStatusTimeout + type Tool struct + func NewTool(config *ToolConfig) *Tool + func (t *Tool) BackfillInput(_ context.Context, input map[string]any) map[string]any + func (t *Tool) Call(ctx context.Context, input tool.CallInput, permissionCheck types.CanUseToolFn) (tool.CallResult, error) + func (t *Tool) CheckPermissions(_ context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult + func (t *Tool) Definition() tool.Definition + func (t *Tool) Description(_ context.Context) (string, error) + func (t *Tool) FormatResult(data any) string + func (t *Tool) IsConcurrencySafe(input map[string]any) bool + func (t *Tool) IsEnabled() bool + func (t *Tool) IsReadOnly(input map[string]any) bool + func (t *Tool) PreparePermissionMatcher(_ context.Context, input map[string]any) (func(ruleContent string) bool, error) + func (t *Tool) SandboxKind() sandbox.EnvironmentKind + func (t *Tool) ValidateInput(_ context.Context, input map[string]any) (map[string]any, error) + type ToolConfig struct + EnableSandbox bool + MaxOutputSize int64 + OutputChunkCallback func(chunk string, stream string) + RequireSandbox bool + SandboxDocker sandbox.DockerExecutorConfig + SandboxKind sandbox.EnvironmentKind + Timeout time.Duration + WorkingDirectory string + func DefaultToolConfig() *ToolConfig + type WriteStdinTool struct + func NewWriteStdinTool() *WriteStdinTool + func (t *WriteStdinTool) BackfillInput(_ context.Context, in map[string]any) map[string]any + func (t *WriteStdinTool) Call(ctx context.Context, input tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error) + func (t *WriteStdinTool) CheckPermissions(_ context.Context, _ map[string]any, _ tool.ToolUseContext) types.PermissionResult + func (t *WriteStdinTool) Definition() tool.Definition + func (t *WriteStdinTool) Description(_ context.Context) (string, error) + func (t *WriteStdinTool) FormatResult(data any) string + func (t *WriteStdinTool) IsConcurrencySafe(_ map[string]any) bool + func (t *WriteStdinTool) IsEnabled() bool + func (t *WriteStdinTool) IsReadOnly(_ map[string]any) bool + func (t *WriteStdinTool) PreparePermissionMatcher(_ context.Context, _ map[string]any) (func(string) bool, error) + func (t *WriteStdinTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)