Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDoneTool ¶
func NewDoneTool(signal *DoneSignal) tool.ToolDef
NewDoneTool returns a ToolDef for the done tool bound to signal. When Execute is called the summary is stored on signal and Done is set to true.
Types ¶
type CmdHook ¶
type CmdHook struct {
Name string
Match func(subcommand string, exitCode int) bool
Run func(projectDir string) string
}
CmdHook runs after go_cmd produces a non-zero exit code. Name is the key used in CmdResult.Hooks. Match decides whether this hook applies. Run returns output to add to the hooks map.
type CmdResult ¶
type CmdResult struct {
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
ExitCode int `json:"exit_code"`
Hooks map[string]string `json:"hooks,omitempty"`
}
CmdResult is a JSON-serializable command execution result used by go_cmd and git_cmd.
type Config ¶
type Config struct {
// BashTimeout is the default execution timeout for the bash tool.
// If zero, a 30-second default is applied.
BashTimeout time.Duration
}
Config carries tool-level configuration for the registry builder.
type DomainTools ¶
DomainTools holds project-level domain tools.
func NewDomainTools ¶
func NewDomainTools(projectDir string) DomainTools
NewDomainTools constructs domain tools bound to projectDir.
type DoneSignal ¶
type DoneSignal struct {
Done bool
Summary string
Files []string // paths modified during this session (relative to project dir)
}
DoneSignal is populated by the done tool when the agent signals completion. The caller inspects Done, Summary, and Files after the loop exits.
func Build ¶
Build instantiates all tools bound to projectDir and returns them as a slice alongside a DoneSignal that the caller can inspect after the loop exits.
The standard tool set is AST-first: ast and rewrite for Go source files, read_file for non-Go files (config, markdown, YAML), write_file for creating or overwriting files. All Go toolchain and git operations go through go_cmd and git_cmd respectively.
Tools that modify files (write_file, edit_file, rewrite) track their changes in a manifest. After the loop exits, DoneSignal.Files contains the list of modified paths.
type FSTools ¶
type FSTools struct {
ReadTool tool.ToolDef
WriteTool tool.ToolDef
EditTool tool.ToolDef
ListTool tool.ToolDef
}
FSTools holds the file-system ToolDefs bound to a project directory.
func NewFSTools ¶
func NewFSTools(projectDir string, manifest *Manifest, hooks *HookRegistry) FSTools
NewFSTools constructs FSTools bound to projectDir. Every path argument is resolved through sandbox.Resolve before any OS call. The manifest tracks files modified by write_file and edit_file. Hooks run after successful writes/edits (nil hooks is safe).
type FileHook ¶
FileHook runs after a file is successfully written or edited. Pattern is a glob matched against filepath.Base(relPath). Run receives the absolute path and project directory. Returns output to append to the tool result ("" = silent).
type GitCmdTools ¶
GitCmdTools holds the git_cmd ToolDef bound to a project directory.
func NewGitCmdTool ¶
func NewGitCmdTool(projectDir string, defaultTimeout time.Duration) GitCmdTools
NewGitCmdTool constructs GitCmdTools bound to projectDir.
type GoASTTools ¶
GoASTTools holds the AST-aware ToolDefs bound to a project directory.
func NewGoASTTools ¶
func NewGoASTTools(projectDir string, manifest *Manifest) GoASTTools
NewGoASTTools constructs GoASTTools bound to projectDir. The manifest tracks files modified by the rewrite tool.
type GoCmdTools ¶
GoCmdTools holds the go_cmd ToolDef bound to a project directory.
func NewGoCmdTool ¶
func NewGoCmdTool(projectDir string, defaultTimeout time.Duration, hooks *HookRegistry) GoCmdTools
NewGoCmdTool constructs GoCmdTools bound to projectDir. Hooks run after failed commands (nil hooks is safe).
type HookRegistry ¶
HookRegistry holds file and command hooks.
func NewDefaultHookRegistry ¶
func NewDefaultHookRegistry(projectDir string) *HookRegistry
NewDefaultHookRegistry creates a HookRegistry with the standard hooks: - *.go files: gofmt -w (silent on success, reports syntax errors) - go.mod: go mod tidy (silent on success, reports errors) - build/test/vet failure: gopls check ./... (if gopls on PATH)
func (*HookRegistry) RunCmdHooks ¶
func (hr *HookRegistry) RunCmdHooks(subcommand string, exitCode int, projectDir string) map[string]string
RunCmdHooks runs all matching command hooks and returns a map of name->output. Nil-safe: returns nil if hr is nil or no hooks matched.
func (*HookRegistry) RunFileHooks ¶
func (hr *HookRegistry) RunFileHooks(relPath, absPath, projectDir string) string
RunFileHooks runs all file hooks matching relPath and returns aggregated output. Nil-safe: returns "" if hr is nil.
type Manifest ¶
type Manifest struct {
// contains filtered or unexported fields
}
Manifest tracks files modified by tool execution. It is shared across write_file, edit_file, and rewrite tools.
type SearchTools ¶
SearchTools holds the grep and glob ToolDefs bound to a project directory.
func NewSearchTools ¶
func NewSearchTools(projectDir string) SearchTools
NewSearchTools constructs SearchTools bound to projectDir. Every path argument is resolved through sandbox.Resolve before any OS call.