Documentation
¶
Index ¶
- Constants
- type Command
- type CommandOutput
- type EditorConfig
- type Input
- type Operator
- type PyExecutor
- type PyExecutorConfig
- type StrReplaceEditor
- func (e *StrReplaceEditor) Execute(ctx context.Context, params *StrReplaceEditorParams) (string, error)
- func (e *StrReplaceEditor) Info(ctx context.Context) (*schema.ToolInfo, error)
- func (e *StrReplaceEditor) InvokableRun(ctx context.Context, argumentsInJSON string, opts ...tool.Option) (string, error)
- type StrReplaceEditorParams
Constants ¶
View Source
const ( SnippetLines = 4 MaxResponseLen = 16000 TruncatedMessage = "<response clipped><NOTE>To save on context only part of this file has been shown to you. " + "You should retry this tool after you have searched inside the file with `grep -n` " + "in order to find the line numbers of what you are looking for.</NOTE>" )
Constants definition
View Source
const StrReplaceEditorDescription = `` /* 988-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandOutput ¶
type CommandOutput struct {
// Stdout contains the data written by the command to standard output (stdout).
// This is typically the "normal" output of a successful command.
Stdout string
// Stderr contains the data written by the command to standard error (stderr).
// This often includes warnings, errors, or diagnostic messages,
// even if the command exits successfully (exit code 0).
Stderr string
// ExitCode is the numeric exit status returned by the command.
// - 0 usually indicates success.
// - Non-zero values (1–255) typically indicate failure.
// - Special values like 137 (128 + 9) suggest the process was killed by signal 9 (SIGKILL),
// often due to exceeding memory limits (OOM).
ExitCode int
}
CommandOutput represents the result of executing a command in a sandboxed environment. It captures the standard output, standard error, and exit code of the process.
type EditorConfig ¶
type EditorConfig struct {
Operator Operator
}
type Operator ¶
type Operator interface {
ReadFile(ctx context.Context, path string) (string, error)
WriteFile(ctx context.Context, path string, content string) error
IsDirectory(ctx context.Context, path string) (bool, error)
Exists(ctx context.Context, path string) (bool, error)
RunCommand(ctx context.Context, command []string) (*CommandOutput, error)
}
Operator defines the interface for file operations
type PyExecutor ¶
type PyExecutor struct {
// contains filtered or unexported fields
}
func NewPyExecutor ¶
func NewPyExecutor(_ context.Context, cfg *PyExecutorConfig) (*PyExecutor, error)
func (*PyExecutor) Execute ¶
func (p *PyExecutor) Execute(ctx context.Context, args *Input) (*CommandOutput, error)
func (*PyExecutor) InvokableRun ¶
type PyExecutorConfig ¶
type StrReplaceEditor ¶
type StrReplaceEditor struct {
// contains filtered or unexported fields
}
StrReplaceEditor struct definition
func NewStrReplaceEditor ¶
func NewStrReplaceEditor(ctx context.Context, cfg *EditorConfig) (*StrReplaceEditor, error)
NewStrReplaceEditor creates a new editor instance
func (*StrReplaceEditor) Execute ¶
func (e *StrReplaceEditor) Execute(ctx context.Context, params *StrReplaceEditorParams) (string, error)
Execute performs file operations command
func (*StrReplaceEditor) InvokableRun ¶
type StrReplaceEditorParams ¶
type StrReplaceEditorParams struct {
Command Command `json:"command"`
Path string `json:"path"`
FileText *string `json:"file_text,omitempty"`
ViewRange []int `json:"view_range,omitempty"`
OldStr *string `json:"old_str,omitempty"`
NewStr *string `json:"new_str,omitempty"`
InsertLine *int `json:"insert_line,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.