core

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package core provides the built-in core tools for KIT's coding agent. These tools are direct fantasy.AgentTool implementations — no MCP layer, no JSON-RPC, no serialization overhead. Core tool set: bash, read, write, edit, grep, find, ls.

Index

Constants

View Source
const (

	// DefaultMaxLines is the exported default line limit for truncation.
	DefaultMaxLines = defaultMaxLines
	// DefaultMaxBytes is the exported default byte limit for truncation.
	DefaultMaxBytes = defaultMaxBytes
)

Variables

This section is empty.

Functions

func AllTools

func AllTools(opts ...ToolOption) []fantasy.AgentTool

AllTools returns all available core tools.

func CodingTools

func CodingTools(opts ...ToolOption) []fantasy.AgentTool

CodingTools returns the default set of core tools for a coding agent: bash, read, write, edit.

func NewBashTool

func NewBashTool(opts ...ToolOption) fantasy.AgentTool

NewBashTool creates the bash core tool.

func NewEditTool

func NewEditTool(opts ...ToolOption) fantasy.AgentTool

NewEditTool creates the edit core tool.

func NewFindTool

func NewFindTool(opts ...ToolOption) fantasy.AgentTool

NewFindTool creates the find core tool.

func NewGrepTool

func NewGrepTool(opts ...ToolOption) fantasy.AgentTool

NewGrepTool creates the grep core tool.

func NewLsTool

func NewLsTool(opts ...ToolOption) fantasy.AgentTool

NewLsTool creates the ls core tool.

func NewReadTool

func NewReadTool(opts ...ToolOption) fantasy.AgentTool

NewReadTool creates the read core tool.

func NewSubagentTool added in v0.9.0

func NewSubagentTool(opts ...ToolOption) fantasy.AgentTool

NewSubagentTool creates the spawn_subagent core tool.

func NewWriteTool

func NewWriteTool(opts ...ToolOption) fantasy.AgentTool

NewWriteTool creates the write core tool.

func ReadOnlyTools

func ReadOnlyTools(opts ...ToolOption) []fantasy.AgentTool

ReadOnlyTools returns tools for read-only exploration: read, grep, find, ls.

Types

type ToolConfig

type ToolConfig struct {
	WorkDir string
}

ToolConfig holds configuration for tool construction.

func ApplyOptions

func ApplyOptions(opts []ToolOption) ToolConfig

ApplyOptions applies the given ToolOptions to a ToolConfig and returns it.

type ToolOption

type ToolOption func(*ToolConfig)

ToolOption configures tool behavior.

func WithWorkDir

func WithWorkDir(dir string) ToolOption

WithWorkDir sets the working directory for file-based tools. If empty, os.Getwd() is used at execution time.

type TruncationResult

type TruncationResult struct {
	Content   string
	Truncated bool
	TruncBy   string // "lines", "bytes", or ""
	Total     int    // total lines before truncation
	Kept      int    // lines kept after truncation
}

TruncationResult describes how output was truncated.

func TruncateTail added in v0.5.1

func TruncateTail(content string, maxLines, maxBytes int) TruncationResult

TruncateTail keeps the last maxLines lines and at most maxBytes bytes. Used for bash output where the tail is most relevant.

Jump to

Keyboard shortcuts

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