mirror of
https://github.com/mark3labs/kit.git
synced 2026-06-14 03:30:26 +00:00
f36166bee5
Tool rename (breaking change for ToolName string comparisons in event handlers): - internal/core/subagent.go: Name field 'spawn_subagent' → 'subagent' - internal/extensions/wrapper.go: update coreToolKinds map key - pkg/kit/events.go: update coreToolKinds map key and ToolKindSubagent comment - pkg/kit/extensions_bridge.go: update three ToolName == ... guards - internal/ui/tool_renderers.go: update two toolName == ... case guards - internal/ui/stream.go: remove special-case branch (toolName is now already 'subagent', so the title-case fallback produces 'Subagent' naturally) Comments/docs updated everywhere (no logic changes): - internal/core/tools.go, internal/extensions/api.go, events.go - pkg/kit/kit.go, tools.go - examples/extensions/subagent-test.go, kit-telegram/main.go - README.md, skills/kit-sdk/SKILL.md - www/pages/advanced/subagents.md, extensions/capabilities.md - www/pages/index.md, sdk/callbacks.md - www/public/session/index.html (tracked UI asset) Redundant toolDisplayNames map removed (item #14): - internal/ui/messages.go: delete the 7-entry map whose every value was identical to what the title-case fallback already produced; simplify toolDisplayName() to just the fallback
59 lines
2.1 KiB
Go
59 lines
2.1 KiB
Go
package kit
|
|
|
|
import (
|
|
"charm.land/fantasy"
|
|
|
|
"github.com/mark3labs/kit/internal/core"
|
|
)
|
|
|
|
// Tool is the interface that all Kit tools implement.
|
|
type Tool = fantasy.AgentTool
|
|
|
|
// ToolOption configures tool behavior.
|
|
type ToolOption = core.ToolOption
|
|
|
|
// WithWorkDir sets the working directory for file-based tools.
|
|
// If empty, os.Getwd() is used at execution time.
|
|
var WithWorkDir = core.WithWorkDir
|
|
|
|
// --- Individual tool constructors ---
|
|
|
|
// NewReadTool creates a file-reading tool.
|
|
func NewReadTool(opts ...ToolOption) Tool { return core.NewReadTool(opts...) }
|
|
|
|
// NewWriteTool creates a file-writing tool.
|
|
func NewWriteTool(opts ...ToolOption) Tool { return core.NewWriteTool(opts...) }
|
|
|
|
// NewEditTool creates a surgical text-editing tool.
|
|
func NewEditTool(opts ...ToolOption) Tool { return core.NewEditTool(opts...) }
|
|
|
|
// NewBashTool creates a bash command execution tool.
|
|
func NewBashTool(opts ...ToolOption) Tool { return core.NewBashTool(opts...) }
|
|
|
|
// NewGrepTool creates a content search tool (uses ripgrep when available).
|
|
func NewGrepTool(opts ...ToolOption) Tool { return core.NewGrepTool(opts...) }
|
|
|
|
// NewFindTool creates a file search tool (uses fd when available).
|
|
func NewFindTool(opts ...ToolOption) Tool { return core.NewFindTool(opts...) }
|
|
|
|
// NewLsTool creates a directory listing tool.
|
|
func NewLsTool(opts ...ToolOption) Tool { return core.NewLsTool(opts...) }
|
|
|
|
// --- Tool bundles ---
|
|
|
|
// AllTools returns all available core tools.
|
|
func AllTools(opts ...ToolOption) []Tool { return core.AllTools(opts...) }
|
|
|
|
// CodingTools returns the default set of core tools for a coding agent:
|
|
// bash, read, write, edit.
|
|
func CodingTools(opts ...ToolOption) []Tool { return core.CodingTools(opts...) }
|
|
|
|
// ReadOnlyTools returns tools for read-only exploration:
|
|
// read, grep, find, ls.
|
|
func ReadOnlyTools(opts ...ToolOption) []Tool { return core.ReadOnlyTools(opts...) }
|
|
|
|
// SubagentTools returns all core tools except subagent. Use this when
|
|
// creating child Kit instances (in-process subagents) to prevent infinite
|
|
// recursion.
|
|
func SubagentTools(opts ...ToolOption) []Tool { return core.SubagentTools(opts...) }
|