Documentation
¶
Index ¶
- type DeleteFileArgs
- type DeleteFileMethod
- type DeleteFileOut
- type FSTool
- func (ft *FSTool) AllowedRoots() []string
- func (ft *FSTool) DeleteFile(ctx context.Context, args DeleteFileArgs) (*DeleteFileOut, error)
- func (ft *FSTool) DeleteFileTool() spec.Tool
- func (ft *FSTool) ListDirectory(ctx context.Context, args ListDirectoryArgs) (*ListDirectoryOut, error)
- func (ft *FSTool) ListDirectoryTool() spec.Tool
- func (ft *FSTool) MIMEForExtension(ctx context.Context, args MIMEForExtensionArgs) (*MIMEForExtensionOut, error)
- func (ft *FSTool) MIMEForExtensionTool() spec.Tool
- func (ft *FSTool) MIMEForPath(ctx context.Context, args MIMEForPathArgs) (*MIMEForPathOut, error)
- func (ft *FSTool) MIMEForPathTool() spec.Tool
- func (ft *FSTool) ReadFile(ctx context.Context, args ReadFileArgs) ([]spec.ToolStoreOutputUnion, error)
- func (ft *FSTool) ReadFileTool() spec.Tool
- func (ft *FSTool) SearchFiles(ctx context.Context, args SearchFilesArgs) (*SearchFilesOut, error)
- func (ft *FSTool) SearchFilesTool() spec.Tool
- func (ft *FSTool) SetAllowedRoots(roots []string) error
- func (ft *FSTool) SetWorkBaseDir(base string) error
- func (ft *FSTool) StatPath(ctx context.Context, args StatPathArgs) (*StatPathOut, error)
- func (ft *FSTool) StatPathTool() spec.Tool
- func (ft *FSTool) Tools() []spec.Tool
- func (ft *FSTool) WorkBaseDir() string
- func (ft *FSTool) WriteFile(ctx context.Context, args WriteFileArgs) (*WriteFileOut, error)
- func (ft *FSTool) WriteFileTool() spec.Tool
- type FSToolOption
- type ListDirectoryArgs
- type ListDirectoryOut
- type MIMEDetectMethod
- type MIMEForExtensionArgs
- type MIMEForExtensionOut
- type MIMEForPathArgs
- type MIMEForPathOut
- type MIMEMode
- type ReadFileArgs
- type SearchFilesArgs
- type SearchFilesOut
- type StatPathArgs
- type StatPathOut
- type WriteFileArgs
- type WriteFileOut
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeleteFileArgs ¶ added in v0.6.0
type DeleteFileMethod ¶ added in v0.6.0
type DeleteFileMethod string
const ( DeleteFileMethodRename DeleteFileMethod = "rename" DeleteFileMethodCopyAndRemove DeleteFileMethod = "copyAndRemove" DeleteFileMethodSymlinkRehome DeleteFileMethod = "symlinkRehome" )
type DeleteFileOut ¶ added in v0.6.0
type DeleteFileOut struct {
OriginalPath string `json:"originalPath"`
TrashedPath string `json:"trashedPath"`
Method DeleteFileMethod `json:"method"`
}
type FSTool ¶ added in v0.7.0
type FSTool struct {
// contains filtered or unexported fields
}
FSTool is an instance-owned filesystem tool runner. It centralizes path resolution and sandbox policy:
- workBaseDir: base for resolving relative paths
- allowedRoots: optional restriction; if empty, allow all
func NewFSTool ¶ added in v0.7.0
func NewFSTool(opts ...FSToolOption) (*FSTool, error)
func (*FSTool) AllowedRoots ¶ added in v0.7.0
func (*FSTool) DeleteFile ¶ added in v0.7.0
func (ft *FSTool) DeleteFile(ctx context.Context, args DeleteFileArgs) (*DeleteFileOut, error)
func (*FSTool) DeleteFileTool ¶ added in v0.7.0
func (*FSTool) ListDirectory ¶ added in v0.7.0
func (ft *FSTool) ListDirectory(ctx context.Context, args ListDirectoryArgs) (*ListDirectoryOut, error)
func (*FSTool) ListDirectoryTool ¶ added in v0.7.0
func (*FSTool) MIMEForExtension ¶ added in v0.7.0
func (ft *FSTool) MIMEForExtension(ctx context.Context, args MIMEForExtensionArgs) (*MIMEForExtensionOut, error)
func (*FSTool) MIMEForExtensionTool ¶ added in v0.7.0
func (*FSTool) MIMEForPath ¶ added in v0.7.0
func (ft *FSTool) MIMEForPath(ctx context.Context, args MIMEForPathArgs) (*MIMEForPathOut, error)
func (*FSTool) MIMEForPathTool ¶ added in v0.7.0
func (*FSTool) ReadFile ¶ added in v0.7.0
func (ft *FSTool) ReadFile( ctx context.Context, args ReadFileArgs, ) ([]spec.ToolStoreOutputUnion, error)
func (*FSTool) ReadFileTool ¶ added in v0.7.0
func (*FSTool) SearchFiles ¶ added in v0.7.0
func (ft *FSTool) SearchFiles(ctx context.Context, args SearchFilesArgs) (*SearchFilesOut, error)
func (*FSTool) SearchFilesTool ¶ added in v0.7.0
func (*FSTool) SetAllowedRoots ¶ added in v0.7.0
SetAllowedRoots updates allowed roots at runtime (best-effort). If the current workBaseDir is not within the new roots, this returns an error and leaves state unchanged.
func (*FSTool) SetWorkBaseDir ¶ added in v0.7.0
SetWorkBaseDir updates the work base directory at runtime (best-effort).
func (*FSTool) StatPath ¶ added in v0.7.0
func (ft *FSTool) StatPath(ctx context.Context, args StatPathArgs) (*StatPathOut, error)
func (*FSTool) StatPathTool ¶ added in v0.7.0
func (*FSTool) WorkBaseDir ¶ added in v0.7.0
func (*FSTool) WriteFile ¶ added in v0.7.0
func (ft *FSTool) WriteFile(ctx context.Context, args WriteFileArgs) (*WriteFileOut, error)
func (*FSTool) WriteFileTool ¶ added in v0.7.0
type FSToolOption ¶ added in v0.7.0
func WithAllowedRoots ¶ added in v0.7.0
func WithAllowedRoots(roots []string) FSToolOption
WithAllowedRoots restricts all filesystem paths to be within one of the provided roots. Roots are canonicalized (clean+abs+best-effort symlink eval) and must exist as directories.
func WithWorkBaseDir ¶ added in v0.7.0
func WithWorkBaseDir(base string) FSToolOption
WithWorkBaseDir sets the base directory used to resolve relative input paths. If empty/whitespace, the current process working directory is used.
type ListDirectoryArgs ¶
type ListDirectoryOut ¶
type ListDirectoryOut struct {
Entries []string `json:"entries"`
}
type MIMEDetectMethod ¶ added in v0.4.0
type MIMEDetectMethod string
const ( MIMEDetectMethodExtension MIMEDetectMethod = "extension" MIMEDetectMethodSniff MIMEDetectMethod = "sniff" )
type MIMEForExtensionArgs ¶ added in v0.4.0
type MIMEForExtensionArgs struct {
Extension string `json:"extension"`
}
type MIMEForExtensionOut ¶ added in v0.4.0
type MIMEForPathArgs ¶ added in v0.4.0
type MIMEForPathArgs struct {
Path string `json:"path"`
}
type MIMEForPathOut ¶ added in v0.4.0
type MIMEForPathOut struct {
Path string `json:"path"`
Extension string `json:"extension,omitempty"`
NormalizedExtension string `json:"normalizedExtension,omitempty"`
MIMEType string `json:"mimeType"`
BaseMIMEType string `json:"baseMIMEType"`
Mode MIMEMode `json:"mode"`
Method MIMEDetectMethod `json:"method"`
}
type ReadFileArgs ¶
type SearchFilesArgs ¶
type SearchFilesOut ¶
type StatPathArgs ¶
type StatPathArgs struct {
Path string `json:"path"`
}