agentfiles

package
v2.33.3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WindowsDriveRegex = regexp.MustCompile(`^[a-zA-Z]:\\$`)

Functions

This section is empty.

Types

type API

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

API exposes file-related operations performed through the agent.

func NewAPI

func NewAPI(logger slog.Logger, filesystem afero.Fs, pathStore *agentgit.PathStore) *API

func (*API) HandleEditFiles

func (api *API) HandleEditFiles(rw http.ResponseWriter, r *http.Request)

func (*API) HandleLS

func (api *API) HandleLS(rw http.ResponseWriter, r *http.Request)

func (*API) HandleReadFile

func (api *API) HandleReadFile(rw http.ResponseWriter, r *http.Request)

func (*API) HandleReadFileLines added in v2.32.0

func (api *API) HandleReadFileLines(rw http.ResponseWriter, r *http.Request)

func (*API) HandleResolvePath added in v2.33.0

func (api *API) HandleResolvePath(rw http.ResponseWriter, r *http.Request)

HandleResolvePath resolves the existing portion of an absolute path through any symlinks and returns the resulting path. Missing trailing components are preserved so callers can validate future writes against the real target.

func (*API) HandleWriteFile

func (api *API) HandleWriteFile(rw http.ResponseWriter, r *http.Request)

func (*API) Routes

func (api *API) Routes() http.Handler

Routes returns the HTTP handler for file-related routes.

type HTTPResponseCode

type HTTPResponseCode = int

type ReadFileLinesResponse added in v2.32.0

type ReadFileLinesResponse struct {
	// Success indicates whether the read was successful.
	Success bool `json:"success"`
	// FileSize is the original file size in bytes.
	FileSize int64 `json:"file_size,omitempty"`
	// TotalLines is the total number of lines in the file.
	TotalLines int `json:"total_lines,omitempty"`
	// LinesRead is the count of lines returned in this response.
	LinesRead int `json:"lines_read,omitempty"`
	// Content is the line-numbered file content.
	Content string `json:"content,omitempty"`
	// Error is the error message when success is false.
	Error string `json:"error,omitempty"`
}

ReadFileLinesResponse is the JSON response for the line-based file reader.

Jump to

Keyboard shortcuts

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