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
- func CanonicalToolName(name string) string
- func ExpandToolGroups(groupNames []string, known map[string]struct{}) (validGroups []string, expandedTools []string, unknownGroups []string)
- func ExpandToolPatterns(patterns []string, known map[string]struct{}) (validPatterns []string, matchedTools []string, invalidPatterns []string)
- func IsExecToolName(name string) bool
- func IsHighRiskToolName(name string) bool
- func KnownToolGroupNames() []string
- func KnownToolGroups(known map[string]struct{}) map[string][]string
- func MustJSON(value any) json.RawMessage
- func NormalizeToolGroupName(name string) string
- func ToolGroupForName(name string) string
- func ToolNameAliases() map[string]string
- func WithLineEmitter(ctx context.Context, emitter LineEmitter) context.Context
- func WithToolOutputStreamer(ctx context.Context, streamer ToolOutputStreamer) context.Context
- type BlockedToolError
- type ContentBlock
- type ExecToolOptions
- type LineEmitter
- type PathPolicy
- type Policy
- type PolicyResolution
- type ProcessManager
- type ProcessSnapshot
- type Registry
- type RegistryScope
- type Result
- type Tool
- func NewApplyPatchTool(workspaceDir string, enabled bool) Tool
- func NewEditFileTool(workspaceDir string) Tool
- func NewEditFileToolWithPolicy(policy PathPolicy) Tool
- func NewEditTool(workspaceDir string) Tool
- func NewExecTool(workspaceDir string) Tool
- func NewExecToolWithManager(workspaceDir string, manager *ProcessManager) Tool
- func NewExecToolWithOptions(policy PathPolicy, manager *ProcessManager, opts ExecToolOptions) Tool
- func NewExecToolWithPolicy(policy PathPolicy, manager *ProcessManager) Tool
- func NewGlobTool(workspaceDir string) Tool
- func NewGlobToolWithPolicy(policy PathPolicy) Tool
- func NewListDirTool(workspaceDir string) Tool
- func NewListDirToolWithPolicy(policy PathPolicy) Tool
- func NewMemoryGetTool(workspaceDir string, backend internalmemory.Backend) Tool
- func NewMemorySaveTool(backend internalmemory.Backend, nowFn func() time.Time) Tool
- func NewMemorySearchTool(workspaceDir string, backend internalmemory.Backend) Tool
- func NewMemoryTool(workspaceDir string, backend internalmemory.Backend, nowFn func() time.Time) Tool
- func NewProcessTool(manager *ProcessManager) Tool
- func NewProjectSkillToolWithPolicy(policy PathPolicy) Tool
- func NewReadFileTool(workspaceDir string) Tool
- func NewReadFileToolWithPolicy(policy PathPolicy) Tool
- func NewReadTool(workspaceDir string) Tool
- func NewWebFetchTool(enabled bool) Tool
- func NewWebFetchToolWithOptions(opts WebFetchOptions) Tool
- func NewWebSearchTool(enabled bool, apiKey string) Tool
- func NewWebSearchToolWithOptions(opts WebSearchOptions) Tool
- func NewWriteFileTool(workspaceDir string) Tool
- func NewWriteFileToolWithPolicy(policy PathPolicy) Tool
- func NewWriteTool(workspaceDir string) Tool
- type ToolOutputStreamer
- type WebFetchOptions
- type WebSearchOptions
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 ExpandToolGroups ¶
func ExpandToolPatterns ¶
func IsExecToolName ¶
func IsHighRiskToolName ¶
func KnownToolGroupNames ¶
func KnownToolGroupNames() []string
func KnownToolGroups ¶
func MustJSON ¶
func MustJSON(value any) json.RawMessage
func NormalizeToolGroupName ¶
func ToolGroupForName ¶
func ToolNameAliases ¶
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 PolicyResolution ¶
type PolicyResolution = internal.PolicyResolution
type ProcessManager ¶
type ProcessManager = internal.ProcessManager
func NewProcessManager ¶
func NewProcessManager() *ProcessManager
type ProcessSnapshot ¶
type ProcessSnapshot = internal.ProcessSnapshot
type Registry ¶
func NewRegistry ¶
func NewRegistry() *Registry
func NewRegistryWithScope ¶
func NewRegistryWithScope(scope RegistryScope) *Registry
type RegistryScope ¶
type RegistryScope = internal.RegistryScope
type Result ¶
func JSONTextResult ¶
type Tool ¶
func NewApplyPatchTool ¶
func NewEditFileTool ¶
func NewEditFileToolWithPolicy ¶
func NewEditFileToolWithPolicy(policy PathPolicy) Tool
func NewEditTool ¶
func NewExecTool ¶
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 NewGlobToolWithPolicy ¶
func NewGlobToolWithPolicy(policy PathPolicy) Tool
func NewListDirTool ¶
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 NewProcessTool ¶
func NewProcessTool(manager *ProcessManager) Tool
func NewProjectSkillToolWithPolicy ¶
func NewProjectSkillToolWithPolicy(policy PathPolicy) Tool
func NewReadFileTool ¶
func NewReadFileToolWithPolicy ¶
func NewReadFileToolWithPolicy(policy PathPolicy) Tool
func NewReadTool ¶
func NewWebFetchTool ¶
func NewWebFetchToolWithOptions ¶
func NewWebFetchToolWithOptions(opts WebFetchOptions) Tool
func NewWebSearchTool ¶
func NewWebSearchToolWithOptions ¶
func NewWebSearchToolWithOptions(opts WebSearchOptions) Tool
func NewWriteFileTool ¶
func NewWriteFileToolWithPolicy ¶
func NewWriteFileToolWithPolicy(policy PathPolicy) Tool
func NewWriteTool ¶
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
Click to show internal directories.
Click to hide internal directories.