Documentation
¶
Index ¶
- func BuildTools(fsTool *Tool) []*agent.Tool
- type Config
- type FileInfo
- type ReadResult
- type StatResult
- type Tool
- func (t *Tool) Copy(src, dst string) error
- func (t *Tool) Delete(ctx context.Context, path string) error
- func (t *Tool) Edit(path string, startLine, endLine int, newContent string) error
- func (t *Tool) Exists(path string) (bool, error)
- func (t *Tool) ListDir(path string) ([]FileInfo, error)
- func (t *Tool) Mkdir(path string) error
- func (t *Tool) Read(path string) (string, error)
- func (t *Tool) ReadLines(path string, startLine, endLine int) (string, error)
- func (t *Tool) ReadWithMeta(path string, offset, limit int) (*ReadResult, error)
- func (t *Tool) Stat(path string) (*StatResult, error)
- func (t *Tool) Write(path, content string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildTools ¶ added in v0.7.0
BuildTools creates filesystem agent tools backed by the given Tool.
Types ¶
type Config ¶
type Config struct {
MaxReadSize int64 // maximum file size to read
AllowedPaths []string // allowed base paths (empty = all)
BlockedPaths []string // paths that are always denied
}
Config holds filesystem tool configuration
type FileInfo ¶
type FileInfo struct {
Path string `json:"path"`
Name string `json:"name"`
Size int64 `json:"size"`
IsDir bool `json:"isDir"`
ModTime int64 `json:"modTime"`
Mode string `json:"mode"`
}
FileInfo represents file metadata
type ReadResult ¶ added in v0.6.0
type ReadResult struct {
Content string `json:"content"`
TotalLines int `json:"totalLines"`
Size int64 `json:"size"`
Offset int `json:"offset,omitempty"`
Limit int `json:"limit,omitempty"`
}
ReadResult holds file content with metadata.
type StatResult ¶ added in v0.6.0
type StatResult struct {
Path string `json:"path"`
Size int64 `json:"size"`
Lines int `json:"lines"`
ModTime int64 `json:"modTime"`
IsDir bool `json:"isDir"`
Permission string `json:"permission"`
}
StatResult holds file metadata without reading content.
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
Tool provides filesystem operations
func (*Tool) Delete ¶
Delete removes a file or directory. In P2P context, only single files or empty directories are allowed (no recursive deletion by remote peers).
func (*Tool) ReadWithMeta ¶ added in v0.6.0
func (t *Tool) ReadWithMeta(path string, offset, limit int) (*ReadResult, error)
ReadWithMeta reads a file with offset/limit support and returns content + metadata. offset is 1-indexed line number (0 or 1 = start from beginning). limit is max lines to return (0 = all lines).
Click to show internal directories.
Click to hide internal directories.