tools

package
v0.34.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package tools exposes the reusable tool contracts and safe local tool implementations used by TARS agent loops. The package is additive: TARS' server-only session, cron, and runtime wiring remain internal, while small agent applications can compose registries, file tools, shell tools, web tools, and memory tools directly.

Index

Constants

View Source
const (
	RegistryScopeAny        = internal.RegistryScopeAny
	RegistryScopeUser       = internal.RegistryScopeUser
	RegistryScopePulse      = internal.RegistryScopePulse
	RegistryScopeReflection = internal.RegistryScopeReflection
)
View Source
const (
	StreamStdout = internal.StreamStdout
	StreamStderr = internal.StreamStderr
)

Variables

This section is empty.

Functions

func CanonicalToolName

func CanonicalToolName(name string) string

func ExpandToolGroups

func ExpandToolGroups(groupNames []string, known map[string]struct{}) (validGroups []string, expandedTools []string, unknownGroups []string)

func ExpandToolPatterns

func ExpandToolPatterns(patterns []string, known map[string]struct{}) (validPatterns []string, matchedTools []string, invalidPatterns []string)

func IsExecToolName

func IsExecToolName(name string) bool

func IsHighRiskToolName

func IsHighRiskToolName(name string) bool

func KnownToolGroupNames

func KnownToolGroupNames() []string

func KnownToolGroups

func KnownToolGroups(known map[string]struct{}) map[string][]string

func MustJSON

func MustJSON(value any) json.RawMessage

func NormalizeToolGroupName

func NormalizeToolGroupName(name string) string

func ToolGroupForName

func ToolGroupForName(name string) string

func ToolNameAliases

func ToolNameAliases() map[string]string

func WithLineEmitter

func WithLineEmitter(ctx context.Context, emitter LineEmitter) context.Context

func WithToolOutputStreamer

func WithToolOutputStreamer(ctx context.Context, streamer ToolOutputStreamer) context.Context

Types

type BlockedToolError

type BlockedToolError = internal.BlockedToolError

func ParseBlockedToolError

func ParseBlockedToolError(err error) (BlockedToolError, bool)

type ContentBlock

type ContentBlock = internal.ContentBlock

type ExecToolOptions

type ExecToolOptions = internal.ExecToolOptions

type LineEmitter

type LineEmitter = internal.LineEmitter

func LineEmitterFromContext

func LineEmitterFromContext(ctx context.Context) LineEmitter

type PathPolicy

type PathPolicy = internal.PathPolicy

func NewPathPolicy

func NewPathPolicy(workspaceDir string, workDirs []string, currentDir string) PathPolicy

func SingleDirPolicy

func SingleDirPolicy(workspaceDir string) PathPolicy

type Policy

type Policy = internal.Policy

type PolicyResolution

type PolicyResolution = internal.PolicyResolution

type ProcessManager

type ProcessManager = internal.ProcessManager

func NewProcessManager

func NewProcessManager() *ProcessManager

type ProcessSnapshot

type ProcessSnapshot = internal.ProcessSnapshot

type Registry

type Registry = internal.Registry

func NewRegistry

func NewRegistry() *Registry

func NewRegistryWithScope

func NewRegistryWithScope(scope RegistryScope) *Registry

type RegistryScope

type RegistryScope = internal.RegistryScope

type Result

type Result = internal.Result

func JSONTextResult

func JSONTextResult(value any, isError bool) Result

type Tool

type Tool = internal.Tool

func NewApplyPatchTool

func NewApplyPatchTool(workspaceDir string, enabled bool) Tool

func NewEditFileTool

func NewEditFileTool(workspaceDir string) Tool

func NewEditFileToolWithPolicy

func NewEditFileToolWithPolicy(policy PathPolicy) Tool

func NewEditTool

func NewEditTool(workspaceDir string) Tool

func NewExecTool

func NewExecTool(workspaceDir string) Tool

func NewExecToolWithManager

func NewExecToolWithManager(workspaceDir string, manager *ProcessManager) Tool

func NewExecToolWithOptions

func NewExecToolWithOptions(policy PathPolicy, manager *ProcessManager, opts ExecToolOptions) Tool

func NewExecToolWithPolicy

func NewExecToolWithPolicy(policy PathPolicy, manager *ProcessManager) Tool

func NewGlobTool

func NewGlobTool(workspaceDir string) Tool

func NewGlobToolWithPolicy

func NewGlobToolWithPolicy(policy PathPolicy) Tool

func NewListDirTool

func NewListDirTool(workspaceDir string) Tool

func NewListDirToolWithPolicy

func NewListDirToolWithPolicy(policy PathPolicy) Tool

func NewMemoryGetTool

func NewMemoryGetTool(workspaceDir string, backend internalmemory.Backend) Tool

func NewMemorySaveTool

func NewMemorySaveTool(backend internalmemory.Backend, nowFn func() time.Time) Tool

func NewMemorySearchTool

func NewMemorySearchTool(workspaceDir string, backend internalmemory.Backend) Tool

func NewMemoryTool

func NewMemoryTool(workspaceDir string, backend internalmemory.Backend, nowFn func() time.Time) Tool

func NewProcessTool

func NewProcessTool(manager *ProcessManager) Tool

func NewProjectSkillToolWithPolicy

func NewProjectSkillToolWithPolicy(policy PathPolicy) Tool

func NewReadFileTool

func NewReadFileTool(workspaceDir string) Tool

func NewReadFileToolWithPolicy

func NewReadFileToolWithPolicy(policy PathPolicy) Tool

func NewReadTool

func NewReadTool(workspaceDir string) Tool

func NewWebFetchTool

func NewWebFetchTool(enabled bool) Tool

func NewWebFetchToolWithOptions

func NewWebFetchToolWithOptions(opts WebFetchOptions) Tool

func NewWebSearchTool

func NewWebSearchTool(enabled bool, apiKey string) Tool

func NewWebSearchToolWithOptions

func NewWebSearchToolWithOptions(opts WebSearchOptions) Tool

func NewWriteFileTool

func NewWriteFileTool(workspaceDir string) Tool

func NewWriteFileToolWithPolicy

func NewWriteFileToolWithPolicy(policy PathPolicy) Tool

func NewWriteTool

func NewWriteTool(workspaceDir string) Tool

type ToolOutputStreamer

type ToolOutputStreamer = internal.ToolOutputStreamer

func BindLineEmitter

func BindLineEmitter(emitter LineEmitter, toolCallID string) ToolOutputStreamer

func ToolOutputStreamerFromContext

func ToolOutputStreamerFromContext(ctx context.Context) ToolOutputStreamer

type WebFetchOptions

type WebFetchOptions = internal.WebFetchOptions

type WebSearchOptions

type WebSearchOptions = internal.WebSearchOptions

Jump to

Keyboard shortcuts

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