Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateTypes ¶
GenerateTypes produces TypeScript type declarations from registered tools. Output is a string suitable for injecting into LLM system prompts.
Types ¶
type ExecuteResult ¶
type ExecuteResult struct {
Value string // JSON-encoded return value
Console []string // console.log/warn/error output
Calls []ToolCallRecord // tool call records
}
ExecuteResult holds the output of a codemode execution.
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor runs sandboxed JavaScript with injected tool bindings.
func NewExecutor ¶
func NewExecutor(opts ...ExecutorOption) *Executor
NewExecutor creates a new executor with optional configuration.
type ExecutorOption ¶
type ExecutorOption func(*Executor)
ExecutorOption configures an Executor.
func WithCallTimeout ¶
func WithCallTimeout(d time.Duration) ExecutorOption
WithCallTimeout sets the timeout for individual tool calls (default 30s).
func WithMaxCodeSize ¶
func WithMaxCodeSize(size int64) ExecutorOption
WithMaxCodeSize sets the maximum code size (default 64KB).
func WithMaxToolCalls ¶
func WithMaxToolCalls(max int) ExecutorOption
WithMaxToolCalls sets the maximum tool calls per execution (default 20).
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds registered tools.
func (*Registry) Register ¶
Register adds a tool to the registry. Panics if the tool name is already registered.
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description"`
Func ToolFunc `json:"-"` // from executor.go
Schema map[string]any `json:"schema"` // JSON schema for type generation
Returns string `json:"-"` // TypeScript return type (e.g. "ExploreResult"), empty = "any"
}
Tool describes a registered tool for codemode.