Files
ragflow/internal/harness/core/backend/backend.go
Yingfeng 956357b997 Feat: add harness-go framework —— agent core (#16045)
### What problem does this PR solve?

core module for agent layer built on top of graph engine #16039

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
2026-06-16 11:39:48 +08:00

37 lines
1.2 KiB
Go

// Package filesystem provides file system abstractions for agent file operations.
package backend
// FileInfo provides information about a file.
type FileInfo struct {
Name string `json:"name"`
Size int64 `json:"size"`
IsDir bool `json:"is_dir"`
ModTime string `json:"mod_time"`
}
// Backend defines the interface for file system operations.
type Backend interface {
Read(path string) (string, error)
Write(path, content string) error
Edit(path, old, new string) error
Glob(pattern string) ([]string, error)
Grep(pattern, path string) (string, error)
Stat(path string) (*FileInfo, error)
Mkdir(path string) error
Remove(path string) error
List(dir string) ([]FileInfo, error)
}
// Shell defines an interface for shell execution.
type Shell interface {
Execute(command string) (string, error)
ExecuteStreaming(command string) (<-chan string, error)
}
// MultiModalReader is an optional interface that backends can implement
// to support reading with offset/limit and multi-modal content detection.
type MultiModalReader interface {
ReadBytes(path string, offset, limit int64) ([]byte, error)
MimeType(path string) string // Returns content type hint (e.g., "text/plain", "image/png")
}