action

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllTools

func AllTools() []provider.ToolDefinition

AllTools returns all available tool definitions.

func DetectVerifyCommand added in v0.2.0

func DetectVerifyCommand(workDir string) string

DetectVerifyCommand auto-detects the appropriate test/verify command for the project in the given working directory.

func FileReadTool

func FileReadTool() provider.ToolDefinition

FileReadTool returns a ToolDefinition for reading files.

func FileWriteTool

func FileWriteTool() provider.ToolDefinition

FileWriteTool returns a ToolDefinition for writing files.

func RunVerification added in v0.2.0

func RunVerification(ctx context.Context, command string, workDir string, timeout time.Duration) (output string, success bool, err error)

RunVerification executes a verification command and returns the output and whether it succeeded.

func ShellExecTool

func ShellExecTool() provider.ToolDefinition

ShellExecTool returns a ToolDefinition for executing shell commands.

Types

type ConfirmFunc

type ConfirmFunc func(description string) bool

ConfirmFunc is a callback that asks the user to confirm an action. It receives a human-readable description and returns true if the user approves.

type Executor

type Executor struct {
	// contains filtered or unexported fields
}

Executor dispatches tool calls to the appropriate handler.

func NewExecutor

func NewExecutor(confirm ConfirmFunc, cmdTimeout time.Duration) *Executor

NewExecutor creates an Executor with the given confirmation callback and command timeout for shell operations.

func (*Executor) Execute

func (e *Executor) Execute(call provider.ToolCall) ToolResult

Execute parses a ToolCall and routes it to the correct handler.

type ToolLoop

type ToolLoop struct {
	// contains filtered or unexported fields
}

ToolLoop manages the iterative cycle of executing tool calls and sending results back to the model until the model produces a final text response.

func NewToolLoop

func NewToolLoop(executor *Executor, primary provider.Provider) *ToolLoop

NewToolLoop creates a ToolLoop with the given executor and primary provider.

func (*ToolLoop) Run

func (l *ToolLoop) Run(
	ctx context.Context,
	messages []provider.Message,
	toolCalls []provider.ToolCall,
	opts provider.QueryOpts,
) (<-chan provider.StreamChunk, error)

Run executes tool calls, appends results as messages, and re-queries the model. It repeats until the model stops issuing tool calls or the iteration limit is reached. It returns the final streaming response channel.

type ToolResult

type ToolResult struct {
	ToolCallID string
	Output     string
	Error      error
}

ToolResult holds the outcome of executing a single tool call.

Jump to

Keyboard shortcuts

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