Documentation
¶
Index ¶
- type DeleteFileArgs
- type DeleteFileMethod
- type DeleteFileOut
- type FSTool
- 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.ToolOutputUnion, 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) StatPath(ctx context.Context, args StatPathArgs) (*StatPathOut, error)
- func (ft *FSTool) StatPathTool() spec.Tool
- func (ft *FSTool) WriteFile(ctx context.Context, args WriteFileArgs) (*WriteFileOut, error)
- func (ft *FSTool) WriteFileTool() spec.Tool
- type FSToolOption
- type ListDirectoryArgs
- type ListDirectoryEntry
- type ListDirectoryEntryKind
- type ListDirectoryOut
- type MIMEDetectMethod
- type MIMEForExtensionArgs
- type MIMEForExtensionOut
- type MIMEForPathArgs
- type MIMEForPathOut
- type MIMEMode
- type ReadFileArgs
- type SearchFilesArgs
- type SearchFilesMatch
- type SearchFilesMatchKind
- type SearchFilesOut
- type SearchFilesSearchIn
- type StatPathArgs
- type StatPathOut
- type WriteFileAction
- 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
- blockSymlinks: blocks symlink traversal (enforced downstream).
func NewFSTool ¶ added in v0.7.0
func NewFSTool(opts ...FSToolOption) (*FSTool, error)
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.ToolOutputUnion, 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) 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) 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 WithBlockSymlinks ¶ added in v0.10.0
func WithBlockSymlinks(block bool) FSToolOption
WithBlockSymlinks configures whether symlink traversal should be blocked (if supported downstream).
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, NewFSTool will pick an effective default (via InitPathPolicy).
type ListDirectoryArgs ¶
type ListDirectoryArgs struct {
Path string `json:"path,omitempty"`
NameGlob string `json:"nameGlob,omitempty"`
IncludeDotEntries bool `json:"includeDotEntries,omitempty"`
Kind ListDirectoryEntryKind `json:"kind,omitempty"`
MaxEntries int `json:"maxEntries,omitempty"`
}
type ListDirectoryEntry ¶ added in v0.13.0
type ListDirectoryEntry struct {
Name string `json:"name"`
Kind ListDirectoryEntryKind `json:"kind"`
}
type ListDirectoryEntryKind ¶ added in v0.13.0
type ListDirectoryEntryKind string
const ( ListDirectoryEntryKindAll ListDirectoryEntryKind = "all" ListDirectoryEntryKindFile ListDirectoryEntryKind = "file" ListDirectoryEntryKindDirectory ListDirectoryEntryKind = "directory" ListDirectoryEntryKindOther ListDirectoryEntryKind = "other" )
type ListDirectoryOut ¶
type ListDirectoryOut struct {
Path string `json:"path"`
ReachedMaxEntries bool `json:"reachedMaxEntries"`
Items []ListDirectoryEntry `json:"items,omitempty"`
}
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 SearchFilesArgs struct {
Root string `json:"root,omitempty"`
Query string `json:"query,omitempty"`
Regexp bool `json:"regexp,omitempty"`
SearchIn SearchFilesSearchIn `json:"searchIn,omitempty"`
NameGlob string `json:"nameGlob,omitempty"`
CaseSensitive *bool `json:"caseSensitive,omitempty"`
IncludeDotEntries bool `json:"includeDotEntries,omitempty"`
MaxResults int `json:"maxResults,omitempty"`
}
type SearchFilesMatch ¶ added in v0.13.0
type SearchFilesMatch struct {
Path string `json:"path"`
MatchKind SearchFilesMatchKind `json:"matchKind"`
}
type SearchFilesMatchKind ¶ added in v0.13.0
type SearchFilesMatchKind string
const ( SearchFilesMatchKindPath SearchFilesMatchKind = "path" SearchFilesMatchKindContent SearchFilesMatchKind = "content" SearchFilesMatchKindPathAndContent SearchFilesMatchKind = "pathAndContent" )
type SearchFilesOut ¶
type SearchFilesOut struct {
Root string `json:"root"`
Items []SearchFilesMatch `json:"items,omitempty"`
MatchCount int `json:"matchCount"`
ReachedMaxResults bool `json:"reachedMaxResults"`
}
type SearchFilesSearchIn ¶ added in v0.13.0
type SearchFilesSearchIn string
const ( SearchFilesSearchInPath SearchFilesSearchIn = "path" SearchFilesSearchInContent SearchFilesSearchIn = "content" SearchFilesSearchInPathOrContent SearchFilesSearchIn = "pathOrContent" )
type StatPathArgs ¶
type StatPathArgs struct {
Path string `json:"path"`
}
type StatPathOut ¶
type WriteFileAction ¶ added in v0.13.0
type WriteFileAction string
const ( WriteFileActionCreated WriteFileAction = "created" WriteFileActionOverwritten WriteFileAction = "overwritten" )
type WriteFileArgs ¶ added in v0.6.0
type WriteFileOut ¶ added in v0.6.0
type WriteFileOut struct {
Path string `json:"path"`
BytesWritten int64 `json:"bytesWritten"`
Action WriteFileAction `json:"action"`
}
Click to show internal directories.
Click to hide internal directories.