Documentation
¶
Index ¶
- type CompileTool
- func (CompileTool) Description() string
- func (t CompileTool) Execute(ctx context.Context, _ map[string]any, _ tool.ToolEmitter) (*tool.Result, error)
- func (CompileTool) InputSchema() tool.DataSchema
- func (CompileTool) Mode() tool.ExecutionMode
- func (CompileTool) Name() string
- func (CompileTool) OutputSchema() tool.DataSchema
- type GrepTool
- func (GrepTool) Description() string
- func (t GrepTool) Execute(ctx context.Context, input map[string]any, _ tool.ToolEmitter) (*tool.Result, error)
- func (GrepTool) InputSchema() tool.DataSchema
- func (GrepTool) Mode() tool.ExecutionMode
- func (GrepTool) Name() string
- func (GrepTool) OutputSchema() tool.DataSchema
- type MergeResultTool
- func (m MergeResultTool) Description() string
- func (m MergeResultTool) Execute(ctx context.Context, input map[string]any, emitter tool.ToolEmitter) (*tool.Result, error)
- func (m MergeResultTool) InputSchema() tool.DataSchema
- func (m MergeResultTool) Mode() tool.ExecutionMode
- func (m MergeResultTool) Name() string
- func (m MergeResultTool) OutputSchema() tool.DataSchema
- type ReadFileTool
- func (ReadFileTool) Description() string
- func (r ReadFileTool) Execute(_ context.Context, input map[string]any, _ tool.ToolEmitter) (*tool.Result, error)
- func (ReadFileTool) InputSchema() tool.DataSchema
- func (ReadFileTool) Mode() tool.ExecutionMode
- func (ReadFileTool) Name() string
- func (ReadFileTool) OutputSchema() tool.DataSchema
- type ShellTool
- func (ShellTool) Description() string
- func (t ShellTool) Execute(ctx context.Context, input map[string]any, _ tool.ToolEmitter) (*tool.Result, error)
- func (ShellTool) InputSchema() tool.DataSchema
- func (ShellTool) Mode() tool.ExecutionMode
- func (ShellTool) Name() string
- func (ShellTool) OutputSchema() tool.DataSchema
- type WriteFileTool
- func (WriteFileTool) Description() string
- func (t WriteFileTool) Execute(_ context.Context, input map[string]any, _ tool.ToolEmitter) (*tool.Result, error)
- func (WriteFileTool) InputSchema() tool.DataSchema
- func (WriteFileTool) Mode() tool.ExecutionMode
- func (WriteFileTool) Name() string
- func (WriteFileTool) OutputSchema() tool.DataSchema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompileTool ¶
type CompileTool struct {
// contains filtered or unexported fields
}
CompileTool 在工作目录运行 `go build ./...`。 关键语义:编译失败**不是工具错误**——Success 始终为 true(只要命令跑起来了), 把 compiled(bool) 与 output(编译器报错) 放进结果,供 planner 看到报错后去修复。 这正是 control loop 的反馈来源。
func NewCompileTool ¶
func NewCompileTool(baseDir string) *CompileTool
func (CompileTool) Description ¶
func (CompileTool) Description() string
func (CompileTool) Execute ¶
func (t CompileTool) Execute(ctx context.Context, _ map[string]any, _ tool.ToolEmitter) (*tool.Result, error)
func (CompileTool) InputSchema ¶
func (CompileTool) InputSchema() tool.DataSchema
func (CompileTool) Mode ¶
func (CompileTool) Mode() tool.ExecutionMode
func (CompileTool) Name ¶
func (CompileTool) Name() string
func (CompileTool) OutputSchema ¶
func (CompileTool) OutputSchema() tool.DataSchema
type GrepTool ¶
type GrepTool struct {
// contains filtered or unexported fields
}
GrepTool 在工作目录用 `grep -rn` 按内容搜索文件(代码 agent 必备)
func NewGrepTool ¶
func (GrepTool) Description ¶
func (GrepTool) InputSchema ¶
func (GrepTool) InputSchema() tool.DataSchema
func (GrepTool) Mode ¶
func (GrepTool) Mode() tool.ExecutionMode
func (GrepTool) OutputSchema ¶
func (GrepTool) OutputSchema() tool.DataSchema
type MergeResultTool ¶
type MergeResultTool struct {
}
func NewMergeResultTool ¶
func NewMergeResultTool() *MergeResultTool
func (MergeResultTool) Description ¶
func (m MergeResultTool) Description() string
func (MergeResultTool) Execute ¶
func (m MergeResultTool) Execute(ctx context.Context, input map[string]any, emitter tool.ToolEmitter) (*tool.Result, error)
func (MergeResultTool) InputSchema ¶
func (m MergeResultTool) InputSchema() tool.DataSchema
func (MergeResultTool) Mode ¶
func (m MergeResultTool) Mode() tool.ExecutionMode
func (MergeResultTool) Name ¶
func (m MergeResultTool) Name() string
func (MergeResultTool) OutputSchema ¶
func (m MergeResultTool) OutputSchema() tool.DataSchema
type ReadFileTool ¶
type ReadFileTool struct {
MaxBytes int64
// contains filtered or unexported fields
}
ReadFileTool 读取工作目录下的 UTF-8 文本文件。每行带行号前缀,支持 offset/limit 窗口读取。 大型文件拒绝全读并提示用 offset/limit —— 专为 LLM 设计。
这是对标 MCP read_text_file 的本地工具,保留了原作者的全部核心设计:行号右对齐、 大文件预算拒绝、窗口截断提示、路径穿越防御、UTF-8 校验。
func NewReadFileTool ¶
func NewReadFileTool(baseDir string) *ReadFileTool
func (ReadFileTool) Description ¶
func (ReadFileTool) Description() string
func (ReadFileTool) Execute ¶
func (r ReadFileTool) Execute(_ context.Context, input map[string]any, _ tool.ToolEmitter) (*tool.Result, error)
func (ReadFileTool) InputSchema ¶
func (ReadFileTool) InputSchema() tool.DataSchema
func (ReadFileTool) Mode ¶
func (ReadFileTool) Mode() tool.ExecutionMode
func (ReadFileTool) Name ¶
func (ReadFileTool) Name() string
func (ReadFileTool) OutputSchema ¶
func (ReadFileTool) OutputSchema() tool.DataSchema
type ShellTool ¶
type ShellTool struct {
// contains filtered or unexported fields
}
ShellTool 在工作目录运行一条 shell 命令(sh -c),让代码 agent 能跑测试/构建/运行程序。
与 compile 工具同样的反馈语义:命令非零退出/超时**不是工具错误**——Success 仍为 true, 把 stdout/stderr/exit_code/timed_out 放进结果供 planner 据此决定下一步。
超时与进程树击杀(被真实任务赚来的修复):命令跑在**独立进程组**里;超时(或 ctx 取消)时 击杀**整个进程组**——否则像 `sh -c "go test"` 这种,超时只杀 sh、杀不掉 go test 孙子进程, 孙子继承 stdout 管道会让读取无限阻塞,把整个 agent 拖死。
安全边界(本版):命令受限在 baseDir + 超时。生产级沙箱(白名单/容器/资源限额)尚未做。
func NewShellTool ¶
func (ShellTool) Description ¶
func (ShellTool) InputSchema ¶
func (ShellTool) InputSchema() tool.DataSchema
func (ShellTool) Mode ¶
func (ShellTool) Mode() tool.ExecutionMode
func (ShellTool) OutputSchema ¶
func (ShellTool) OutputSchema() tool.DataSchema
type WriteFileTool ¶
type WriteFileTool struct {
// contains filtered or unexported fields
}
WriteFileTool 把内容写入工作目录下的文件。M1 用于让 planner 生成/修改代码。
func NewWriteFileTool ¶
func NewWriteFileTool(baseDir string) *WriteFileTool
func (WriteFileTool) Description ¶
func (WriteFileTool) Description() string
func (WriteFileTool) Execute ¶
func (t WriteFileTool) Execute(_ context.Context, input map[string]any, _ tool.ToolEmitter) (*tool.Result, error)
func (WriteFileTool) InputSchema ¶
func (WriteFileTool) InputSchema() tool.DataSchema
func (WriteFileTool) Mode ¶
func (WriteFileTool) Mode() tool.ExecutionMode
func (WriteFileTool) Name ¶
func (WriteFileTool) Name() string
func (WriteFileTool) OutputSchema ¶
func (WriteFileTool) OutputSchema() tool.DataSchema