write

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package write implements the write tool: overwrite a file inside the workspace root.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tool

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

Tool is the write tool.

func New

func New(root string) *Tool

New returns a write tool rooted at root. Writes outside root are refused.

func NewWithFilter

func NewWithFilter(root string, pathRe *regexp.Regexp) *Tool

NewWithFilter constructs the write tool with an optional path regex. When pathRe is nil, all paths are allowed (existing behavior). When pathRe is non-nil, writes to paths that do NOT match the regex (relative to root) are rejected with a clear error and no file is touched.

func (*Tool) Run

func (t *Tool) Run(ctx context.Context, in map[string]any) (tools.Result, error)

Run writes content to path after sandbox check.

func (*Tool) Spec

func (t *Tool) Spec() llm.ToolSpec

Spec advertises the tool to the model.

Jump to

Keyboard shortcuts

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